@deepcitation/deepcitation-js 1.1.39 → 1.1.41

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.
@@ -4,14 +4,14 @@
4
4
 
5
5
  For every claim, value, or fact; you MUST cite sources using this exact syntax:
6
6
 
7
- <cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim quote' start_page_key='page_number_N_index_I' line_ids='X-Y' />
7
+ <cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim quote' key_span='1-3 key words' start_page_key='page_number_N_index_I' line_ids='X-Y' />
8
8
 
9
9
  ### Syntax Rules (MUST follow)
10
10
 
11
11
  1. **attachment_id**: Use the exact ID from the source document
12
12
  2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)
13
- 3. **key_span**: The 1-3 most important words or value from full_phrase
14
- 4. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).
13
+ 3. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).
14
+ 4. **key_span**: The 1-3 most important words or value from full_phrase
15
15
  5. **start_page_key**: ONLY use format \`page_number_N_index_I\` from page tags (e.g., \`<page_number_1_index_0>\`). Never extract page numbers from document content.
16
16
  6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.
17
17
 
@@ -24,11 +24,11 @@ For every claim, value, or fact; you MUST cite sources using this exact syntax:
24
24
 
25
25
  ### Example Citation 1
26
26
 
27
- The company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' key_span='increased 45%' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' start_page_key='page_number_2_index_1' line_ids='12-14' />
27
+ The company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' key_span='increased 45%' start_page_key='page_number_2_index_1' line_ids='12-14' />
28
28
 
29
29
  ### Example Citation 2
30
30
 
31
- The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' key_span='$500 USD' full_phrase='The total amount is $500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />
31
+ The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' full_phrase='The total amount is $500 USD' key_span='$500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />
32
32
 
33
33
  </citation-instructions>
34
34
  `,y=`
@@ -37,14 +37,14 @@ The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly st
37
37
 
38
38
  For every claim, value, or fact; you MUST cite sources using this exact syntax:
39
39
 
40
- <cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim transcript quote' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />
40
+ <cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim transcript quote' key_span='1-3 key words' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />
41
41
 
42
42
  ### Syntax Rules (MUST follow)
43
43
 
44
44
  1. **attachment_id**: Use the exact ID from the source
45
45
  2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)
46
- 3. **key_span**: The 1-3 most important words or value from full_phrase
47
- 4. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).
46
+ 3. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).
47
+ 4. **key_span**: The 1-3 most important words or value from full_phrase
48
48
  5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')
49
49
 
50
50
  ### Placement Rules
@@ -67,4 +67,4 @@ ${a}`).join(`
67
67
 
68
68
  ${d}
69
69
 
70
- ${i}`;}return {enhancedSystemPrompt:s,enhancedUserPrompt:c}}var O={type:"object",properties:{attachmentId:{type:"string"},reasoning:{type:"string",description:"The logic connecting the form section requirements to the supporting source citation (think first!)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},fullPhrase:{type:"string",description:"The verbatim text of the terse phrase inside <attachment_text /> to support the citation (if there is a detected OCR correction, use the corrected text)"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},lineIds:{type:"array",items:{type:"number"},description:"Infer lineIds, as we only provide the first, last, and every 5th line. Provide inclusive lineIds for the fullPhrase."}},required:["attachmentId","reasoning","keySpan","fullPhrase","startPageKey","lineIds"]},v={type:"object",properties:{attachmentId:{type:"string"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},fullPhrase:{type:"string",description:"The exact verbatim text of the phrase or paragraph from the source document to support the citation (if there is a detected OCR correction, use the verbatim corrected text)"},timestamps:{type:"object",properties:{startTime:{type:"string"},endTime:{type:"string"}},required:["startTime","endTime"],description:"The timestamp of the audio or video frame including milliseconds formatted as: HH:MM:SS.SSS"}},required:["attachmentId","startPageKey","fullPhrase","timestamps"]};var u=4,I=3,P=5;function S(t,n){let i={};for(let e of t){for(let r=u;r<=e.length;r++){let s=e.slice(0,r),c=(s.match(/\d/g)||[]).length,o=(s.match(/[a-zA-Z]/g)||[]).length;if(s.length<u||c>0&&o<I||c===0&&o<P||t.some(m=>m!==e&&m.startsWith(s)))continue;let p=m=>m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),a=(n.match(new RegExp(p(s),"g"))||[]).length,l=(n.match(new RegExp(p(e),"g"))||[]).length;if(a===l){i[s]=e;break}}if(!Object.values(i).includes(e))throw new Error(`Cannot find a safe unique prefix for ID "${e}" that meets the minimum requirements (length: ${u})`)}return i}function E(t,n){if(!n||n.length===0)return {compressed:t,prefixMap:{}};let i=Array.from(new Set(n)),e=JSON.stringify(t),r=S(i,e),s=Object.keys(r).sort((o,p)=>p.length-o.length),c=e;for(let o of s){let a=r[o].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");c=c.replace(new RegExp(a,"g"),o);}return {compressed:JSON.parse(c),prefixMap:r}}function b(t,n){if(!n||Object.keys(n).length===0)return t;let i=Object.entries(n).sort((a,l)=>l[0].length-a[0].length),e,r=false;typeof t=="string"?e=t:(e=JSON.stringify(t),r=true);let s=e?.length;for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e=e.replace(new RegExp(m,"g"),l);}let c=["attachmentId","attachment_id","attachment_ID","attachmentID","fileId","file_id","file_ID","fileID","fileid"];for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),h=c.join("|"),f="([\"'`])",g=new RegExp(`(${h})(\\s*=\\s*)${f}${m}\\3`,"g");e=e.replace(g,`$1$2$3${l}$3`);}let o=e?.length,p=s-o;if(p>0)throw new Error(`[decompressedPromptIds] diff ${p} originalLength ${s} newLength ${o}`);return r?JSON.parse(e):e}exports.a=_;exports.b=y;exports.c=d;exports.d=T;exports.e=x;exports.f=R;exports.g=O;exports.h=v;exports.i=E;exports.j=b;
70
+ ${i}`;}return {enhancedSystemPrompt:s,enhancedUserPrompt:c}}var v={type:"object",properties:{attachmentId:{type:"string"},reasoning:{type:"string",description:"The logic connecting the form section requirements to the supporting source citation (think first!)"},fullPhrase:{type:"string",description:"The verbatim text of the terse phrase inside <attachment_text /> to support the citation (if there is a detected OCR correction, use the corrected text)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},lineIds:{type:"array",items:{type:"number"},description:"Infer lineIds, as we only provide the first, last, and every 5th line. Provide inclusive lineIds for the fullPhrase."}},required:["attachmentId","reasoning","fullPhrase","keySpan","startPageKey","lineIds"]},O={type:"object",properties:{attachmentId:{type:"string"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},fullPhrase:{type:"string",description:"The exact verbatim text of the phrase or paragraph from the source document to support the citation (if there is a detected OCR correction, use the verbatim corrected text)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},timestamps:{type:"object",properties:{startTime:{type:"string"},endTime:{type:"string"}},required:["startTime","endTime"],description:"The timestamp of the audio or video frame including milliseconds formatted as: HH:MM:SS.SSS"}},required:["attachmentId","startPageKey","fullPhrase","keySpan","timestamps"]};var u=4,P=3,I=5;function S(t,n){let i={};for(let e of t){for(let r=u;r<=e.length;r++){let s=e.slice(0,r),c=(s.match(/\d/g)||[]).length,o=(s.match(/[a-zA-Z]/g)||[]).length;if(s.length<u||c>0&&o<P||c===0&&o<I||t.some(m=>m!==e&&m.startsWith(s)))continue;let p=m=>m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),a=(n.match(new RegExp(p(s),"g"))||[]).length,l=(n.match(new RegExp(p(e),"g"))||[]).length;if(a===l){i[s]=e;break}}if(!Object.values(i).includes(e))throw new Error(`Cannot find a safe unique prefix for ID "${e}" that meets the minimum requirements (length: ${u})`)}return i}function w(t,n){if(!n||n.length===0)return {compressed:t,prefixMap:{}};let i=Array.from(new Set(n)),e=JSON.stringify(t),r=S(i,e),s=Object.keys(r).sort((o,p)=>p.length-o.length),c=e;for(let o of s){let a=r[o].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");c=c.replace(new RegExp(a,"g"),o);}return {compressed:JSON.parse(c),prefixMap:r}}function A(t,n){if(!n||Object.keys(n).length===0)return t;let i=Object.entries(n).sort((a,l)=>l[0].length-a[0].length),e,r=false;typeof t=="string"?e=t:(e=JSON.stringify(t),r=true);let s=e?.length;for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e=e.replace(new RegExp(m,"g"),l);}let c=["attachmentId","attachment_id","attachment_ID","attachmentID","fileId","file_id","file_ID","fileID","fileid"];for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),h=c.join("|"),f="([\"'`])",g=new RegExp(`(${h})(\\s*=\\s*)${f}${m}\\3`,"g");e=e.replace(g,`$1$2$3${l}$3`);}let o=e?.length,p=s-o;if(p>0)throw new Error(`[decompressedPromptIds] diff ${p} originalLength ${s} newLength ${o}`);return r?JSON.parse(e):e}exports.a=_;exports.b=y;exports.c=d;exports.d=T;exports.e=x;exports.f=R;exports.g=v;exports.h=O;exports.i=w;exports.j=A;
@@ -4,14 +4,14 @@ var _=`
4
4
 
5
5
  For every claim, value, or fact; you MUST cite sources using this exact syntax:
6
6
 
7
- <cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim quote' start_page_key='page_number_N_index_I' line_ids='X-Y' />
7
+ <cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim quote' key_span='1-3 key words' start_page_key='page_number_N_index_I' line_ids='X-Y' />
8
8
 
9
9
  ### Syntax Rules (MUST follow)
10
10
 
11
11
  1. **attachment_id**: Use the exact ID from the source document
12
12
  2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)
13
- 3. **key_span**: The 1-3 most important words or value from full_phrase
14
- 4. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).
13
+ 3. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).
14
+ 4. **key_span**: The 1-3 most important words or value from full_phrase
15
15
  5. **start_page_key**: ONLY use format \`page_number_N_index_I\` from page tags (e.g., \`<page_number_1_index_0>\`). Never extract page numbers from document content.
16
16
  6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.
17
17
 
@@ -24,11 +24,11 @@ For every claim, value, or fact; you MUST cite sources using this exact syntax:
24
24
 
25
25
  ### Example Citation 1
26
26
 
27
- The company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' key_span='increased 45%' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' start_page_key='page_number_2_index_1' line_ids='12-14' />
27
+ The company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' key_span='increased 45%' start_page_key='page_number_2_index_1' line_ids='12-14' />
28
28
 
29
29
  ### Example Citation 2
30
30
 
31
- The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' key_span='$500 USD' full_phrase='The total amount is $500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />
31
+ The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' full_phrase='The total amount is $500 USD' key_span='$500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />
32
32
 
33
33
  </citation-instructions>
34
34
  `,y=`
@@ -37,14 +37,14 @@ The total amount is $500 USD <cite attachment_id='abc123' reasoning='directly st
37
37
 
38
38
  For every claim, value, or fact; you MUST cite sources using this exact syntax:
39
39
 
40
- <cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim transcript quote' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />
40
+ <cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim transcript quote' key_span='1-3 key words' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />
41
41
 
42
42
  ### Syntax Rules (MUST follow)
43
43
 
44
44
  1. **attachment_id**: Use the exact ID from the source
45
45
  2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)
46
- 3. **key_span**: The 1-3 most important words or value from full_phrase
47
- 4. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).
46
+ 3. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).
47
+ 4. **key_span**: The 1-3 most important words or value from full_phrase
48
48
  5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')
49
49
 
50
50
  ### Placement Rules
@@ -67,4 +67,4 @@ ${a}`).join(`
67
67
 
68
68
  ${d}
69
69
 
70
- ${i}`;}return {enhancedSystemPrompt:s,enhancedUserPrompt:c}}var O={type:"object",properties:{attachmentId:{type:"string"},reasoning:{type:"string",description:"The logic connecting the form section requirements to the supporting source citation (think first!)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},fullPhrase:{type:"string",description:"The verbatim text of the terse phrase inside <attachment_text /> to support the citation (if there is a detected OCR correction, use the corrected text)"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},lineIds:{type:"array",items:{type:"number"},description:"Infer lineIds, as we only provide the first, last, and every 5th line. Provide inclusive lineIds for the fullPhrase."}},required:["attachmentId","reasoning","keySpan","fullPhrase","startPageKey","lineIds"]},v={type:"object",properties:{attachmentId:{type:"string"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},fullPhrase:{type:"string",description:"The exact verbatim text of the phrase or paragraph from the source document to support the citation (if there is a detected OCR correction, use the verbatim corrected text)"},timestamps:{type:"object",properties:{startTime:{type:"string"},endTime:{type:"string"}},required:["startTime","endTime"],description:"The timestamp of the audio or video frame including milliseconds formatted as: HH:MM:SS.SSS"}},required:["attachmentId","startPageKey","fullPhrase","timestamps"]};var u=4,I=3,P=5;function S(t,n){let i={};for(let e of t){for(let r=u;r<=e.length;r++){let s=e.slice(0,r),c=(s.match(/\d/g)||[]).length,o=(s.match(/[a-zA-Z]/g)||[]).length;if(s.length<u||c>0&&o<I||c===0&&o<P||t.some(m=>m!==e&&m.startsWith(s)))continue;let p=m=>m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),a=(n.match(new RegExp(p(s),"g"))||[]).length,l=(n.match(new RegExp(p(e),"g"))||[]).length;if(a===l){i[s]=e;break}}if(!Object.values(i).includes(e))throw new Error(`Cannot find a safe unique prefix for ID "${e}" that meets the minimum requirements (length: ${u})`)}return i}function E(t,n){if(!n||n.length===0)return {compressed:t,prefixMap:{}};let i=Array.from(new Set(n)),e=JSON.stringify(t),r=S(i,e),s=Object.keys(r).sort((o,p)=>p.length-o.length),c=e;for(let o of s){let a=r[o].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");c=c.replace(new RegExp(a,"g"),o);}return {compressed:JSON.parse(c),prefixMap:r}}function b(t,n){if(!n||Object.keys(n).length===0)return t;let i=Object.entries(n).sort((a,l)=>l[0].length-a[0].length),e,r=false;typeof t=="string"?e=t:(e=JSON.stringify(t),r=true);let s=e?.length;for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e=e.replace(new RegExp(m,"g"),l);}let c=["attachmentId","attachment_id","attachment_ID","attachmentID","fileId","file_id","file_ID","fileID","fileid"];for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),h=c.join("|"),f="([\"'`])",g=new RegExp(`(${h})(\\s*=\\s*)${f}${m}\\3`,"g");e=e.replace(g,`$1$2$3${l}$3`);}let o=e?.length,p=s-o;if(p>0)throw new Error(`[decompressedPromptIds] diff ${p} originalLength ${s} newLength ${o}`);return r?JSON.parse(e):e}export{_ as a,y as b,d as c,T as d,x as e,R as f,O as g,v as h,E as i,b as j};
70
+ ${i}`;}return {enhancedSystemPrompt:s,enhancedUserPrompt:c}}var v={type:"object",properties:{attachmentId:{type:"string"},reasoning:{type:"string",description:"The logic connecting the form section requirements to the supporting source citation (think first!)"},fullPhrase:{type:"string",description:"The verbatim text of the terse phrase inside <attachment_text /> to support the citation (if there is a detected OCR correction, use the corrected text)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},lineIds:{type:"array",items:{type:"number"},description:"Infer lineIds, as we only provide the first, last, and every 5th line. Provide inclusive lineIds for the fullPhrase."}},required:["attachmentId","reasoning","fullPhrase","keySpan","startPageKey","lineIds"]},O={type:"object",properties:{attachmentId:{type:"string"},startPageKey:{type:"string",description:'Only return a result like "page_number_PAGE_index_INDEX" from the provided page keys (e.g. <page_number_1_index_0>) and never from the contents inside the page.'},fullPhrase:{type:"string",description:"The exact verbatim text of the phrase or paragraph from the source document to support the citation (if there is a detected OCR correction, use the verbatim corrected text)"},keySpan:{type:"string",description:"The verbatim 1-3 words within fullPhrase that best support the citation"},timestamps:{type:"object",properties:{startTime:{type:"string"},endTime:{type:"string"}},required:["startTime","endTime"],description:"The timestamp of the audio or video frame including milliseconds formatted as: HH:MM:SS.SSS"}},required:["attachmentId","startPageKey","fullPhrase","keySpan","timestamps"]};var u=4,P=3,I=5;function S(t,n){let i={};for(let e of t){for(let r=u;r<=e.length;r++){let s=e.slice(0,r),c=(s.match(/\d/g)||[]).length,o=(s.match(/[a-zA-Z]/g)||[]).length;if(s.length<u||c>0&&o<P||c===0&&o<I||t.some(m=>m!==e&&m.startsWith(s)))continue;let p=m=>m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),a=(n.match(new RegExp(p(s),"g"))||[]).length,l=(n.match(new RegExp(p(e),"g"))||[]).length;if(a===l){i[s]=e;break}}if(!Object.values(i).includes(e))throw new Error(`Cannot find a safe unique prefix for ID "${e}" that meets the minimum requirements (length: ${u})`)}return i}function w(t,n){if(!n||n.length===0)return {compressed:t,prefixMap:{}};let i=Array.from(new Set(n)),e=JSON.stringify(t),r=S(i,e),s=Object.keys(r).sort((o,p)=>p.length-o.length),c=e;for(let o of s){let a=r[o].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");c=c.replace(new RegExp(a,"g"),o);}return {compressed:JSON.parse(c),prefixMap:r}}function A(t,n){if(!n||Object.keys(n).length===0)return t;let i=Object.entries(n).sort((a,l)=>l[0].length-a[0].length),e,r=false;typeof t=="string"?e=t:(e=JSON.stringify(t),r=true);let s=e?.length;for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");e=e.replace(new RegExp(m,"g"),l);}let c=["attachmentId","attachment_id","attachment_ID","attachmentID","fileId","file_id","file_ID","fileID","fileid"];for(let[a,l]of i){let m=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),h=c.join("|"),f="([\"'`])",g=new RegExp(`(${h})(\\s*=\\s*)${f}${m}\\3`,"g");e=e.replace(g,`$1$2$3${l}$3`);}let o=e?.length,p=s-o;if(p>0)throw new Error(`[decompressedPromptIds] diff ${p} originalLength ${s} newLength ${o}`);return r?JSON.parse(e):e}export{_ as a,y as b,d as c,T as d,x as e,R as f,v as g,O as h,w as i,A as j};
@@ -0,0 +1 @@
1
+ function E(t){return new TextEncoder().encode(t)}function Z(t){let e=1732584193,i=4023233417,r=2562383102,n=271733878,o=3285377520,p=t.length,a=p*8,c=p+1+8,u=Math.ceil(c/64)*64,s=new ArrayBuffer(u),C=new Uint8Array(s),d=new DataView(s);C.set(t),C[p]=128,d.setUint32(u-8,Math.floor(a/4294967296),false),d.setUint32(u-4,a>>>0,false);let l=new Uint32Array(80);for(let x=0;x<u;x+=64){for(let g=0;g<16;g++)l[g]=d.getUint32(x+g*4,false);for(let g=16;g<80;g++){let I=l[g-3]^l[g-8]^l[g-14]^l[g-16];l[g]=I<<1|I>>>31;}let f=e,h=i,_=r,k=n,S=o;for(let g=0;g<80;g++){let I,m;g<20?(I=h&_|~h&k,m=1518500249):g<40?(I=h^_^k,m=1859775393):g<60?(I=h&_|h&k|_&k,m=2400959708):(I=h^_^k,m=3395469782);let b=(f<<5|f>>>27)+I+S+m+l[g]>>>0;S=k,k=_,_=(h<<30|h>>>2)>>>0,h=f,f=b;}e=e+f>>>0,i=i+h>>>0,r=r+_>>>0,n=n+k>>>0,o=o+S>>>0;}let y=x=>x.toString(16).padStart(8,"0");return y(e)+y(i)+y(r)+y(n)+y(o)}function P(t){try{if(!t)return "";let e=typeof t=="string"?t:JSON.stringify(t);return Z(E(e))}catch(e){console.error("Error in making the hash:",e);}return ""}function j(...t){return t.filter(Boolean).join(" ")}function U(t){return t.type==="url"||typeof t.url=="string"&&t.url.length>0}function A(t){let e=t.pageNumber||v(t.startPageKey),i=[t.attachmentId||"",e?.toString()||"",t.fullPhrase||"",t.keySpan?.toString()||"",t.lineIds?.join(",")||"",t.timestamps?.startTime||"",t.timestamps?.endTime||""];return U(t)&&i.push(t.url||"",t.title||"",t.domain||""),P(i.join("|")).slice(0,16)}function Q(t){let e=[t.attachmentId||"",t.label||"",t.verifiedFullPhrase||"",t.verifiedKeySpan||"",t.verifiedLineIds?.join(",")||"",t.verifiedPageNumber?.toString()||"",t.verifiedTimestamps?.startTime||"",t.verifiedTimestamps?.endTime||"",t.verifiedMatchSnippet||"",t.hitIndexWithinPage?.toString()||""];return P(e.join("|")).slice(0,16)}function tt(t){let e=Math.random().toString(36).slice(2,11);return `${t}-${e}`}function et(t,e={}){let{fallbackDisplay:i}=e;return t.keySpan?.toString()||t.citationNumber?.toString()||i||"1"}function nt(t){return t.citationNumber?.toString()||"1"}function it(t){return t.keySpan?.toString()||""}function rt(...t){return t.filter(Boolean).join(" ")}var st=4,at=1;function D(t){if(!t)return;let e=[],i=t.split(",");for(let r of i){let n=r.trim();if(n)if(n.includes("-")){let[o,p]=n.split("-"),a=parseInt(o,10),c=parseInt(p,10);if(!isNaN(a)&&!isNaN(c)&&a<=c)for(let u=a;u<=c;u++)e.push(u);else isNaN(a)||e.push(a);}else {let o=parseInt(n,10);isNaN(o)||e.push(o);}}if(e.length!==0)return [...new Set(e)].sort((r,n)=>r-n)}function R(t){let e=t?.status,i=e==="not_found",r=e==="found_phrase_missed_value",n=e==="found_key_span_only",o=e==="partial_text_found"||e==="found_on_other_page"||e==="found_on_other_line"||e==="first_word_found";return {isVerified:e==="found"||n||o||r,isMiss:i,isPartialMatch:o,isPending:e==="pending"||e==="loading"||!e}}var B=(t,e,i,r)=>{let n=m=>m?m.replace(/^['"]|['"]$/g,"").replace(/\\'/g,"'"):void 0,o=i?.current?i.current++:void 0,p=t.substring(0,t.indexOf("<cite")),a=t.includes("/>")?t.slice(t.indexOf("/>")+2):"",c=t.substring(t.indexOf("<cite"),t.indexOf("/>")+2),u=(m,b)=>{for(let O of b){let L=new RegExp(`${O}='((?:[^'\\\\]|\\\\.)*)'`),K=m.match(L);if(K)return K[1]}},s=u(c,["attachment_id","attachmentId","file_id","fileId"]),C=s?.length===20?s:e||s,d=u(c,["start_page_key","startPageKey","start_page"]),l,y;if(d){let m=d.match(/page[\_a-zA-Z]*(\d+)_index_(\d+)/);m&&(l=parseInt(m[1]),y=parseInt(m[2]));}let x=n(u(c,["full_phrase","fullPhrase"])),f=n(u(c,["key_span","keySpan"])),h=n(u(c,["reasoning"])),_=n(u(c,["value"])),k;try{let b=u(c,["line_ids","lineIds"])?.replace(/[A-Za-z_[\](){}:]/g,"");k=b?D(b):void 0;}catch(m){r&&console.error("Error parsing lineIds",m);}let S=u(c,["timestamps"]),g;if(S){let[m,b]=S.split("-")||[];g={startTime:m,endTime:b};}let I={attachmentId:C,pageNumber:l,startPageKey:`page_number_${l||1}_index_${y||0}`,fullPhrase:x,keySpan:f||_,citationNumber:o,lineIds:k,beforeCite:p,timestamps:g,reasoning:h};return {beforeCite:p,afterCite:a,citation:I}},J=(t,e)=>{if(!t)return null;let i=t.fullPhrase??t.full_phrase,r=t.startPageKey??t.start_page_key,n=t.keySpan??t.key_span,o=t.lineIds??t.line_ids,p=t.attachmentId??t.attachment_id??t.fileId??t.file_id,a=t.reasoning,c=t.value;if(!i)return null;let u;if(r){let d=r.match(/page[_a-zA-Z]*(\d+)_index_(\d+)/i);if(d)u=parseInt(d[1],10);else {let l=r.match(/^(\d+)_(\d+)$/);l&&(u=parseInt(l[1],10));}}let s=o?.length?[...o].sort((d,l)=>d-l):void 0;return {attachmentId:p,pageNumber:u,fullPhrase:i,citationNumber:e,lineIds:s,keySpan:n||c,reasoning:a}},V=t=>typeof t=="object"&&t!==null&&("fullPhrase"in t||"full_phrase"in t||"startPageKey"in t||"start_page_key"in t||"keySpan"in t||"key_span"in t||"lineIds"in t||"line_ids"in t),N=t=>Array.isArray(t)?t.length>0&&t.some(V):typeof t=="object"&&t!==null?V(t):false,T=t=>{let e={},i=Array.isArray(t)?t:[t],r=1;for(let n of i){let o=J(n,r++);if(o&&o.fullPhrase){let p=A(o);e[p]=o;}}return e},w=(t,e)=>{if(!(!t||typeof t!="object")){if(t.citation&&N(t.citation)){let i=Array.isArray(t.citation)?t.citation:[t.citation];e.push(...i);}if(t.citations&&N(t.citations)){let i=Array.isArray(t.citations)?t.citations:[t.citations];e.push(...i);}if(Array.isArray(t))for(let i of t)w(i,e);else for(let i of Object.keys(t))i!=="citation"&&i!=="citations"&&w(t[i],e);}},M=t=>{let e=$(t),i=/<cite\s+[^>]*\/>/g,r=e.match(i);if(!r||r.length===0)return {};let n={},o={current:1};for(let p of r){let{citation:a}=B(p,void 0,o);if(a&&a.fullPhrase){let c=A(a);n[c]=a;}}return n},ut=t=>{if(!t)return {};let e={};if(typeof t=="object"){if(N(t)){let n=T(t);Object.assign(e,n);}else {let n=[];if(w(t,n),n.length>0){let o=T(n);Object.assign(e,o);}}let i=JSON.stringify(t),r=M(i);Object.assign(e,r);}else if(typeof t=="string"){let i=M(t);Object.assign(e,i);}return e};function pt(t){let e=new Map,i=Array.isArray(t)?t.map((r,n)=>[A(r)||String(n+1),r]):Object.entries(t);for(let[r,n]of i){let o=n.attachmentId||"";e.has(o)||e.set(o,{}),e.get(o)[r]=n;}return e}function ft(t){let e={},i=Array.isArray(t)?t.map((r,n)=>[A(r)||String(n+1),r]):Object.entries(t);for(let[r,n]of i){let o=n.attachmentId||"";e[o]||(e[o]={}),e[o][r]=n;}return e}var F=t=>{let e={},i=/([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(['"])((?:[^'"\\]|\\.)*)\2/g,r;for(;(r=i.exec(t))!==null;){let n=r[1].toLowerCase().replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase(),o=r[3],p=n==="fileid"||n==="file_id"||n==="attachmentid"?"attachment_id":n==="keyspan"?"key_span":n==="fullphrase"?"full_phrase":n==="lineids"?"line_ids":n==="startpagekey"||n==="start_pagekey"?"start_page_key":n;e[p]=o;}return e},W=t=>{if(!t)return "\u25CC";let e=R(t);return e.isPending?"\u25CC":e.isMiss?"\u2717":e.isPartialMatch?"\u26A0":e.isVerified?"\u2713":"\u25CC"},H=W,G=(t,e={})=>{let{leaveKeySpanBehind:i=false,verifications:r,showVerificationStatus:n=false}=e,o=0,p=/<cite\s+[^>]*?\/>/g;return t.replace(p,a=>{o++;let c=F(a),u="";if(i&&c.key_span&&(u=c.key_span.replace(/\\'/g,"'").replace(/\\"/g,'"')),n&&r){let s,C=String(o);if(s=r[C],!s&&c.attachment_id){for(let[,l]of Object.entries(r))if(l.attachmentId===c.attachment_id){s=l;break}}let d=H(s);u=u?`${u}${d}`:d;}return u})},mt=(t,e)=>G(t,{leaveKeySpanBehind:e}),ht=t=>t.replace(/<page_number_\d+_index_\d+>/g,"").replace(/<\/page_number_\d+_index_\d+>/g,"").trim(),yt=t=>{let e=/<line id="[^"]*">|<\/line>/g;return t.replace(e,"")},v=t=>{if(!t)return null;let e=t.match(/\d+/)?.[0];return e?parseInt(e):null},$=t=>{let e=t?.trim()||"",i=e.split(/(<cite[\s\S]*?(?:\/>|<\/cite>))/gm);return i.length<=1?z(e):(e=i.map(r=>r.startsWith("<cite")?z(r):r).join(""),e)},z=t=>{let e=t;e=e.replace(/\\_/g,"_"),e=e.replace(/><\/cite>/g,"/>");let i=p=>{let a=p.toLowerCase();return a==="fullphrase"||a==="full_phrase"?"full_phrase":a==="lineids"||a==="line_ids"?"line_ids":a==="startpagekey"||a==="start_pagekey"||a==="start_page_key"?"start_page_key":a==="fileid"||a==="file_id"||a==="attachmentid"||a==="attachment_id"?"attachment_id":a==="keyspan"||a==="key_span"?"key_span":a==="reasoning"||a==="value"?a:a==="timestamps"||a==="timestamp"||a==="timestamps"?"timestamps":a},r=p=>p.replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),n=/(fullPhrase|full_phrase|keySpan|key_span|reasoning|value)\s*=\s*(['"])([\s\S]*?)(?=\s+(?:line_ids|lineIds|timestamps|fileId|file_id|attachmentId|attachment_id|start_page_key|start_pageKey|startPageKey|keySpan|key_span|reasoning|value|full_phrase)|\s*\/?>)/gm;e=e.replace(n,(p,a,c,u)=>{let s=u;return s.endsWith(c)&&(s=s.slice(0,-1)),s=s.replace(/(\r?\n)+/g," "),s=r(s),s=s.replace(/(\*|_){2,}/g,""),s=s.replace(/\\\\'/g,"'"),s=s.replace(/\\'/g,"'"),s=s.replace(/'/g,"\\'"),s=s.replace(/\\\\"/g,'"'),s=s.replace(/\\"/g,'"'),s=s.replace(/"/g,'\\"'),s=s.replace(/\*/g,""),`${i(a)}='${s}'`}),e=e.replace(/(line_ids|lineIds|timestamps)=['"]?([\[\]\(\){}A-Za-z0-9_\-, ]+)['"]?(\s*\/?>|\s+)/gm,(p,a,c,u)=>{let s=c.replace(/[A-Za-z\[\]\(\){}]/g,"");return s=s.replace(/(\d+)-(\d+)/g,(C,d,l)=>{let y=parseInt(d,10),x=parseInt(l,10),f=[];if(y<=x)for(let h=y;h<=x;h++)f.push(h);else f.push(y);return f.join(",")}),s=s.replace(/,+/g,",").replace(/^,|,$/g,""),`${i(a)}='${s}'${u}`});let o=p=>{let a=/([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(['"])((?:[^'"\\\n]|\\.)*)(?:\2)/g,c={},u;for(;u=a.exec(p);){let f=u[1],h=u[3],_=i(f);c[_]=h;}let s=Object.keys(c);if(s.length===0)return p;let C=typeof c.timestamps=="string"&&c.timestamps.length>0,d=s.filter(f=>f.startsWith("start_page")),l=[];c.attachment_id&&l.push("attachment_id"),C?(c.full_phrase&&l.push("full_phrase"),c.key_span&&l.push("key_span"),l.push("timestamps")):(d.includes("start_page_key")&&l.push("start_page_key"),d.filter(f=>f!=="start_page_key").sort().forEach(f=>l.push(f)),c.full_phrase&&l.push("full_phrase"),c.key_span&&l.push("key_span"),c.line_ids&&l.push("line_ids")),c.reasoning&&l.push("reasoning"),c.value&&l.push("value");let y=new Set(l);return s.filter(f=>!y.has(f)).sort().forEach(f=>l.push(f)),`<cite ${l.map(f=>`${f}='${c[f]}'`).join(" ")} />`};return e=e.replace(/<cite\b[\s\S]*?\/>/gm,p=>o(p)),e};export{W as a,G as b,mt as c,ht as d,yt as e,v as f,$ as g,P as h,j as i,U as j,A as k,Q as l,tt as m,et as n,nt as o,it as p,rt as q,st as r,at as s,R as t,B as u,ut as v,pt as w,ft as x};
@@ -0,0 +1 @@
1
+ 'use strict';function E(t){return new TextEncoder().encode(t)}function Z(t){let e=1732584193,i=4023233417,r=2562383102,n=271733878,o=3285377520,p=t.length,a=p*8,c=p+1+8,u=Math.ceil(c/64)*64,s=new ArrayBuffer(u),C=new Uint8Array(s),d=new DataView(s);C.set(t),C[p]=128,d.setUint32(u-8,Math.floor(a/4294967296),false),d.setUint32(u-4,a>>>0,false);let l=new Uint32Array(80);for(let x=0;x<u;x+=64){for(let g=0;g<16;g++)l[g]=d.getUint32(x+g*4,false);for(let g=16;g<80;g++){let I=l[g-3]^l[g-8]^l[g-14]^l[g-16];l[g]=I<<1|I>>>31;}let f=e,h=i,_=r,k=n,S=o;for(let g=0;g<80;g++){let I,m;g<20?(I=h&_|~h&k,m=1518500249):g<40?(I=h^_^k,m=1859775393):g<60?(I=h&_|h&k|_&k,m=2400959708):(I=h^_^k,m=3395469782);let b=(f<<5|f>>>27)+I+S+m+l[g]>>>0;S=k,k=_,_=(h<<30|h>>>2)>>>0,h=f,f=b;}e=e+f>>>0,i=i+h>>>0,r=r+_>>>0,n=n+k>>>0,o=o+S>>>0;}let y=x=>x.toString(16).padStart(8,"0");return y(e)+y(i)+y(r)+y(n)+y(o)}function P(t){try{if(!t)return "";let e=typeof t=="string"?t:JSON.stringify(t);return Z(E(e))}catch(e){console.error("Error in making the hash:",e);}return ""}function j(...t){return t.filter(Boolean).join(" ")}function U(t){return t.type==="url"||typeof t.url=="string"&&t.url.length>0}function A(t){let e=t.pageNumber||v(t.startPageKey),i=[t.attachmentId||"",e?.toString()||"",t.fullPhrase||"",t.keySpan?.toString()||"",t.lineIds?.join(",")||"",t.timestamps?.startTime||"",t.timestamps?.endTime||""];return U(t)&&i.push(t.url||"",t.title||"",t.domain||""),P(i.join("|")).slice(0,16)}function Q(t){let e=[t.attachmentId||"",t.label||"",t.verifiedFullPhrase||"",t.verifiedKeySpan||"",t.verifiedLineIds?.join(",")||"",t.verifiedPageNumber?.toString()||"",t.verifiedTimestamps?.startTime||"",t.verifiedTimestamps?.endTime||"",t.verifiedMatchSnippet||"",t.hitIndexWithinPage?.toString()||""];return P(e.join("|")).slice(0,16)}function tt(t){let e=Math.random().toString(36).slice(2,11);return `${t}-${e}`}function et(t,e={}){let{fallbackDisplay:i}=e;return t.keySpan?.toString()||t.citationNumber?.toString()||i||"1"}function nt(t){return t.citationNumber?.toString()||"1"}function it(t){return t.keySpan?.toString()||""}function rt(...t){return t.filter(Boolean).join(" ")}var st=4,at=1;function D(t){if(!t)return;let e=[],i=t.split(",");for(let r of i){let n=r.trim();if(n)if(n.includes("-")){let[o,p]=n.split("-"),a=parseInt(o,10),c=parseInt(p,10);if(!isNaN(a)&&!isNaN(c)&&a<=c)for(let u=a;u<=c;u++)e.push(u);else isNaN(a)||e.push(a);}else {let o=parseInt(n,10);isNaN(o)||e.push(o);}}if(e.length!==0)return [...new Set(e)].sort((r,n)=>r-n)}function R(t){let e=t?.status,i=e==="not_found",r=e==="found_phrase_missed_value",n=e==="found_key_span_only",o=e==="partial_text_found"||e==="found_on_other_page"||e==="found_on_other_line"||e==="first_word_found";return {isVerified:e==="found"||n||o||r,isMiss:i,isPartialMatch:o,isPending:e==="pending"||e==="loading"||!e}}var B=(t,e,i,r)=>{let n=m=>m?m.replace(/^['"]|['"]$/g,"").replace(/\\'/g,"'"):void 0,o=i?.current?i.current++:void 0,p=t.substring(0,t.indexOf("<cite")),a=t.includes("/>")?t.slice(t.indexOf("/>")+2):"",c=t.substring(t.indexOf("<cite"),t.indexOf("/>")+2),u=(m,b)=>{for(let O of b){let L=new RegExp(`${O}='((?:[^'\\\\]|\\\\.)*)'`),K=m.match(L);if(K)return K[1]}},s=u(c,["attachment_id","attachmentId","file_id","fileId"]),C=s?.length===20?s:e||s,d=u(c,["start_page_key","startPageKey","start_page"]),l,y;if(d){let m=d.match(/page[\_a-zA-Z]*(\d+)_index_(\d+)/);m&&(l=parseInt(m[1]),y=parseInt(m[2]));}let x=n(u(c,["full_phrase","fullPhrase"])),f=n(u(c,["key_span","keySpan"])),h=n(u(c,["reasoning"])),_=n(u(c,["value"])),k;try{let b=u(c,["line_ids","lineIds"])?.replace(/[A-Za-z_[\](){}:]/g,"");k=b?D(b):void 0;}catch(m){r&&console.error("Error parsing lineIds",m);}let S=u(c,["timestamps"]),g;if(S){let[m,b]=S.split("-")||[];g={startTime:m,endTime:b};}let I={attachmentId:C,pageNumber:l,startPageKey:`page_number_${l||1}_index_${y||0}`,fullPhrase:x,keySpan:f||_,citationNumber:o,lineIds:k,beforeCite:p,timestamps:g,reasoning:h};return {beforeCite:p,afterCite:a,citation:I}},J=(t,e)=>{if(!t)return null;let i=t.fullPhrase??t.full_phrase,r=t.startPageKey??t.start_page_key,n=t.keySpan??t.key_span,o=t.lineIds??t.line_ids,p=t.attachmentId??t.attachment_id??t.fileId??t.file_id,a=t.reasoning,c=t.value;if(!i)return null;let u;if(r){let d=r.match(/page[_a-zA-Z]*(\d+)_index_(\d+)/i);if(d)u=parseInt(d[1],10);else {let l=r.match(/^(\d+)_(\d+)$/);l&&(u=parseInt(l[1],10));}}let s=o?.length?[...o].sort((d,l)=>d-l):void 0;return {attachmentId:p,pageNumber:u,fullPhrase:i,citationNumber:e,lineIds:s,keySpan:n||c,reasoning:a}},V=t=>typeof t=="object"&&t!==null&&("fullPhrase"in t||"full_phrase"in t||"startPageKey"in t||"start_page_key"in t||"keySpan"in t||"key_span"in t||"lineIds"in t||"line_ids"in t),N=t=>Array.isArray(t)?t.length>0&&t.some(V):typeof t=="object"&&t!==null?V(t):false,T=t=>{let e={},i=Array.isArray(t)?t:[t],r=1;for(let n of i){let o=J(n,r++);if(o&&o.fullPhrase){let p=A(o);e[p]=o;}}return e},w=(t,e)=>{if(!(!t||typeof t!="object")){if(t.citation&&N(t.citation)){let i=Array.isArray(t.citation)?t.citation:[t.citation];e.push(...i);}if(t.citations&&N(t.citations)){let i=Array.isArray(t.citations)?t.citations:[t.citations];e.push(...i);}if(Array.isArray(t))for(let i of t)w(i,e);else for(let i of Object.keys(t))i!=="citation"&&i!=="citations"&&w(t[i],e);}},M=t=>{let e=$(t),i=/<cite\s+[^>]*\/>/g,r=e.match(i);if(!r||r.length===0)return {};let n={},o={current:1};for(let p of r){let{citation:a}=B(p,void 0,o);if(a&&a.fullPhrase){let c=A(a);n[c]=a;}}return n},ut=t=>{if(!t)return {};let e={};if(typeof t=="object"){if(N(t)){let n=T(t);Object.assign(e,n);}else {let n=[];if(w(t,n),n.length>0){let o=T(n);Object.assign(e,o);}}let i=JSON.stringify(t),r=M(i);Object.assign(e,r);}else if(typeof t=="string"){let i=M(t);Object.assign(e,i);}return e};function pt(t){let e=new Map,i=Array.isArray(t)?t.map((r,n)=>[A(r)||String(n+1),r]):Object.entries(t);for(let[r,n]of i){let o=n.attachmentId||"";e.has(o)||e.set(o,{}),e.get(o)[r]=n;}return e}function ft(t){let e={},i=Array.isArray(t)?t.map((r,n)=>[A(r)||String(n+1),r]):Object.entries(t);for(let[r,n]of i){let o=n.attachmentId||"";e[o]||(e[o]={}),e[o][r]=n;}return e}var F=t=>{let e={},i=/([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(['"])((?:[^'"\\]|\\.)*)\2/g,r;for(;(r=i.exec(t))!==null;){let n=r[1].toLowerCase().replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase(),o=r[3],p=n==="fileid"||n==="file_id"||n==="attachmentid"?"attachment_id":n==="keyspan"?"key_span":n==="fullphrase"?"full_phrase":n==="lineids"?"line_ids":n==="startpagekey"||n==="start_pagekey"?"start_page_key":n;e[p]=o;}return e},W=t=>{if(!t)return "\u25CC";let e=R(t);return e.isPending?"\u25CC":e.isMiss?"\u2717":e.isPartialMatch?"\u26A0":e.isVerified?"\u2713":"\u25CC"},H=W,G=(t,e={})=>{let{leaveKeySpanBehind:i=false,verifications:r,showVerificationStatus:n=false}=e,o=0,p=/<cite\s+[^>]*?\/>/g;return t.replace(p,a=>{o++;let c=F(a),u="";if(i&&c.key_span&&(u=c.key_span.replace(/\\'/g,"'").replace(/\\"/g,'"')),n&&r){let s,C=String(o);if(s=r[C],!s&&c.attachment_id){for(let[,l]of Object.entries(r))if(l.attachmentId===c.attachment_id){s=l;break}}let d=H(s);u=u?`${u}${d}`:d;}return u})},mt=(t,e)=>G(t,{leaveKeySpanBehind:e}),ht=t=>t.replace(/<page_number_\d+_index_\d+>/g,"").replace(/<\/page_number_\d+_index_\d+>/g,"").trim(),yt=t=>{let e=/<line id="[^"]*">|<\/line>/g;return t.replace(e,"")},v=t=>{if(!t)return null;let e=t.match(/\d+/)?.[0];return e?parseInt(e):null},$=t=>{let e=t?.trim()||"",i=e.split(/(<cite[\s\S]*?(?:\/>|<\/cite>))/gm);return i.length<=1?z(e):(e=i.map(r=>r.startsWith("<cite")?z(r):r).join(""),e)},z=t=>{let e=t;e=e.replace(/\\_/g,"_"),e=e.replace(/><\/cite>/g,"/>");let i=p=>{let a=p.toLowerCase();return a==="fullphrase"||a==="full_phrase"?"full_phrase":a==="lineids"||a==="line_ids"?"line_ids":a==="startpagekey"||a==="start_pagekey"||a==="start_page_key"?"start_page_key":a==="fileid"||a==="file_id"||a==="attachmentid"||a==="attachment_id"?"attachment_id":a==="keyspan"||a==="key_span"?"key_span":a==="reasoning"||a==="value"?a:a==="timestamps"||a==="timestamp"||a==="timestamps"?"timestamps":a},r=p=>p.replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),n=/(fullPhrase|full_phrase|keySpan|key_span|reasoning|value)\s*=\s*(['"])([\s\S]*?)(?=\s+(?:line_ids|lineIds|timestamps|fileId|file_id|attachmentId|attachment_id|start_page_key|start_pageKey|startPageKey|keySpan|key_span|reasoning|value|full_phrase)|\s*\/?>)/gm;e=e.replace(n,(p,a,c,u)=>{let s=u;return s.endsWith(c)&&(s=s.slice(0,-1)),s=s.replace(/(\r?\n)+/g," "),s=r(s),s=s.replace(/(\*|_){2,}/g,""),s=s.replace(/\\\\'/g,"'"),s=s.replace(/\\'/g,"'"),s=s.replace(/'/g,"\\'"),s=s.replace(/\\\\"/g,'"'),s=s.replace(/\\"/g,'"'),s=s.replace(/"/g,'\\"'),s=s.replace(/\*/g,""),`${i(a)}='${s}'`}),e=e.replace(/(line_ids|lineIds|timestamps)=['"]?([\[\]\(\){}A-Za-z0-9_\-, ]+)['"]?(\s*\/?>|\s+)/gm,(p,a,c,u)=>{let s=c.replace(/[A-Za-z\[\]\(\){}]/g,"");return s=s.replace(/(\d+)-(\d+)/g,(C,d,l)=>{let y=parseInt(d,10),x=parseInt(l,10),f=[];if(y<=x)for(let h=y;h<=x;h++)f.push(h);else f.push(y);return f.join(",")}),s=s.replace(/,+/g,",").replace(/^,|,$/g,""),`${i(a)}='${s}'${u}`});let o=p=>{let a=/([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(['"])((?:[^'"\\\n]|\\.)*)(?:\2)/g,c={},u;for(;u=a.exec(p);){let f=u[1],h=u[3],_=i(f);c[_]=h;}let s=Object.keys(c);if(s.length===0)return p;let C=typeof c.timestamps=="string"&&c.timestamps.length>0,d=s.filter(f=>f.startsWith("start_page")),l=[];c.attachment_id&&l.push("attachment_id"),C?(c.full_phrase&&l.push("full_phrase"),c.key_span&&l.push("key_span"),l.push("timestamps")):(d.includes("start_page_key")&&l.push("start_page_key"),d.filter(f=>f!=="start_page_key").sort().forEach(f=>l.push(f)),c.full_phrase&&l.push("full_phrase"),c.key_span&&l.push("key_span"),c.line_ids&&l.push("line_ids")),c.reasoning&&l.push("reasoning"),c.value&&l.push("value");let y=new Set(l);return s.filter(f=>!y.has(f)).sort().forEach(f=>l.push(f)),`<cite ${l.map(f=>`${f}='${c[f]}'`).join(" ")} />`};return e=e.replace(/<cite\b[\s\S]*?\/>/gm,p=>o(p)),e};exports.a=W;exports.b=G;exports.c=mt;exports.d=ht;exports.e=yt;exports.f=v;exports.g=$;exports.h=P;exports.i=j;exports.j=U;exports.k=A;exports.l=Q;exports.m=tt;exports.n=et;exports.o=nt;exports.p=it;exports.q=rt;exports.r=st;exports.s=at;exports.t=R;exports.u=B;exports.v=ut;exports.w=pt;exports.x=ft;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs'),chunkF2MMVEVC_cjs=require('./chunk-F2MMVEVC.cjs');var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){chunkF2MMVEVC_cjs.a(this,"apiKey");chunkF2MMVEVC_cjs.a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=chunk6VPT3IIK_cjs.j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=chunk6VPT3IIK_cjs.j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=chunk6VPT3IIK_cjs.u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
1
+ 'use strict';var chunkQDDCYCBV_cjs=require('./chunk-QDDCYCBV.cjs'),chunkF2MMVEVC_cjs=require('./chunk-F2MMVEVC.cjs');var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){chunkF2MMVEVC_cjs.a(this,"apiKey");chunkF2MMVEVC_cjs.a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=chunkQDDCYCBV_cjs.k(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=chunkQDDCYCBV_cjs.k(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=chunkQDDCYCBV_cjs.v(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
2
  exports.a=h;
@@ -1,2 +1,2 @@
1
- import {j,u}from'./chunk-UC6YB63U.js';import {a}from'./chunk-O2XFH626.js';var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){a(this,"apiKey");a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=j(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=j(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=u(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
1
+ import {k,v}from'./chunk-OT5T6R53.js';import {a}from'./chunk-O2XFH626.js';var C="https://api.deepcitation.com";function F(p,t){if(typeof Buffer<"u"&&Buffer.isBuffer(p)){let e=Uint8Array.from(p);return {blob:new Blob([e]),name:t||"document"}}if(p instanceof Blob)return {blob:p,name:t||(p instanceof File?p.name:"document")};throw new Error("Invalid file type. Expected File, Blob, or Buffer.")}async function c(p,t){return (await p.json().catch(()=>({})))?.error?.message||`${t} failed with status ${p.status}`}var h=class{constructor(t){a(this,"apiKey");a(this,"apiUrl");if(!t.apiKey)throw new Error("DeepCitation API key is required. Get one at https://deepcitation.com/dashboard");this.apiKey=t.apiKey,this.apiUrl=t.apiUrl?.replace(/\/$/,"")||C;}async uploadFile(t,e){let{blob:l,name:a}=F(t,e?.filename),o=new FormData;o.append("file",l,a),e?.attachmentId&&o.append("attachmentId",e.attachmentId),e?.filename&&o.append("filename",e.filename);let i=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});if(!i.ok)throw new Error(await c(i,"Upload"));return await i.json()}async convertToPdf(t){let e=typeof t=="string"?{url:t}:t,{url:l,file:a,filename:o,attachmentId:i}=e;if(!l&&!a)throw new Error("Either url or file must be provided");let r;if(l)r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({url:l,filename:o,attachmentId:i})});else {let{blob:f,name:n}=F(a,o),s=new FormData;s.append("file",f,n),i&&s.append("attachmentId",i),o&&s.append("filename",o),r=await fetch(`${this.apiUrl}/convertFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s});}if(!r.ok)throw new Error(await c(r,"Conversion"));return await r.json()}async prepareConvertedFile(t){let e=await fetch(`${this.apiUrl}/prepareFile`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({attachmentId:t.attachmentId})});if(!e.ok)throw new Error(await c(e,"Prepare"));return await e.json()}async prepareFiles(t){if(t.length===0)return {fileDataParts:[],deepTextPromptPortion:[]};let e=t.map(({file:i,filename:r,attachmentId:f})=>this.uploadFile(i,{filename:r,attachmentId:f}).then(n=>({result:n,filename:r}))),a=(await Promise.all(e)).map(({result:i,filename:r})=>({attachmentId:i.attachmentId,deepTextPromptPortion:i.deepTextPromptPortion,filename:r||i.metadata?.filename})),o=a.map(i=>i.deepTextPromptPortion);return {fileDataParts:a,deepTextPromptPortion:o}}async verifyAttachment(t,e,l){let a={};if(Array.isArray(e))for(let n of e){let s=k(n);a[s]=n;}else if(typeof e=="object"&&e!==null)if("fullPhrase"in e||"value"in e){let n=k(e);a[n]=e;}else Object.assign(a,e);else throw new Error("Invalid citations format");if(Object.keys(a).length===0)return {verifications:{}};let o=`${this.apiUrl}/verifyCitations`,i={data:{attachmentId:t,citations:a,outputImageFormat:l?.outputImageFormat||"avif"}},r=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(await c(r,"Verification"));return await r.json()}async verify(t,e){let{llmOutput:l,outputImageFormat:a="avif"}=t;if(e||(e=v(l)),Object.keys(e).length===0)return {verifications:{}};let o=new Map;for(let[n,s]of Object.entries(e)){let m=s.attachmentId||"";o.has(m)||o.set(m,{}),o.get(m)[n]=s;}let i=[];for(let[n,s]of o)n&&i.push(this.verifyAttachment(n,s,{outputImageFormat:a}));let r=await Promise.all(i),f={};for(let n of r)Object.assign(f,n.verifications);return {verifications:f}}};
2
2
  export{h as a};
@@ -1 +1 @@
1
- 'use strict';var chunkTBG42N5V_cjs=require('../chunk-TBG42N5V.cjs');require('../chunk-6VPT3IIK.cjs'),require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkTBG42N5V_cjs.a}});
1
+ 'use strict';var chunkW5BUHPRT_cjs=require('../chunk-W5BUHPRT.cjs');require('../chunk-QDDCYCBV.cjs'),require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkW5BUHPRT_cjs.a}});
@@ -1 +1 @@
1
- export{a as DeepCitation}from'../chunk-L3IBEKR4.js';import'../chunk-UC6YB63U.js';import'../chunk-O2XFH626.js';
1
+ export{a as DeepCitation}from'../chunk-WIWLCVJK.js';import'../chunk-OT5T6R53.js';import'../chunk-O2XFH626.js';
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkTBG42N5V_cjs=require('./chunk-TBG42N5V.cjs'),chunkHAYHSRVD_cjs=require('./chunk-HAYHSRVD.cjs'),chunkCFXDRAJL_cjs=require('./chunk-CFXDRAJL.cjs'),chunk6VPT3IIK_cjs=require('./chunk-6VPT3IIK.cjs');require('./chunk-F2MMVEVC.cjs');var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let m=n[n.length-1],l=n[n.length-2],o=t.substring(l+1,m+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=m+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,f=i,s=i;else break}return I>=e?t.substring(0,f)+o:t}Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkTBG42N5V_cjs.a}});Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.e}});Object.defineProperty(exports,"BLANK_VERIFICATION",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.d}});Object.defineProperty(exports,"DEFAULT_OUTPUT_IMAGE_FORMAT",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.a}});Object.defineProperty(exports,"NOT_FOUND_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.b}});Object.defineProperty(exports,"PENDING_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.c}});Object.defineProperty(exports,"CITATION_X_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.q}});Object.defineProperty(exports,"CITATION_Y_PADDING",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.r}});Object.defineProperty(exports,"generateCitationInstanceId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.l}});Object.defineProperty(exports,"generateCitationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.j}});Object.defineProperty(exports,"generateVerificationKey",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.k}});Object.defineProperty(exports,"getAllCitationsFromLlmOutput",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.u}});Object.defineProperty(exports,"getCitationPageNumber",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.e}});Object.defineProperty(exports,"getCitationStatus",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.s}});Object.defineProperty(exports,"groupCitationsByAttachmentId",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.v}});Object.defineProperty(exports,"groupCitationsByAttachmentIdObject",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.w}});Object.defineProperty(exports,"normalizeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.f}});Object.defineProperty(exports,"parseCitation",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.t}});Object.defineProperty(exports,"removeCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.b}});Object.defineProperty(exports,"removeLineIdMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.d}});Object.defineProperty(exports,"removePageNumberMetadata",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.c}});Object.defineProperty(exports,"replaceCitations",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.a}});Object.defineProperty(exports,"sha1Hash",{enumerable:true,get:function(){return chunk6VPT3IIK_cjs.g}});exports.cleanRepeatingLastSentence=z;exports.isGeminiGarbage=Y;
1
+ 'use strict';var chunkW5BUHPRT_cjs=require('./chunk-W5BUHPRT.cjs'),chunk4G7LE6P4_cjs=require('./chunk-4G7LE6P4.cjs'),chunkCFXDRAJL_cjs=require('./chunk-CFXDRAJL.cjs'),chunkQDDCYCBV_cjs=require('./chunk-QDDCYCBV.cjs');require('./chunk-F2MMVEVC.cjs');var z=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function J(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let I=n[n.length-1],T=n[n.length-2],o=t.substring(T+1,I+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let m=0,s=I+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)m++,f=i,s=i;else break}return m>=e?t.substring(0,f)+o:t}Object.defineProperty(exports,"DeepCitation",{enumerable:true,get:function(){return chunkW5BUHPRT_cjs.a}});Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.e}});Object.defineProperty(exports,"BLANK_VERIFICATION",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.d}});Object.defineProperty(exports,"DEFAULT_OUTPUT_IMAGE_FORMAT",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.a}});Object.defineProperty(exports,"NOT_FOUND_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.b}});Object.defineProperty(exports,"PENDING_VERIFICATION_INDEX",{enumerable:true,get:function(){return chunkCFXDRAJL_cjs.c}});Object.defineProperty(exports,"CITATION_X_PADDING",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.r}});Object.defineProperty(exports,"CITATION_Y_PADDING",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.s}});Object.defineProperty(exports,"generateCitationInstanceId",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.m}});Object.defineProperty(exports,"generateCitationKey",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.k}});Object.defineProperty(exports,"generateVerificationKey",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.l}});Object.defineProperty(exports,"getAllCitationsFromLlmOutput",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.v}});Object.defineProperty(exports,"getCitationPageNumber",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.f}});Object.defineProperty(exports,"getCitationStatus",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.t}});Object.defineProperty(exports,"getVerificationTextIndicator",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.a}});Object.defineProperty(exports,"groupCitationsByAttachmentId",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.w}});Object.defineProperty(exports,"groupCitationsByAttachmentIdObject",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.x}});Object.defineProperty(exports,"normalizeCitations",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.g}});Object.defineProperty(exports,"parseCitation",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.u}});Object.defineProperty(exports,"removeCitations",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.c}});Object.defineProperty(exports,"removeLineIdMetadata",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.e}});Object.defineProperty(exports,"removePageNumberMetadata",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.d}});Object.defineProperty(exports,"replaceCitations",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.b}});Object.defineProperty(exports,"sha1Hash",{enumerable:true,get:function(){return chunkQDDCYCBV_cjs.h}});exports.cleanRepeatingLastSentence=J;exports.isGeminiGarbage=z;
package/lib/index.d.cts CHANGED
@@ -100,6 +100,14 @@ interface ReplaceCitationsOptions {
100
100
  */
101
101
  showVerificationStatus?: boolean;
102
102
  }
103
+ /**
104
+ * Get verification status indicator character for plain text/terminal output.
105
+ * Returns: ✓ (verified), ⚠ (partial), ✗ (not found), ◌ (pending)
106
+ *
107
+ * For web UI, use the React CitationComponent instead which provides
108
+ * proper styled indicators with colors and accessibility.
109
+ */
110
+ declare const getVerificationTextIndicator: (verification: Verification | null | undefined) => string;
103
111
  /**
104
112
  * Replaces citation tags in markdown text with optional replacement content.
105
113
  *
@@ -148,4 +156,4 @@ declare function cleanRepeatingLastSentence(text: string): string;
148
156
  */
149
157
  declare function sha1Hash(data: string | any): string;
150
158
 
151
- export { Citation, CitationStatus, type ReplaceCitationsOptions, Verification, cleanRepeatingLastSentence, getAllCitationsFromLlmOutput, getCitationPageNumber, getCitationStatus, groupCitationsByAttachmentId, groupCitationsByAttachmentIdObject, isGeminiGarbage, normalizeCitations, parseCitation, removeCitations, removeLineIdMetadata, removePageNumberMetadata, replaceCitations, sha1Hash };
159
+ export { Citation, CitationStatus, type ReplaceCitationsOptions, Verification, cleanRepeatingLastSentence, getAllCitationsFromLlmOutput, getCitationPageNumber, getCitationStatus, getVerificationTextIndicator, groupCitationsByAttachmentId, groupCitationsByAttachmentIdObject, isGeminiGarbage, normalizeCitations, parseCitation, removeCitations, removeLineIdMetadata, removePageNumberMetadata, replaceCitations, sha1Hash };
package/lib/index.d.ts CHANGED
@@ -100,6 +100,14 @@ interface ReplaceCitationsOptions {
100
100
  */
101
101
  showVerificationStatus?: boolean;
102
102
  }
103
+ /**
104
+ * Get verification status indicator character for plain text/terminal output.
105
+ * Returns: ✓ (verified), ⚠ (partial), ✗ (not found), ◌ (pending)
106
+ *
107
+ * For web UI, use the React CitationComponent instead which provides
108
+ * proper styled indicators with colors and accessibility.
109
+ */
110
+ declare const getVerificationTextIndicator: (verification: Verification | null | undefined) => string;
103
111
  /**
104
112
  * Replaces citation tags in markdown text with optional replacement content.
105
113
  *
@@ -148,4 +156,4 @@ declare function cleanRepeatingLastSentence(text: string): string;
148
156
  */
149
157
  declare function sha1Hash(data: string | any): string;
150
158
 
151
- export { Citation, CitationStatus, type ReplaceCitationsOptions, Verification, cleanRepeatingLastSentence, getAllCitationsFromLlmOutput, getCitationPageNumber, getCitationStatus, groupCitationsByAttachmentId, groupCitationsByAttachmentIdObject, isGeminiGarbage, normalizeCitations, parseCitation, removeCitations, removeLineIdMetadata, removePageNumberMetadata, replaceCitations, sha1Hash };
159
+ export { Citation, CitationStatus, type ReplaceCitationsOptions, Verification, cleanRepeatingLastSentence, getAllCitationsFromLlmOutput, getCitationPageNumber, getCitationStatus, getVerificationTextIndicator, groupCitationsByAttachmentId, groupCitationsByAttachmentIdObject, isGeminiGarbage, normalizeCitations, parseCitation, removeCitations, removeLineIdMetadata, removePageNumberMetadata, replaceCitations, sha1Hash };
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{a as DeepCitation}from'./chunk-L3IBEKR4.js';export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'./chunk-YZ6QJQP5.js';export{d as BLANK_VERIFICATION,a as DEFAULT_OUTPUT_IMAGE_FORMAT,b as NOT_FOUND_VERIFICATION_INDEX,c as PENDING_VERIFICATION_INDEX}from'./chunk-RQPZSRID.js';export{q as CITATION_X_PADDING,r as CITATION_Y_PADDING,l as generateCitationInstanceId,j as generateCitationKey,k as generateVerificationKey,u as getAllCitationsFromLlmOutput,e as getCitationPageNumber,s as getCitationStatus,v as groupCitationsByAttachmentId,w as groupCitationsByAttachmentIdObject,f as normalizeCitations,t as parseCitation,b as removeCitations,d as removeLineIdMetadata,c as removePageNumberMetadata,a as replaceCitations,g as sha1Hash}from'./chunk-UC6YB63U.js';import'./chunk-O2XFH626.js';var Y=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function z(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let m=n[n.length-1],l=n[n.length-2],o=t.substring(l+1,m+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let I=0,s=m+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)I++,f=i,s=i;else break}return I>=e?t.substring(0,f)+o:t}export{z as cleanRepeatingLastSentence,Y as isGeminiGarbage};
1
+ export{a as DeepCitation}from'./chunk-WIWLCVJK.js';export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'./chunk-KSQJNKLA.js';export{d as BLANK_VERIFICATION,a as DEFAULT_OUTPUT_IMAGE_FORMAT,b as NOT_FOUND_VERIFICATION_INDEX,c as PENDING_VERIFICATION_INDEX}from'./chunk-RQPZSRID.js';export{r as CITATION_X_PADDING,s as CITATION_Y_PADDING,m as generateCitationInstanceId,k as generateCitationKey,l as generateVerificationKey,v as getAllCitationsFromLlmOutput,f as getCitationPageNumber,t as getCitationStatus,a as getVerificationTextIndicator,w as groupCitationsByAttachmentId,x as groupCitationsByAttachmentIdObject,g as normalizeCitations,u as parseCitation,c as removeCitations,e as removeLineIdMetadata,d as removePageNumberMetadata,b as replaceCitations,h as sha1Hash}from'./chunk-OT5T6R53.js';import'./chunk-O2XFH626.js';var z=t=>{if(!t)return false;let e=t.trim();if(e.length<64)return false;let a=e?.[0];for(let r=1;r<e.length;r++)if(e[r]!==a)return false;return true};function J(t){t=t.trim();let e=2,a=10,r=/[.?!](?=\s+|$)/g,c,n=[];for(;(c=r.exec(t))!==null;)n.push(c.index);if(n.length<2)return t;let I=n[n.length-1],T=n[n.length-2],o=t.substring(T+1,I+1),p=o.length;if(o.trim().slice(0,-1).length<a||p<=0||t.length<p*e)return t;let m=0,s=I+1;t.endsWith(o)&&(s=t.length);let f=-1;for(;;){let i=s-p;if(i<0)break;if(t.substring(i,s)===o)m++,f=i,s=i;else break}return m>=e?t.substring(0,f)+o:t}export{J as cleanRepeatingLastSentence,z as isGeminiGarbage};
@@ -1 +1 @@
1
- 'use strict';var chunkHAYHSRVD_cjs=require('../chunk-HAYHSRVD.cjs');require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunkHAYHSRVD_cjs.e}});
1
+ 'use strict';var chunk4G7LE6P4_cjs=require('../chunk-4G7LE6P4.cjs');require('../chunk-F2MMVEVC.cjs');Object.defineProperty(exports,"AV_CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.b}});Object.defineProperty(exports,"CITATION_AV_BASED_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.h}});Object.defineProperty(exports,"CITATION_AV_REMINDER",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.d}});Object.defineProperty(exports,"CITATION_JSON_OUTPUT_FORMAT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.g}});Object.defineProperty(exports,"CITATION_MARKDOWN_SYNTAX_PROMPT",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.a}});Object.defineProperty(exports,"CITATION_REMINDER",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.c}});Object.defineProperty(exports,"compressPromptIds",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.i}});Object.defineProperty(exports,"decompressPromptIds",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.j}});Object.defineProperty(exports,"wrapCitationPrompt",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.f}});Object.defineProperty(exports,"wrapSystemCitationPrompt",{enumerable:true,get:function(){return chunk4G7LE6P4_cjs.e}});
@@ -1,5 +1,5 @@
1
- declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim quote' start_page_key='page_number_N_index_I' line_ids='X-Y' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source document\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **key_span**: The 1-3 most important words or value from full_phrase\n4. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).\n5. **start_page_key**: ONLY use format `page_number_N_index_I` from page tags (e.g., `<page_number_1_index_0>`). Never extract page numbers from document content.\n6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n### Example Citation 1\n\nThe company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' key_span='increased 45%' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n### Example Citation 2\n\nThe total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' key_span='$500 USD' full_phrase='The total amount is $500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n</citation-instructions>\n";
2
- declare const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Audio/Video Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim transcript quote' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **key_span**: The 1-3 most important words or value from full_phrase\n4. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).\n5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n</citation-instructions>\n";
1
+ declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim quote' key_span='1-3 key words' start_page_key='page_number_N_index_I' line_ids='X-Y' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source document\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **start_page_key**: ONLY use format `page_number_N_index_I` from page tags (e.g., `<page_number_1_index_0>`). Never extract page numbers from document content.\n6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n### Example Citation 1\n\nThe company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' key_span='increased 45%' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n### Example Citation 2\n\nThe total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' full_phrase='The total amount is $500 USD' key_span='$500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n</citation-instructions>\n";
2
+ declare const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Audio/Video Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim transcript quote' key_span='1-3 key words' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n</citation-instructions>\n";
3
3
  /**
4
4
  * A brief reminder to reinforce citation requirements in user messages.
5
5
  * Use this when you want to add emphasis without repeating full instructions.
@@ -48,10 +48,12 @@ interface WrapCitationPromptResult {
48
48
  *
49
49
  * ### 2. Chain-of-Thought (CoT) Attribute Ordering
50
50
  * The citation attributes are ordered to encourage the model to "think first":
51
- * `attachment_id` → `reasoning` → `key_span` → `full_phrase` → `start_page_key` → `line_ids`
51
+ * `attachment_id` → `reasoning` → `full_phrase` → `key_span` → `start_page_key` → `line_ids`
52
52
  *
53
53
  * By placing `reasoning` early, the model must articulate WHY it's citing before
54
- * specifying WHAT it's citing, leading to more accurate and relevant citations.
54
+ * specifying WHAT it's citing. Then `full_phrase` comes before `key_span` so the model
55
+ * first produces the complete verbatim quote, then extracts the key span from it,
56
+ * ensuring `key_span` is always a valid substring of `full_phrase`.
55
57
  *
56
58
  * ### Why Not Just Append?
57
59
  * In large system prompts, appended instructions can get "lost" in the middle of the
@@ -115,11 +117,11 @@ declare const CITATION_JSON_OUTPUT_FORMAT: {
115
117
  type: string;
116
118
  description: string;
117
119
  };
118
- keySpan: {
120
+ fullPhrase: {
119
121
  type: string;
120
122
  description: string;
121
123
  };
122
- fullPhrase: {
124
+ keySpan: {
123
125
  type: string;
124
126
  description: string;
125
127
  };
@@ -151,6 +153,10 @@ declare const CITATION_AV_BASED_JSON_OUTPUT_FORMAT: {
151
153
  type: string;
152
154
  description: string;
153
155
  };
156
+ keySpan: {
157
+ type: string;
158
+ description: string;
159
+ };
154
160
  timestamps: {
155
161
  type: string;
156
162
  properties: {
@@ -1,5 +1,5 @@
1
- declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim quote' start_page_key='page_number_N_index_I' line_ids='X-Y' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source document\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **key_span**: The 1-3 most important words or value from full_phrase\n4. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).\n5. **start_page_key**: ONLY use format `page_number_N_index_I` from page tags (e.g., `<page_number_1_index_0>`). Never extract page numbers from document content.\n6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n### Example Citation 1\n\nThe company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' key_span='increased 45%' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n### Example Citation 2\n\nThe total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' key_span='$500 USD' full_phrase='The total amount is $500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n</citation-instructions>\n";
2
- declare const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Audio/Video Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' key_span='1-3 key words' full_phrase='verbatim transcript quote' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **key_span**: The 1-3 most important words or value from full_phrase\n4. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).\n5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n</citation-instructions>\n";
1
+ declare const CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim quote' key_span='1-3 key words' start_page_key='page_number_N_index_I' line_ids='X-Y' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source document\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy text VERBATIM from source. Escape quotes (\\') and newlines (\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **start_page_key**: ONLY use format `page_number_N_index_I` from page tags (e.g., `<page_number_1_index_0>`). Never extract page numbers from document content.\n6. **line_ids**: Inclusive range (e.g., '2-6' or '4'). Infer intermediate lines since only every 5th line is shown.\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n### Example Citation 1\n\nThe company reported strong growth<cite attachment_id='abc123' reasoning='directly states revenue growth percentage' full_phrase='Revenue increased 45% year-over-year to $2.3 billion' key_span='increased 45%' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n### Example Citation 2\n\nThe total amount is $500 USD <cite attachment_id='abc123' reasoning='directly states the total amount' full_phrase='The total amount is $500 USD' key_span='$500 USD' start_page_key='page_number_2_index_1' line_ids='12-14' />\n\n</citation-instructions>\n";
2
+ declare const AV_CITATION_MARKDOWN_SYNTAX_PROMPT = "\n<citation-instructions priority=\"critical\">\n## REQUIRED: Audio/Video Citation Format\n\nFor every claim, value, or fact; you MUST cite sources using this exact syntax:\n\n<cite attachment_id='ID' reasoning='why this supports the claim' full_phrase='verbatim transcript quote' key_span='1-3 key words' timestamps='HH:MM:SS.SSS-HH:MM:SS.SSS' />\n\n### Syntax Rules (MUST follow)\n\n1. **attachment_id**: Use the exact ID from the source\n2. **reasoning**: Brief explanation of why this citation supports your claim (think first!)\n3. **full_phrase**: Copy transcript text VERBATIM. Escape quotes (\\') and newlines (\\n).\n4. **key_span**: The 1-3 most important words or value from full_phrase\n5. **timestamps**: Start and end time with milliseconds (e.g., '00:01:23.456-00:01:45.789')\n\n### Placement Rules\n\n- Place <cite /> inline, typically at the end of a claim\n- One citation per distinct idea, concept, or value (a sentence citing 3 different values needs 3 citations)\n- Do NOT group citations at the end of the document\n- The <cite /> tag is self-closing - never use <cite>...</cite>\n\n</citation-instructions>\n";
3
3
  /**
4
4
  * A brief reminder to reinforce citation requirements in user messages.
5
5
  * Use this when you want to add emphasis without repeating full instructions.
@@ -48,10 +48,12 @@ interface WrapCitationPromptResult {
48
48
  *
49
49
  * ### 2. Chain-of-Thought (CoT) Attribute Ordering
50
50
  * The citation attributes are ordered to encourage the model to "think first":
51
- * `attachment_id` → `reasoning` → `key_span` → `full_phrase` → `start_page_key` → `line_ids`
51
+ * `attachment_id` → `reasoning` → `full_phrase` → `key_span` → `start_page_key` → `line_ids`
52
52
  *
53
53
  * By placing `reasoning` early, the model must articulate WHY it's citing before
54
- * specifying WHAT it's citing, leading to more accurate and relevant citations.
54
+ * specifying WHAT it's citing. Then `full_phrase` comes before `key_span` so the model
55
+ * first produces the complete verbatim quote, then extracts the key span from it,
56
+ * ensuring `key_span` is always a valid substring of `full_phrase`.
55
57
  *
56
58
  * ### Why Not Just Append?
57
59
  * In large system prompts, appended instructions can get "lost" in the middle of the
@@ -115,11 +117,11 @@ declare const CITATION_JSON_OUTPUT_FORMAT: {
115
117
  type: string;
116
118
  description: string;
117
119
  };
118
- keySpan: {
120
+ fullPhrase: {
119
121
  type: string;
120
122
  description: string;
121
123
  };
122
- fullPhrase: {
124
+ keySpan: {
123
125
  type: string;
124
126
  description: string;
125
127
  };
@@ -151,6 +153,10 @@ declare const CITATION_AV_BASED_JSON_OUTPUT_FORMAT: {
151
153
  type: string;
152
154
  description: string;
153
155
  };
156
+ keySpan: {
157
+ type: string;
158
+ description: string;
159
+ };
154
160
  timestamps: {
155
161
  type: string;
156
162
  properties: {
@@ -1 +1 @@
1
- export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'../chunk-YZ6QJQP5.js';import'../chunk-O2XFH626.js';
1
+ export{b as AV_CITATION_MARKDOWN_SYNTAX_PROMPT,h as CITATION_AV_BASED_JSON_OUTPUT_FORMAT,d as CITATION_AV_REMINDER,g as CITATION_JSON_OUTPUT_FORMAT,a as CITATION_MARKDOWN_SYNTAX_PROMPT,c as CITATION_REMINDER,i as compressPromptIds,j as decompressPromptIds,f as wrapCitationPrompt,e as wrapSystemCitationPrompt}from'../chunk-KSQJNKLA.js';import'../chunk-O2XFH626.js';