@aiquants/enrichment-core 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -43,7 +43,9 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
43
43
|
- 種類を名指しするのは抽出が読める書式だけである。Outlook の `.msg` (`application/vnd.ms-outlook`) は RFC 822 ではなく抽出が名指しで拒むため規則を持たず、`other` の流れを取る (最初に本文を読む段がその拒否を記録する)。`email` は `message/rfc822` だけ。
|
|
44
44
|
- ベクタの図形は `image/` の型でも `image` の流れを取らない (その流れの唯一の本文は版面の OCR であり、画素の無い図形からは作れない)。`image/svg+xml` は抽出が XML の文字として読むため `text`、`image/emf`・`image/x-emf`・`image/wmf`・`image/x-wmf` は読み手が無く抽出が名指しで拒むため `other` の流れを取る。どちらの規則も `image/*` より前に置く (後ろに置けば `image/*` が先に一致する)。
|
|
45
45
|
- Markdown (`text/markdown`・`text/x-markdown`) は `text/*` より前の規則で `markdown` の流れを取る。その流れは文字層と、文書が参照する画像を子アセットとして読み (`extract_assets` → `ocr_children` → `resolve_body`)、版面の OCR (`ocr_document`) を持たない。他のテキスト (`text`) の流れは子アセットを読まない。
|
|
46
|
-
- 展開が読む書式の書庫 (ZIP の `application/zip`・`application/x-zip-compressed`・`application/x-zip`、tar の `application/x-tar`・`application/x-gtar`、gzip の `application/gzip`・`application/x-gzip`、bzip2 の `application/x-bzip2
|
|
46
|
+
- 展開が読む書式の書庫 (ZIP の `application/zip`・`application/x-zip-compressed`・`application/x-zip`、tar の `application/x-tar`・`application/x-gtar`、gzip の `application/gzip`・`application/x-gzip`、bzip2 の `application/x-bzip2`、xz の `application/x-xz` (圧縮した tar も 1 つの圧縮したファイルも)、7z の `application/x-7z-compressed`・RAR の `application/vnd.rar`・`application/x-rar-compressed`・`application/x-rar` (どちらも隔離した子のプロセスで読む)) は `archive` の流れを取る。
|
|
47
|
+
書庫自身は文字層も版面も持たないので、その流れは書庫の暗号を外した後に中身を子アセットとして展開して読み (`delete_child_assets` → `unlock_document` → `extract_assets` → `ocr_children` → `resolve_body` → `enrich_document` → `project_to_indexes`)、本文は中身の本文だけである。
|
|
48
|
+
中身が部品を持つ容れ物 (メール・PDF・Office) なら、その部品も中身の子として取り出して読む (下の「Child asset tree contract」)。OOXML の文書も ZIP の容れ物だが、自身の型を持ち `office` の規則が名指す。zstd は読み手が無く `other` の流れを取る。
|
|
47
49
|
|
|
48
50
|
- パスワードを持ちうる文書 (`pdf`・`office`・`archive`) の流れだけが、旧版の子アセットの削除の直後に `unlock_document` を置く (文書のパスワードを外し、解いたファイルを原本にする)。他の全ての段はその後に原本を読む。段は門を持たず (閉じると読めない守られた文書を通すだけになる)、パスワードの無い文書は `not_protected` で飛ばす。メールの添付など子のパスワードは `extract_assets` の中で外すので、`email` の流れは段を持たない。
|
|
49
51
|
|
|
@@ -153,11 +155,11 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
153
155
|
|
|
154
156
|
| Value / 値 | Vocabulary / 語彙 | Meaning / 意味 |
|
|
155
157
|
| --- | --- | --- |
|
|
156
|
-
| `PROTECTION_FORMATS` | `zip`・`pdf`・`ooxml`・`legacy_office` | 守りの属する書式 (記録 `td_file_unlock.protection_format` の語彙) |
|
|
157
|
-
| `REMOVABLE_PROTECTION_SCHEMES` | `zipcrypto`・`aes`・`pdf_user_password`・`pdf_owner_password`・`office_encryption` | 部品が外せる守り方。外したことの記録 (`td_file_unlock.protection_scheme`) と解除の段の答えが持てる唯一の値 |
|
|
158
|
+
| `PROTECTION_FORMATS` | `zip`・`7z`・`rar`・`pdf`・`ooxml`・`legacy_office` | 守りの属する書式 (記録 `td_file_unlock.protection_format` の語彙) |
|
|
159
|
+
| `REMOVABLE_PROTECTION_SCHEMES` | `zipcrypto`・`aes`・`7z_aes`・`rar_encryption`・`pdf_user_password`・`pdf_owner_password`・`office_encryption` | 部品が外せる守り方。外したことの記録 (`td_file_unlock.protection_scheme`) と解除の段の答えが持てる唯一の値 |
|
|
158
160
|
| `PROTECTION_SCHEMES` | `REMOVABLE_PROTECTION_SCHEMES`・`strong_encryption` | ファイルの守り方。`strong_encryption` は PKWARE の強い暗号で、どの部品も外せない |
|
|
159
161
|
| `UNLOCK_DISPOSITIONS` | `source_overwritten`・`copy_original`・`copy_promoted`・`child_decrypted` | 版の解いたファイルが原本になった方法 (記録 `td_file_unlock.disposition` の語彙) |
|
|
160
|
-
| `COPY_REASONS` | `permission_denied`・`immutable_source`・`foreign_application`・`local_source` |
|
|
162
|
+
| `COPY_REASONS` | `permission_denied`・`immutable_source`・`foreign_application`・`local_source`・`format_changed` | 源を上書きせず写しを原本にした理由 (`format_changed` は解いたファイルが源と別の書式。どの部品も書けない RAR を ZIP として解いたもの)。`isPromotable` が真になるのは `permission_denied` だけ (書けるようになった源へ昇格できる) |
|
|
161
163
|
| `UNLOCK_ERROR_CODES` | `passwordRequired: 4225`・`protectionUnsupported: 4226`・`sourceChanged: 4094` | 解除の段と昇格が失敗する業務コード |
|
|
162
164
|
| `FILE_PASSWORD_SOURCE_KINDS` / `FILE_PASSWORD_PATTERN_SYNTAXES` | `gmail`・`gdrive`・`gcs`・`file`・`daily-report` / `glob`・`regex` | 条件が名指せる源の種類と、型の書き方 (どちらも値の全体に、大小文字を区別せず当てる) |
|
|
163
165
|
| `FILE_PASSWORD_FIELD_WIDTHS` / `FILE_PASSWORD_MAX_BYTES` | 名 200・送り手 320・件名 400・ファイルの名 400・URI の接頭辞 2048 / 995 | 名と条件の幅 (`storedWidth`。ホストの `nvarchar(n)` の列と同じ UTF-16 の単位で、BMP の外の字は 2 つ) と、UTF-8 で数えるパスワードの最長 (`passwordByteLength`) |
|
|
@@ -356,11 +358,14 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
356
358
|
| `POLICY_CONFLICT_MAX_TIE_GROUP_SIZE` | 2〜60 |
|
|
357
359
|
| `CHILD_TREE_MAX_NODES` | 1〜100000 |
|
|
358
360
|
| `CHILD_TREE_MAX_TOTAL_BYTES` | 1048576〜4294967296 |
|
|
361
|
+
| `CHILD_TREE_MAX_SECONDS` | 60〜3600 |
|
|
359
362
|
| `ARCHIVE_MAX_MEMBER_BYTES` | 65536〜1073741824 |
|
|
360
363
|
| `ARCHIVE_MAX_COMPRESSION_RATIO` | 10〜10000 |
|
|
364
|
+
| `ARCHIVE_READER_MAX_MEMORY_BYTES` | 268435456〜17179869184 |
|
|
365
|
+
| `ARCHIVE_READER_MAX_SECONDS` | 10〜3600 |
|
|
361
366
|
|
|
362
367
|
- 表の正本は `src/systemParameterRanges.json` の 1 つ。他の言語のホストは自分の写しを持ち、このリポジトリの中ではその試験がこのファイルを読んで一致を確かめる (API サーバーの `PARAMETER_RANGES`・`ARCHIVE_LIMIT_RANGES`・`CHILD_TREE_LIMIT_RANGES`)。公開する成果物は表を埋め込む。
|
|
363
|
-
- `CHILD_TREE_MAX_NODES` と `CHILD_TREE_MAX_TOTAL_BYTES` は根 1 つの 1 回の走りが引く子の木の予算 (どの種類・どの深さの節点も 1
|
|
368
|
+
- `CHILD_TREE_MAX_NODES` と `CHILD_TREE_MAX_TOTAL_BYTES` は根 1 つの 1 回の走りが引く子の木の予算 (どの種類・どの深さの節点も 1 つ数え、根より下で開く書庫も節点にならないまま開く前に 1 つを引き、抽出した全てのバイトを数える)。`CHILD_TREE_MAX_SECONDS` は同じ走り (木の抽出、または守りの読みを含む解除 1 回) が書庫の仕事に使える秒数で、隔離した子は自身の秒数 (`ARCHIVE_READER_MAX_SECONDS`) と残りの短い方で走り、尽きた後は根より下の書庫を開かない。`ARCHIVE_MAX_MEMBER_BYTES` と `ARCHIVE_MAX_COMPRESSION_RATIO` は書庫の中身 1 つの上限、`ARCHIVE_READER_MAX_MEMORY_BYTES` と `ARCHIVE_READER_MAX_SECONDS` は書庫を解く読み手 1 つの上限 (7z と RAR を読む隔離した子のプロセスの記憶と秒、xz の伸張器の記憶) である。木の深さと書庫全体の中身の数・総量の鍵は無い (木の予算が縛る)。
|
|
364
369
|
- `SYSTEM_PARAMETER_RANGES` は表と各値域を凍結してあり、型も値域まで読み取り専用である (プロセスの中の読み手の 1 つが値域を広げ、他の書き手と読み手の拒否を外すことができない)。
|
|
365
370
|
- `INTEGRITY_TOMBSTONE_RETENTION_DAYS` の値域は、実行の行の制約 (保持日数の範囲) と実行の見出しの契約 (`IntegrityRunHeaderSchema.tombstoneRetentionDays`) の範囲でもある。制約はこの表の写しなので、値域を変えるときは制約も同じ変更で改める (ホストの試験が一致を検める)。
|
|
366
371
|
- 表が抑えるパラメータは全て整数である。整数でないパラメータは、項目が型を宣言するまで表に加えられない。
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var rt=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var ra=Object.getOwnPropertyNames;var oa=Object.prototype.hasOwnProperty;var aa=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},ia=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ra(t))!oa.call(e,o)&&o!==n&&rt(e,o,{get:()=>t[o],enumerable:!(r=na(t,o))||r.enumerable});return e};var sa=e=>ia(rt({},"__esModule",{value:!0}),e);var $s={};aa($s,{AmountEntrySchema:()=>Rn,AssetFacetItemSchema:()=>zt,BaseEnrichmentClient:()=>be,BodySourceSchema:()=>ze,BoundingBoxSchema:()=>Aa,CHILD_TREE_REBUILD_CHUNK:()=>gn,CHUNK_BODY_FIDELITIES:()=>cr,CHUNK_CHANGE_KINDS:()=>ar,CHUNK_MANIFEST_VERSION:()=>tr,CHUNK_PAIRINGS:()=>sr,CIRCUIT_BREAKER_SERVICES:()=>_a,COPY_REASONS:()=>$o,COPY_REASON_LABELS:()=>vs,CanonicalDomainKeySchema:()=>Tn,ChangeFeedCursorSchema:()=>Kt,ChapterSegmentSchema:()=>_n,ChildTreeRebuildRequestSchema:()=>fa,ChildTreeRebuildResultSchema:()=>ya,ChunkBodyFidelitySchema:()=>dr,ChunkChangeKindSchema:()=>ir,ChunkChangeSchema:()=>vr,ChunkManifestChildSchema:()=>Cr,ChunkManifestParentSchema:()=>_r,ChunkManifestSchema:()=>Ir,ChunkPairingSchema:()=>lr,ChunkRefSchema:()=>Tt,ChunkStatsSchema:()=>Mr,ChunkingStrategySchema:()=>Da,CircuitBreakerStatusSchema:()=>Na,ClassificationFacetSchema:()=>gr,ConfidentialityLevelSchema:()=>ne,CopyReasonSchema:()=>Ls,DIFF_CONTEXT_LINES:()=>Ke,DIFF_ENGINE_VERSION:()=>Nt,DIFF_LINE_FACETS:()=>mr,DIFF_LINE_PAGE_MAX:()=>Ft,DIFF_REGION_CELL_BOUND:()=>Ot,DOCUMENT_CAPTURE_OUTCOMES:()=>fr,DOCUMENT_CHANGE_FEED_PAGE_MAX:()=>Lt,DOCUMENT_CHANGE_FEED_PAGE_SIZE:()=>Za,DOCUMENT_FACETS:()=>re,DOCUMENT_KINDS:()=>Le,DOCUMENT_KIND_LABELS:()=>Oa,DOCUMENT_STATE_CAUSES:()=>nr,DOCUMENT_STATE_LOCK_TIMEOUT_MS:()=>Qa,DOCUMENT_STATE_RUN_OUTCOMES:()=>rr,DiffLineFacetSchema:()=>ni,DiffLinePageLimitSchema:()=>jt,DiffLinePageSchema:()=>fi,DiffLineSchema:()=>Lr,DiffSegmentSchema:()=>Fr,DocumentCaptureAnswerSchema:()=>Ni,DocumentCaptureOutcomeSchema:()=>hr,DocumentChangeFeedEntrySchema:()=>Vr,DocumentChangeFeedLimitSchema:()=>hi,DocumentChangeFeedPageSchema:()=>Ti,DocumentChangeFeedRowSchema:()=>Jr,DocumentComparisonSchema:()=>Si,DocumentFacetSchema:()=>vt,DocumentFacetValuesSchema:()=>li,DocumentHistorySchema:()=>Ri,DocumentKindSchema:()=>zn,DocumentRunEntrySchema:()=>Gr,DocumentStateCauseSchema:()=>Mt,DocumentStateEntrySchema:()=>Kr,DocumentStateRunOutcomeSchema:()=>or,DocumentStateSummarySchema:()=>Hr,DocumentStructuredDataSchema:()=>Ta,ENRICHMENT_STAGES:()=>dn,EnrichmentClient:()=>pt,EnrichmentClientError:()=>te,EnrichmentSyncStatusSchema:()=>ct,FACET_APPLICABLE_COUNTS:()=>xr,FACET_COUNT_FIELDS:()=>Rr,FILE_PASSWORD_FIELD_WIDTHS:()=>fe,FILE_PASSWORD_MAX_BYTES:()=>Hs,FILE_PASSWORD_PATTERN_SYNTAXES:()=>Xo,FILE_PASSWORD_PATTERN_SYNTAX_LABELS:()=>js,FILE_PASSWORD_PRIORITY_MAX:()=>Wo,FILE_PASSWORD_SOURCE_KINDS:()=>qo,FILE_PASSWORD_SOURCE_KIND_LABELS:()=>zs,FILTERABLE_CONFIDENTIALITY_LEVELS:()=>Sa,FacetChangeCountsSchema:()=>Ar,FacetDiffSchema:()=>Ur,FieldChangeSchema:()=>Ye,FilePasswordConditionsSchema:()=>ea,FilePasswordListSchema:()=>Bs,FilePasswordMatchSchema:()=>Vs,FilePasswordViewSchema:()=>pn,FileUriSchema:()=>xa,GRAPH_INDEX_LIMITS:()=>Ns,GraphSearchHitSchema:()=>Dn,HISTOGRAM_MAX_OCCURRENCES:()=>Dt,HunkIndexEntrySchema:()=>Pr,INGESTION_EVENT_NAMES:()=>Di,INLINE_REFINE_CELL_BUDGET:()=>wt,INLINE_REFINE_MAX_EDIT_DISTANCE:()=>Pt,INLINE_REFINE_MAX_GRAPHEMES:()=>Ge,INLINE_REFINE_MIN_SIMILARITY:()=>Be,INTEGRITY_CLASS_POLICY:()=>oo,INTEGRITY_COMMAND_CODES:()=>qt,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX:()=>$t,IntegrityActiveRunSchema:()=>fo,IntegrityAuditOverviewSchema:()=>Ji,IntegrityCancelFailureCodeSchema:()=>go,IntegrityCellResyncRequestSchema:()=>es,IntegrityCellResyncResultSchema:()=>ns,IntegrityCommandFailureCodeSchema:()=>We,IntegrityCommandFailureSchema:()=>as,IntegrityCommandReplySchema:()=>ss,IntegrityCommandSchema:()=>Bt,IntegrityDispositionSchema:()=>no,IntegrityFindingItemClassSchema:()=>Yt,IntegrityFindingPageSchema:()=>Zi,IntegrityFindingSchema:()=>ho,IntegrityFindingsQuerySchema:()=>Qi,IntegrityItemClassSchema:()=>Jt,IntegrityPhaseSchema:()=>lo,IntegrityPlacementObservedSchema:()=>qi,IntegrityQuantitySchema:()=>mo,IntegrityRepairActionSchema:()=>ro,IntegrityRepairOutcomeSchema:()=>co,IntegrityRepairSkipReasonSchema:()=>uo,IntegrityRunHeaderSchema:()=>Xe,IntegrityRunModeSchema:()=>ao,IntegrityRunStatusSchema:()=>io,IntegrityScopeRoleSchema:()=>eo,IntegrityStartFailureCodeSchema:()=>yo,IntegrityStoreSchema:()=>qe,IntegrityUnitSchema:()=>to,IntegrityVerdictSchema:()=>so,JsonPatchOperationSchema:()=>Dr,JsonValueSchema:()=>V,KeyedItemChangeSchema:()=>Nr,KeyedItemSchema:()=>At,LEDGER_STEP_KEYS:()=>Me,LINE_ENDINGS:()=>pr,LabelFacetItemSchema:()=>Er,LedgerStepKeySchema:()=>ja,LineEndingSchema:()=>ti,MIME_KIND_RULES:()=>Ln,MODE_TIERS:()=>lt,MetadataFacetSchema:()=>Sr,ModelProviderSchema:()=>En,NOTHING_TO_READ_TOKENS:()=>qn,NothingToReadTokenSchema:()=>Xn,PIPELINE_FAILURE_STATUSES:()=>ht,PIPELINE_FLOWS:()=>vn,PIPELINE_PHASES:()=>wa,PIPELINE_STEPS:()=>yt,PIPELINE_STEP_KEYS:()=>Ce,PROTECTION_FORMATS:()=>Vo,PROTECTION_SCHEMES:()=>Jo,PROTECTION_SCHEME_LABELS:()=>ws,PipelineFailureStatusSchema:()=>Ct,PipelineRunRecordSchema:()=>It,PipelineRunStatusSchema:()=>Ue,PipelineRunSummarySchema:()=>Rt,PipelineStepKeySchema:()=>bt,PipelineStepMetricSchema:()=>Wa,PipelineStepRecordSchema:()=>Wn,PipelineStepStatusSchema:()=>Jn,PipelineTriggerSchema:()=>Yn,ProtectionFormatSchema:()=>Ds,ProtectionSchemeSchema:()=>Ps,QUARANTINED_CONFIDENTIALITY_LEVEL:()=>de,REMOVABLE_PROTECTION_SCHEMES:()=>un,RESTRICTED_MARK_SUBJECTS:()=>ur,RUN_TERMINAL_STEP_ERROR_CODES:()=>Gn,RUN_TERMINAL_STEP_KEY:()=>ve,RUN_TERMINAL_STEP_OUTCOMES:()=>jn,ReadableConfidentialityLevelSchema:()=>Ut,RecentPipelineRunEntrySchema:()=>_i,RemovableProtectionSchemeSchema:()=>Os,RestrictedChangeMarkSchema:()=>jr,RestrictedFailureMarkSchema:()=>bi,RestrictedIngestMarkSchema:()=>Ei,RestrictedMarkSubjectSchema:()=>ei,RestrictedRunMarkSchema:()=>Ht,RestrictedStateMarkSchema:()=>zr,RunTerminalStepDetailSchema:()=>Kn,RunTerminalStepErrorCodeSchema:()=>Vn,RunTerminalStepOutcomeSchema:()=>Hn,SEARCH_DEGRADATION_REASONS:()=>Ra,SEARCH_FUSIONS:()=>Ca,SEARCH_MODES:()=>st,SEARCH_PARAM_LIMITS:()=>ga,SEARCH_QUALITY_TIERS:()=>Ia,SOURCE_CAPABILITIES:()=>Ho,SOURCE_CREDENTIALS:()=>jo,STALE_RUN_ERROR_CODE:()=>Bn,STRUCTURED_DATA_ARRAY_CELL_BOUND:()=>kt,SYSTEM_PARAMETER_RANGES:()=>xe,SearchHitSchema:()=>Nn,SearchMetadataSchema:()=>An,SearchModeSchema:()=>xn,SearchRequestSchema:()=>dt,SearchResponseSchema:()=>ut,SourceCatalogSchema:()=>Cs,SourceSpecSchema:()=>Bo,StageProvenanceSchema:()=>$n,TREE_PATH_PATTERN:()=>Se,TenantIdSchema:()=>Cn,TextDiffIndexSchema:()=>ui,TextFacetSchema:()=>br,TextStatsSchema:()=>Or,TranscriptSegmentSchema:()=>In,TreePathSchema:()=>Ee,UNLOCK_DISPOSITIONS:()=>Yo,UNLOCK_DISPOSITION_LABELS:()=>Fs,UNLOCK_ERROR_CODES:()=>Us,UnlockDispositionSchema:()=>ks,assertBoundedSystemParameter:()=>Fi,assertSystemParameterInRange:()=>ki,assetTypeName:()=>hn,canonicalJson:()=>j,classifyDocumentKind:()=>Pa,codePointSlicer:()=>So,compareAssetKeys:()=>Ve,compareCodeUnits:()=>Y,compareFacets:()=>Je,comparePhases:()=>Ma,compareStates:()=>zo,compareTreePaths:()=>at,decodeChangeFeedCursor:()=>$r,diffChunkBodies:()=>Oo,diffLinePage:()=>Po,encodeChangeFeedCursor:()=>Yr,enrichmentStage:()=>Ts,flowFor:()=>Fa,flowStepGates:()=>La,formatSkipReason:()=>Ba,generateUuidV7:()=>Js,identifierMatches:()=>Is,integrityCommandFailureCodeOf:()=>is,isEnrichmentStageKey:()=>As,isPromotable:()=>Ms,isStrictlyEarlier:()=>J,isUnknownTerm:()=>Un,isValidUuidV7:()=>ta,millisecondsBetween:()=>yn,modeFusesRankings:()=>ba,modeScoreIsSimilarity:()=>Ea,orderedSteps:()=>va,parseSkipReason:()=>_t,passwordByteLength:()=>Ks,pastedIdentifier:()=>Rs,readableEntrySchema:()=>Re,sourceOfUri:()=>_s,storedTermOf:()=>Ua,storedTermSchema:()=>_e,storedTermText:()=>za,storedWidth:()=>Zo,stripWhitespace:()=>Eo,summarizeTransition:()=>Uo,summaryFacetDiff:()=>Ne,textDiffIndex:()=>De,textFacetDiff:()=>Te,treePathDepth:()=>da,treePathLabel:()=>ua,treePathOf:()=>ee,treePathParent:()=>pa,treePathSegments:()=>ca,triesEveryFile:()=>Gs,uuidv7ToDate:()=>Ys});module.exports=sa($s);var j=e=>{if(e===null||typeof e=="string"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="number"){if(!Number.isFinite(e))throw new RangeError(`A canonical JSON number is finite: ${e}`);return JSON.stringify(e)}if(Array.isArray(e))return`[${e.map(j).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${j(t[r])}`).join(",")}}`};var fn=require("zod");var ot={embedded_image:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF",embedded_chart:"\u57CB\u3081\u8FBC\u307F\u306E\u56F3\u8868",embedded_table:"\u57CB\u3081\u8FBC\u307F\u306E\u8868",attachment:"\u6DFB\u4ED8",archive_member:"\u66F8\u5EAB\u306E\u4E2D\u8EAB",keyframe:"\u5834\u9762\u306E\u753B\u50CF",audio_track:"\u97F3\u58F0",transcript_segment:"\u66F8\u304D\u8D77\u3053\u3057"};var Se=/^[a-z_]+-(0|[1-9][0-9]*)(\/[a-z_]+-(0|[1-9][0-9]*))*$/,Ee=fn.z.string().regex(Se,"A tree path joins <asset_type>-<asset_index> segments with '/' from the root down."),le=e=>{if(!Se.test(e))throw new RangeError(`not a tree path: ${JSON.stringify(e)}`);return e.split("/").map(t=>{let n=t.lastIndexOf("-");return{kind:t.slice(0,n),digits:t.slice(n+1)}})},ca=e=>le(e).map(({kind:t,digits:n})=>({assetType:t,assetIndex:Number(n)})),da=e=>le(e).length,mn=(e,t)=>e<t?-1:e>t?1:0,at=(e,t)=>{let n=le(e),r=le(t);for(let o=0;o<Math.min(n.length,r.length);o+=1){let i=n[o],s=r[o],l=mn(i.kind,s.kind)||i.digits.length-s.digits.length||mn(i.digits,s.digits);if(l!==0)return l}return n.length-r.length},hn=e=>{if(!Object.hasOwn(ot,e))throw new RangeError(`no name for the asset type ${JSON.stringify(e)}`);return ot[e]},ua=e=>le(e).map(({kind:t,digits:n})=>`${hn(t)} ${n}`).join(" > "),ee=e=>e.parentPath===void 0?`${e.assetType}-${e.assetIndex}`:`${e.parentPath}/${e.assetType}-${e.assetIndex}`,pa=e=>le(e).length===1?null:e.slice(0,e.lastIndexOf("/"));var X=require("zod");var we=require("zod"),ce=we.z.string().uuid().transform(e=>e.toLowerCase()),N=we.z.string().datetime({offset:!0}),ke=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!Object.hasOwn(e,"__proto__"),d=(e,t,n)=>{e.addIssue({code:we.z.ZodIssueCode.custom,path:[...t],message:n})},ma=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:Z|([+-])(\d{2}):?(\d{2}))$/,Pe=e=>{let t=N.safeParse(e).success?ma.exec(e):null;if(t===null)return null;let[,n,r,o,i,s,l,c,h,u,y]=t,E=new Date(0);E.setUTCFullYear(Number(n),Number(r)-1,Number(o)),E.setUTCHours(Number(i),Number(s),l===void 0?0:Number(l),0);let A=h===void 0?0:(h==="+"?1:-1)*(Number(u)*3600+Number(y)*60);return{epochSeconds:E.getTime()/1e3-A,fraction:c===void 0?"":c}},J=(e,t)=>{let n=Pe(e),r=Pe(t);if(n===null||r===null)return!1;if(n.epochSeconds!==r.epochSeconds)return n.epochSeconds<r.epochSeconds;let o=Math.max(n.fraction.length,r.fraction.length);return n.fraction.padEnd(o,"0")<r.fraction.padEnd(o,"0")},yn=(e,t)=>{let n=Pe(e),r=Pe(t);if(n===null||r===null)return null;let o=Math.max(3,n.fraction.length,r.fraction.length),i=10n**BigInt(o),s=(BigInt(r.epochSeconds)-BigInt(n.epochSeconds))*i+BigInt(r.fraction.padEnd(o,"0"))-BigInt(n.fraction.padEnd(o,"0")),l=10n**BigInt(o-3);return Number(s>0n?(s+l-1n)/l:s/l)};var Fe=e=>{if(!Number.isInteger(e)||e<1)throw new RangeError(`A requeue chunk reads a positive integer of documents: ${e}`);return(t,n)=>{let r=t.requeued+t.skipped.length;r>e&&d(n,["requeued"],`One chunk settles at most ${e} documents.`),t.nextAfter!==null!=(r===e)&&d(n,["nextAfter"],"A chunk continues exactly when it read the limit.");let o=new Set;for(let[i,s]of t.skipped.entries())o.has(s.metadataId)&&d(n,["skipped",i,"metadataId"],"A chunk keeps a document back once."),o.add(s.metadataId)}};var gn=100,Sn=X.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),fa=X.z.object({after:Sn.optional()}).strict(),ha=X.z.object({requeued:X.z.number().int().nonnegative(),skipped:X.z.array(X.z.object({metadataId:X.z.number().int().min(1),reason:X.z.string().min(1)}).strict()),nextAfter:Sn.nullable()}).strict(),ya=ha.superRefine(Fe(gn));var te=class extends Error{statusCode;responseBody;parsedBody;constructor(t,n,r,o){super(t),this.name="EnrichmentClientError",this.statusCode=n,this.responseBody=r,this.parsedBody=o}},be=class{baseUrl;apiKey;fetchFn;timeoutMs;constructor(t){if(!t||typeof t.baseUrl!="string"||t.baseUrl.trim().length===0)throw new Error("baseUrl is required and must be a non-empty string for EnrichmentClient.");let n=t.baseUrl.trim().replace(/\/$/,"");if(t.apiKey&&n.startsWith("http://")&&!n.includes("localhost")&&!n.includes("127.0.0.1"))throw new Error("Security Violation: Transmitting Bearer tokens over unencrypted HTTP to non-localhost hosts is strictly prohibited.");this.baseUrl=n,this.apiKey=t.apiKey,this.fetchFn=t.fetchFn??fetch,this.timeoutMs=t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:3e4}async request(t,n,r){let o=`${this.baseUrl}${t}`,i={Accept:"application/json","Content-Type":"application/json","X-Tenant-Id":n};this.apiKey&&(i.Authorization=`Bearer ${this.apiKey}`);let s=new AbortController,l=setTimeout(()=>s.abort(),this.timeoutMs),c;try{c=await this.fetchFn(o,{method:"POST",headers:i,body:JSON.stringify(r),signal:s.signal})}catch(u){let y=u instanceof Error?u.message:String(u);throw new te(`Network request failed for POST ${o}: ${y}`,0,"")}finally{clearTimeout(l)}if(!c.ok){let u=await c.text().catch(()=>""),y;try{y=JSON.parse(u)}catch{}throw new te(`API request failed with status ${c.status}: ${u}`,c.status,u,y)}let h=await c.text().catch(()=>"");if(h.trim().length!==0)try{return JSON.parse(h)}catch(u){let y=u instanceof Error?u.message:String(u);throw new te(`Failed to parse response JSON from ${o}: ${y}`,c.status,h)}}};var m=require("zod");var it=require("zod"),En=it.z.enum(["google_cloud","google_vision","yomitoku_local","faster_whisper_local","google_speech","ollama_local","openai","anthropic","azure_openai","bedrock","custom_openai_compatible"]),ne=it.z.enum(["PUBLIC","INTERNAL","DEPARTMENT","CONFIDENTIAL","RESTRICTED"]),de="RESTRICTED";var ga={rrfK:{min:1,max:200,default:60},alpha:{min:0,max:1,default:.7},threshold:{min:0,max:1},limit:{min:1,max:50,default:10},queryLength:{min:1,max:500},filterTextLength:{min:1,max:100}},bn=ne.options.filter(e=>e!==de);if(bn.length===0)throw new Error("The confidentiality vocabulary left nothing filterable after removing the quarantined level; a validator built from this list would reject every request.");var Sa=bn,st=["KEYWORD","SPARSE","DENSE","HYBRID","GRAPH_TRAVERSE"],lt={KEYWORD:{dense:!1,sparse:!1,graph:!1,lexical:!0},SPARSE:{dense:!1,sparse:!0,graph:!1,lexical:!1},DENSE:{dense:!0,sparse:!1,graph:!1,lexical:!1},HYBRID:{dense:!0,sparse:!0,graph:!0,lexical:!0},GRAPH_TRAVERSE:{dense:!1,sparse:!1,graph:!0,lexical:!1}};function Ea(e){let t=lt[e];return t.dense&&!t.sparse}function ba(e){let t=lt[e];return[t.dense,t.sparse,t.graph,t.lexical].filter(Boolean).length>1}var Ca=["rrf","linear"],_a=["vector","graph"],Ia=["FULL","DEGRADED_LEXICAL_ONLY","DEGRADED_PARTIAL"],Ra=["vector_search_disabled","graph_search_disabled","circuit_breaker_open:vector","circuit_breaker_open:graph","vector_tier_not_configured","graph_tier_not_configured","no_active_vector_collection","vector_collections_missing","row_scope_permits_no_rows","vector_tier_unavailable","graph_tier_unavailable","vector_tier_timed_out","graph_tier_timed_out","tiers_not_executed"];var Cn=m.z.string().trim().min(1,"tenant_id must be a non-empty string"),xa=m.z.string().trim().min(1,"file_uri must be a non-empty string"),ct=m.z.enum(["PENDING","EXTRACTING","ENRICHING","PROJECTING","SYNCED","FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"]),Aa=m.z.object({page:m.z.number().int().positive().optional(),x:m.z.number().nonnegative().optional(),y:m.z.number().nonnegative().optional(),width:m.z.number().positive().optional(),height:m.z.number().positive().optional(),start_sec:m.z.number().nonnegative().optional(),end_sec:m.z.number().nonnegative().optional(),frame_index:m.z.number().int().nonnegative().optional(),timestamp_sec:m.z.number().nonnegative().optional(),scene_confidence:m.z.number().min(0).max(1).optional()}),_n=m.z.object({title:m.z.string().trim().min(1),start_sec:m.z.number().nonnegative(),end_sec:m.z.number().nonnegative(),summary:m.z.string()}),In=m.z.object({start_sec:m.z.number().nonnegative(),end_sec:m.z.number().nonnegative(),speaker:m.z.string().trim().min(1),text:m.z.string()}),Rn=m.z.object({label:m.z.string(),value:m.z.number(),currency:m.z.string()}),Ta=m.z.object({document_type:m.z.string().optional(),title:m.z.string().optional(),organization:m.z.string().optional(),key_entities:m.z.array(m.z.string()).optional(),dates:m.z.array(m.z.string()).optional(),amounts:m.z.array(Rn).optional(),media_type:m.z.enum(["video","audio"]).optional(),duration_sec:m.z.number().nonnegative().optional(),chapters:m.z.array(_n).optional(),transcript_segments:m.z.array(In).optional()}),Na=m.z.enum(["CLOSED","OPEN","HALF_OPEN"]),xn=m.z.enum(st),An=m.z.object({circuit_breaker_status:m.z.string(),quality_tier:m.z.string(),latency_ms:m.z.number().nonnegative(),total_hits:m.z.number().int().nonnegative(),fallback_applied:m.z.boolean(),degraded_reason:m.z.string().nullable()}),Tn=m.z.enum(["CONTRACT_LEGAL","EMAIL_THREAD","DAILY_REPORT","FINANCIAL_REPORT","TECHNICAL_SPEC","MASTER_DATA","MEDIA_ASSET","GENERAL_DOCUMENT"]),Da=m.z.enum(["hierarchical","conversation","section","fixed_size","table_aware","semantic","none","multimodal"]),Nn=m.z.object({metadata_id:m.z.number().int().positive(),chunk_index:m.z.number().int().nonnegative(),text:m.z.string(),score:m.z.number()}),Dn=m.z.object({metadata_id:m.z.number().int().positive(),relation:m.z.string(),target_name:m.z.string()}),dt=m.z.object({query:m.z.string().trim().min(1,"query must not be empty"),tenant_id:Cn,domain_key:Tn.optional(),limit:m.z.number().int().positive().optional(),department_id:m.z.number().int().positive().optional(),search_mode:xn.optional(),strategy_id:m.z.number().int().positive().optional()}).strict(),ut=m.z.object({hits:m.z.array(Nn),graph_hits:m.z.array(Dn),tiers:m.z.record(m.z.string(),m.z.boolean()),metadata:An});var pt=class extends be{async search(t){let n=dt.parse(t),r=await this.request("/ai/search/hybrid",n.tenant_id,n);return ut.parse(r)}};var a=require("zod");var S=require("zod");var Le=["email","pdf","office","image","media","archive","markdown","text","google_native","other"],Oa={email:"\u30E1\u30FC\u30EB",pdf:"PDF",office:"Office \u6587\u66F8",image:"\u753B\u50CF",media:"\u97F3\u58F0\u30FB\u52D5\u753B",archive:"\u66F8\u5EAB",markdown:"Markdown",text:"\u30C6\u30AD\u30B9\u30C8",google_native:"Google \u30CD\u30A4\u30C6\u30A3\u30D6",other:"\u305D\u306E\u4ED6"},Ln=[["message/rfc822","email"],["application/pdf","pdf"],["application/vnd.openxmlformats-officedocument.*","office"],["application/msword","office"],["application/vnd.ms-excel","office"],["application/vnd.ms-powerpoint","office"],["application/zip","archive"],["application/x-zip-compressed","archive"],["application/x-zip","archive"],["application/x-tar","archive"],["application/x-gtar","archive"],["application/gzip","archive"],["application/x-gzip","archive"],["application/x-bzip2","archive"],["application/vnd.google-apps.*","google_native"],["image/svg+xml","text"],["image/emf","other"],["image/x-emf","other"],["image/wmf","other"],["image/x-wmf","other"],["image/*","image"],["audio/*","media"],["video/*","media"],["text/markdown","markdown"],["text/x-markdown","markdown"],["text/*","text"],["application/json","text"],["application/xml","text"]];function Pa(e){let t=(e.split(";")[0]??"").trim().toLowerCase();for(let[n,r]of Ln)if(n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n)return r;return"other"}var Ce=["delete_child_assets","unlock_document","extract_text","analyze_media","extract_assets","ocr_document","ocr_children","resolve_body","enrich_document","project_to_indexes"],ve="record_document_state",Me=[...Ce,ve],wa=["EXTRACTING","ENRICHING","PROJECTING"],ht=["FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"],mt=e=>({featureFlagKey:e,whenClosed:"skip",failureStatus:null}),On=(e,t)=>({featureFlagKey:e,whenClosed:"fail",failureStatus:t}),yt={delete_child_assets:{key:"delete_child_assets",label:"\u65E7\u7248\u306E\u5B50\u30A2\u30BB\u30C3\u30C8\u524A\u9664",description:"\u3053\u306E\u7248\u3088\u308A\u524D\u306E\u7248\u304C\u751F\u3093\u3060\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u4FDD\u7BA1\u5C64\u3068\u7D22\u5F15\u304B\u3089\u5916\u3059\u3002",endpoint:"/ai/assets/delete",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},unlock_document:{key:"unlock_document",label:"\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u89E3\u9664",description:"\u6587\u66F8\u304C\u6301\u3064\u30D1\u30B9\u30EF\u30FC\u30C9 (ZIP\u30FBPDF\u30FBOffice) \u3092\u3001\u6761\u4EF6\u306E\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u5916\u3057\u3001\u89E3\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u539F\u672C\u306B\u3059\u308B (\u6E90\u3092\u4E0A\u66F8\u304D\u3059\u308B\u304B\u89E3\u3044\u305F\u5199\u3057\u3092\u539F\u672C\u306B\u3057\u3001\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u7121\u3044\u6587\u66F8\u306F\u98DB\u3070\u3059)\u3002",endpoint:"/ai/documents/unlock",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},extract_text:{key:"extract_text",label:"\u6587\u5B57\u5C64\u306E\u62BD\u51FA",description:"\u6587\u66F8\u304C\u6301\u3064\u6587\u5B57\u5C64 (PDF \u306E\u6587\u5B57\u30FBOffice \u306E\u672C\u6587\u30FB\u30E1\u30FC\u30EB\u306E\u672C\u6587\u3068\u898B\u51FA\u3057) \u3092\u8AAD\u307F\u3001\u4F4D\u7F6E\u60C5\u5831\u3068\u5171\u306B\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/enrichment/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},analyze_media:{key:"analyze_media",label:"\u30E1\u30C7\u30A3\u30A2\u89E3\u6790",description:"\u97F3\u58F0\u30FB\u52D5\u753B\u3092\u8EE2\u5199\u3057\u3001\u767A\u8A71\u533A\u9593\u4ED8\u304D\u306E\u30C1\u30E3\u30F3\u30AF\u3068\u30AD\u30FC\u30D5\u30EC\u30FC\u30E0\u6570\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/media/analyze",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_MEDIA_ANALYSIS")],capability:"transcription",fanOut:null},extract_assets:{key:"extract_assets",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u62BD\u51FA",description:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF\u30FB\u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u30FBMarkdown \u304C\u53C2\u7167\u3059\u308B\u753B\u50CF\u30FB\u66F8\u5EAB (ZIP\u30FBtar\u30FBgzip\u30FBbzip2) \u306E\u4E2D\u8EAB\u3092\u5B50\u30A2\u30BB\u30C3\u30C8\u3068\u3057\u3066\u53D6\u308A\u51FA\u3057 (\u6DFB\u4ED8\u306E\u66F8\u5EAB\u3082\u4E2D\u8EAB\u3078\u5C55\u958B\u3059\u308B)\u3001\u914D\u5099\u306E\u7F6E\u304D\u5834\u3078\u5199\u3057\u3066\u767B\u9332\u3059\u308B\u3002",endpoint:"/ai/assets/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_ASSET_EXTRACTION")],capability:"asset_extraction",fanOut:null},ocr_children:{key:"ocr_children",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u8AAD\u307F\u53D6\u308A",description:"\u5207\u308A\u51FA\u3057\u305F\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u62BD\u51FA\u9806\u306B 1 \u4EF6\u305A\u3064\u8AAD\u307F\u3001\u6587\u5B57\u5C64\u3092\u8AAD\u3081\u308B\u5B50 (\u30C6\u30AD\u30B9\u30C8\u30FB\u30E1\u30FC\u30EB\u30FBOffice\u30FBPDF) \u306F\u305D\u306E\u6587\u5B57\u5C64\u3092\u3001\u8AAD\u3081\u306A\u3044\u5B50\u306F\u7248\u9762\u3092\u5149\u5B66\u8A8D\u8B58\u3067\u8AAD\u3093\u3067 (\u89AA\u306E\u672C\u6587\u3067\u3042\u308B\u7248\u9762\u306E\u8A8D\u8B58\u304C\u65E2\u306B\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306B\u8F09\u308B PDF \u306E\u753B\u50CF\u306F\u8AAD\u307F\u76F4\u3055\u306A\u3044)\u3001\u5B50\u3054\u3068\u306B\u672C\u6587\u3068\u51FA\u6240\u3092\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:"ocr",fanOut:"children"},ocr_document:{key:"ocr_document",label:"\u6587\u66F8\u306E OCR",description:"\u6587\u66F8\u81EA\u8EAB\u306E\u7248\u9762 (\u753B\u50CF\u30FBPDF \u306E\u5404\u30DA\u30FC\u30B8) \u3092\u5149\u5B66\u8A8D\u8B58\u306B\u304B\u3051\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_OCR")],capability:"ocr",fanOut:null},resolve_body:{key:"resolve_body",label:"\u672C\u6587\u306E\u78BA\u5B9A",description:"\u6587\u5B57\u5C64\u30FBOCR\u30FB\u8EE2\u5199\u306E\u3069\u308C\u3092\u672C\u6587\u3068\u3059\u308B\u304B\u3092\u6C7A\u3081\u3001\u51FA\u6240\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/enrichment/body",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:null,fanOut:null},enrich_document:{key:"enrich_document",label:"\u8981\u7D04\u3068\u69CB\u9020\u5316\u62BD\u51FA",description:"\u672C\u6587\u3092\u30E2\u30C7\u30EB\u3078\u6E21\u3057\u3001\u8981\u7D04\u30FB\u30BF\u30B0\u30FB\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u30FB\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u3092\u5F97\u308B\u3002",endpoint:"/ai/enrichment/document",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:"enrichment",fanOut:null},project_to_indexes:{key:"project_to_indexes",label:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71",description:"\u672C\u6587\u3092\u30C1\u30E3\u30F3\u30AF\u306B\u3057\u3066\u57CB\u3081\u8FBC\u307F\u3001\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u3068\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u3078\u66F8\u304F\u3002",endpoint:"/ai/enrichment/project",phase:"PROJECTING",failureStatus:"FAILED_VECTOR",gates:[On("ENABLE_VECTOR_INDEXING","FAILED_VECTOR"),On("ENABLE_GRAPH_INDEXING","FAILED_GRAPH")],capability:null,fanOut:null}},ft={whenClosed:"fail",failureStatus:"FAILED_EXTRACT"},Pn=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets","ocr_document"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],wn=[{step:"delete_child_assets",dependsOn:[]},{step:"unlock_document",dependsOn:["delete_child_assets"]},{step:"extract_text",dependsOn:["unlock_document"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets","ocr_document"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],ka=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"resolve_body",dependsOn:["ocr_children"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],kn=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"resolve_body",dependsOn:["extract_text"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],vn={email:{kind:"email",steps:Pn},pdf:{kind:"pdf",steps:wn},office:{kind:"office",steps:wn},google_native:{kind:"google_native",steps:Pn},image:{kind:"image",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"ocr_document",dependsOn:["delete_child_assets"],gatePolicy:ft},{step:"resolve_body",dependsOn:["ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},media:{kind:"media",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"analyze_media",dependsOn:["delete_child_assets"],gatePolicy:ft},{step:"resolve_body",dependsOn:["analyze_media"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"existing"}]},archive:{kind:"archive",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"unlock_document",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["unlock_document"],gatePolicy:ft},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"resolve_body",dependsOn:["ocr_children"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},markdown:{kind:"markdown",steps:ka},text:{kind:"text",steps:kn},other:{kind:"other",steps:kn}};function Fa(e){return vn[e]}function La(e){let{gates:t}=yt[e.step],{gatePolicy:n}=e;return n===void 0?t:t.map(r=>({featureFlagKey:r.featureFlagKey,whenClosed:n.whenClosed,failureStatus:n.failureStatus}))}function va(e){let t=new Map(e.steps.map(i=>[i.step,i]));for(let i of e.steps){if(i.gatePolicy!==void 0&&yt[i.step].gates.length===0)throw new Error(`Flow ${e.kind}: step ${i.step} overrides its gate policy, but the step has no gate to close.`);for(let s of i.dependsOn)if(!t.has(s))throw new Error(`Flow ${e.kind}: step ${i.step} depends on ${s}, which the flow does not contain.`)}let n=[...e.steps],r=new Set,o=[];for(;n.length>0;){let i=n.findIndex(l=>l.dependsOn.every(c=>r.has(c)));if(i===-1)throw new Error(`Flow ${e.kind}: the steps ${n.map(l=>l.step).join(", ")} depend on each other in a cycle.`);let[s]=n.splice(i,1);r.add(s.step),o.push(s)}return o}var Fn={EXTRACTING:0,ENRICHING:1,PROJECTING:2};function Ma(e,t){return Fn[e]-Fn[t]}var ue=require("zod");function Ua(e,t){return Mn(e,t)?t:{known:!1,raw:t}}function Mn(e,t){return e.includes(t)}function Un(e){return typeof e!="string"}function za(e){return Un(e)?e.raw:e}function _e(e){let t=ue.z.object({known:ue.z.literal(!1),raw:ue.z.string()}).strict().refine(n=>!Mn(e,n.raw),{message:"A value the vocabulary knows is carried as itself, never as an unknown term.",path:["raw"]});return ue.z.union([ue.z.enum(e),t])}var zn=S.z.enum(Le),bt=S.z.enum(Ce),ja=S.z.enum(Me),Ct=S.z.enum(ht),jn=["RECORDED","UNCHANGED","ALREADY_RECORDED"],Hn=S.z.enum(jn),Kn=S.z.object({outcome:Hn}).strict(),Gn=["history_no_current_row","history_lock_timeout","history_write_failed"],Bn="stale_run",Vn=S.z.enum(Gn),Ue=S.z.enum(["RUNNING","SUCCEEDED","FAILED"]),Jn=S.z.enum(["RUNNING","SUCCEEDED","SKIPPED","FAILED"]),Yn=S.z.enum(["ingest","retry","resync"]),ze=S.z.enum(["text_layer","ocr","transcript"]),B=S.z.number().int().nonnegative().nullable(),$n=S.z.object({provider:S.z.string().nullable(),model:S.z.string().nullable(),engine:S.z.string().nullable(),prompt_key:S.z.string().nullable(),prompt_version:S.z.number().int().nullable(),duration_ms:B,input_chars:B,output_chars:B,pages_read:B,pages_total:B,chunk_count:B,points_upserted:B,collection:S.z.string().nullable(),embedding_model:S.z.string().nullable(),strategy_id:S.z.number().int().positive().nullable(),graph_nodes:B,body_source:ze.nullable(),detail:S.z.custom(ke,"A report's detail holds no own __proto__ member.").pipe(S.z.record(S.z.string(),S.z.unknown()))}).strict(),qn=["no_pages","no_pages_rendered","covered_by_page_recognition"],Xn=S.z.enum(qn),gt="gate_closed:",St="source_skipped:",Et="nothing_to_read:",Ha=["no_children","not_protected","superseded","recording_disabled","recording_misconfigured"],Ka=e=>Ha.includes(e),Ga=/^[A-Z][A-Z0-9_]*$/;function _t(e){if(Ka(e))return{kind:e};if(e.startsWith(gt)){let t=e.slice(gt.length);return Ga.test(t)?{kind:"gate_closed",featureFlagKey:t}:null}if(e.startsWith(St)){let t=bt.safeParse(e.slice(St.length));return t.success?{kind:"source_skipped",stepKey:t.data}:null}if(e.startsWith(Et)){let t=Xn.safeParse(e.slice(Et.length));return t.success?{kind:"nothing_to_read",token:t.data}:null}return null}function Ba(e){let t=Va(e);if(_t(t)===null)throw new RangeError(`Skip reason ${JSON.stringify(e)} has no text form: ${JSON.stringify(t)} is outside the skip-reason grammar.`);return t}function Va(e){switch(e.kind){case"gate_closed":return`${gt}${e.featureFlagKey}`;case"no_children":case"not_protected":case"superseded":case"recording_disabled":case"recording_misconfigured":return e.kind;case"source_skipped":return`${St}${e.stepKey}`;case"nothing_to_read":return`${Et}${e.token}`;default:{let t=e;throw new RangeError(`Unknown skip reason kind: ${JSON.stringify(t)}`)}}}var Ja=S.z.object({id:S.z.number().int().positive(),runId:S.z.number().int().positive(),sequence:S.z.number().int().nonnegative(),stepKey:_e(Me),targetMetadataId:S.z.number().int().positive(),targetTreePath:Ee.nullable(),status:Jn,skipReason:S.z.string().nullable(),provenance:$n.nullable(),strategyId:S.z.number().int().positive().nullable(),httpStatus:S.z.number().int().nullable(),errorCode:S.z.string().nullable(),errorMessage:S.z.string().nullable(),startedAt:N,finishedAt:N.nullable(),durationMs:B}).strict();function Ya(e,t){switch(e.stepKey===ve&&qa(e,t),e.status){case"SKIPPED":e.skipReason===null&&d(t,["skipReason"],"A SKIPPED step must record why it was skipped."),e.provenance!==null&&d(t,["provenance"],"A SKIPPED step read nothing, so it has no report.");return;case"SUCCEEDED":e.provenance===null&&d(t,["provenance"],"A SUCCEEDED step must carry its report."),e.skipReason!==null&&d(t,["skipReason"],"A SUCCEEDED step was not skipped.");return;case"RUNNING":e.finishedAt!==null&&d(t,["finishedAt"],"A RUNNING step has not finished.");return;case"FAILED":e.skipReason!==null&&d(t,["skipReason"],"A FAILED step was not skipped.");return}}var $a=["superseded","recording_disabled","recording_misconfigured"];function qa(e,t){if(e.strategyId!==null&&d(t,["strategyId"],"The terminal step applies no strategy."),e.httpStatus!==null&&d(t,["httpStatus"],"The terminal step calls no API, so it has no HTTP status."),e.status==="SUCCEEDED"&&e.provenance!==null){Kn.safeParse(e.provenance.detail).success||d(t,["provenance","detail"],"A succeeded terminal step's detail is exactly { outcome }.");for(let[n,r]of Object.entries(e.provenance))n!=="detail"&&r!==null&&d(t,["provenance",n],"A succeeded terminal step reports nothing but its outcome.")}if(e.status==="FAILED"&&(e.provenance!==null&&d(t,["provenance"],"Neither the failure close nor the recovery sweeper writes a terminal step's report."),e.errorCode!==Bn&&!Vn.safeParse(e.errorCode).success&&d(t,["errorCode"],"A failed terminal step names a history error code, or the stale-run code the sweeper writes.")),e.status==="SKIPPED"&&e.skipReason!==null){let n=_t(e.skipReason);(n===null||!$a.includes(n.kind))&&d(t,["skipReason"],"A skipped terminal step names one of the terminal skip reasons.")}}var Wn=Ja.superRefine(Ya),Zn=S.z.object({id:S.z.number().int().positive(),tenantId:S.z.string().min(1),metadataId:S.z.number().int().positive(),revision:S.z.number().int().positive(),runUid:S.z.string().uuid(),jobId:S.z.string().min(1),attempt:S.z.number().int().positive(),trigger:Yn,documentKind:_e(Le),flowKey:S.z.string().min(1),status:Ue,retryScheduled:S.z.boolean(),failedStepKey:_e(Ce).nullable(),errorMessage:S.z.string().nullable(),requestedBy:S.z.string().min(1),startedAt:N,finishedAt:N.nullable(),steps:S.z.array(Wn)}).strict();function Qn(e,t){e.retryScheduled&&e.status!=="FAILED"&&d(t,["retryScheduled"],"Only a FAILED run can have a retry scheduled.")}var It=Zn.superRefine(Qn),Rt=Zn.omit({steps:!0}).superRefine(Qn);function Xa(e,t){e.sampleCount>0||(e.durationP50Ms!==null&&d(t,["durationP50Ms"],"A step with no sample has no median latency."),e.durationP95Ms!==null&&d(t,["durationP95Ms"],"A step with no sample has no 95th-percentile latency."))}var Wa=S.z.object({documentKind:zn,stepKey:bt,sampleCount:S.z.number().int().nonnegative(),succeeded:S.z.number().int().nonnegative(),failed:S.z.number().int().nonnegative(),skipped:S.z.number().int().nonnegative(),durationP50Ms:B,durationP95Ms:B,lastStartedAt:N.nullable()}).strict().superRefine(Xa);var Nt=2,Ke=3,Dt=64,Ot=1e6,Ge=4096,Be=.3,Pt=1024,wt=67108864,kt=16777216,Ft=500,Lt=50,Za=50,Qa=1e4,tr=1,re=["classification","metadata","labels","tags","structured_data","text","summary","chunks","assets"],vt=a.z.enum(re),nr=["RUN","PRE_WRITE","MANUAL","BACKFILL"],Mt=a.z.enum(nr),rr=["SUCCEEDED","FAILED"],or=a.z.enum(rr),ar=["ADDED","REMOVED","MODIFIED","MOVED"],ir=a.z.enum(ar),sr=["clause","breadcrumbs"],lr=a.z.enum(sr),cr=["EXACT","WHITESPACE_NORMALIZED","UNVERIFIED"],dr=a.z.enum(cr),ur=["run","ingest","failure","state","change"],ei=a.z.enum(ur),pr=["LF","CRLF","CR","MIXED","NONE"],ti=a.z.enum(pr),mr=["text","summary","chunks"],ni=a.z.enum(mr),fr=["RECORDED","UNCHANGED"],hr=a.z.enum(fr),yr=a.z.lazy(()=>a.z.custom(ke,"A JSON object here holds no own __proto__ member.").pipe(a.z.record(a.z.string(),V))),V=a.z.lazy(()=>a.z.union([a.z.string(),a.z.number().finite(),a.z.boolean(),a.z.null(),a.z.array(V),yr])),Ut=ne.exclude([de]),z=a.z.number().int().positive(),I=a.z.number().int().nonnegative(),He=a.z.string().regex(/^[0-9a-f]{64}$/,"A SHA-256 is 64 lowercase hexadecimal digits."),Y=(e,t)=>e<t?-1:e>t?1:0,Ve=(e,t)=>at(ee(e),ee(t)),pe=(e,t,n,r,o)=>{for(let i=1;i<e.length;i++)t(e[i-1],e[i])>=0&&d(n,[...r,i],o)},gr=a.z.object({confidentialityLevel:ne,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable(),createdBy:a.z.string()}).strict(),Sr=a.z.object({fileName:a.z.string(),filePath:a.z.string(),fileId:a.z.string().nullable(),revision:z,revisionId:a.z.string().nullable(),fileSize:I,mimeType:a.z.string(),fileHash:a.z.string().nullable(),mtime:N}).strict(),Er=a.z.object({labelKey:a.z.string().min(1),assignedBy:a.z.string(),confidenceScore:a.z.number().finite()}).strict(),ri=a.z.string().refine(e=>!e.includes("/")&&Se.test(`${e}-0`),"An asset type is the kind of a tree path segment: lowercase letters and underscores."),zt=a.z.object({assetType:ri,assetIndex:I.max(Number.MAX_SAFE_INTEGER),mimeType:a.z.string(),fileSize:I,textSha256:He.nullable(),parentPath:Ee.optional()}).strict(),oi=zt.pick({assetType:!0,assetIndex:!0,parentPath:!0}).strip(),br=a.z.object({body:a.z.string().nullable(),mime:a.z.string().nullable(),source:ze.nullable(),isTruncated:a.z.boolean(),pageOffsets:V}).strict(),Cr=a.z.object({index:I,hash:He,whitespaceFreeHash:He,charStart:I,charEnd:I,breadcrumbs:a.z.string(),clause:a.z.string().nullable(),page:a.z.number().int().nullable(),sheet:a.z.string().nullable(),slide:a.z.number().int().nullable(),startSec:a.z.number().finite().nullable(),endSec:a.z.number().finite().nullable(),tokenCount:I,parentOrdinal:I}).strict(),_r=a.z.object({ordinal:I,contentHash:He,charLength:I}).strict();function ai(e,t){pe(e.children,(r,o)=>r.index-o.index,t,["children"],"Children are listed in strictly ascending index.");let n=0;e.children.forEach((r,o)=>{r.charStart>r.charEnd&&d(t,["children",o,"charEnd"],"A span ends at or after its start."),r.parentOrdinal===n?n++:r.parentOrdinal>n&&d(t,["children",o,"parentOrdinal"],"Parents are numbered in the order they first appear.")}),(e.parents.length!==n||e.parents.some((r,o)=>r.ordinal!==o))&&d(t,["parents"],"Each parent the children reach is listed exactly once, in ordinal order.")}var Ir=a.z.object({version:a.z.literal(tr),children:a.z.array(Cr).min(1),parents:a.z.array(_r)}).strict().superRefine(ai);function ii(e,t){pe(e.labels,(n,r)=>Y(n.labelKey,r.labelKey),t,["labels"],"Labels are ordered by labelKey with no key repeated."),pe(e.tags??[],Y,t,["tags"],"Tags are ordered with no tag repeated."),e.assets.every(n=>oi.safeParse(n).success)&&(pe(e.assets,Ve,t,["assets"],"Assets are ordered by their tree paths in tree order with no path repeated."),si(e.assets,t))}function si(e,t){let n=new Set;e.forEach((r,o)=>{Object.hasOwn(r,"parentPath")&&r.parentPath===void 0&&d(t,["assets",o,"parentPath"],"parentPath is absent at depth 1, never undefined."),r.parentPath!==void 0&&!n.has(r.parentPath)&&d(t,["assets",o,"parentPath"],"Each parentPath names an earlier item's tree path."),n.add(ee(r))})}var li=a.z.object({classification:gr,metadata:Sr,labels:a.z.array(Er),tags:a.z.array(a.z.string()).nullable(),structured_data:V,text:br,summary:a.z.string().nullable(),chunks:Ir.nullable(),assets:a.z.array(zt)}).strict().superRefine(ii),Rr=["addedCount","removedCount","modifiedCount","movedCount","unchangedCount","charsAdded","charsRemoved"],xr={classification:["modifiedCount"],metadata:["modifiedCount"],labels:["addedCount","removedCount","modifiedCount","unchangedCount"],tags:["addedCount","removedCount","unchangedCount"],structured_data:["addedCount","removedCount","modifiedCount"],text:["addedCount","removedCount","unchangedCount","charsAdded","charsRemoved"],summary:["addedCount","removedCount","unchangedCount","charsAdded","charsRemoved"],chunks:["addedCount","removedCount","modifiedCount","movedCount","unchangedCount"],assets:["addedCount","removedCount","modifiedCount","unchangedCount"]};function ci(e,t){let n=xr[e.facet];for(let r of Rr)n.includes(r)&&e[r]===null&&d(t,[r],`The ${e.facet} facet always counts ${r}.`),!n.includes(r)&&e[r]!==null&&d(t,[r],`${r} does not apply to the ${e.facet} facet.`)}var Ar=a.z.object({facet:vt,addedCount:I.nullable(),removedCount:I.nullable(),modifiedCount:I.nullable(),movedCount:I.nullable(),unchangedCount:I.nullable(),charsAdded:I.nullable(),charsRemoved:I.nullable()}).strict().superRefine(ci),er=new Map(re.map((e,t)=>[e,t])),Je=(e,t)=>er.get(e)-er.get(t),Tr=a.z.array(Ar).min(1).superRefine((e,t)=>pe(e,(n,r)=>Je(n.facet,r.facet),t,[],"A change lists each changed facet once, in display order.")),Ye=a.z.object({field:a.z.string().min(1),before:V,after:V}).strict(),At=a.z.object({key:a.z.string().min(1),value:yr}).strict(),Nr=a.z.object({key:a.z.string().min(1),fields:a.z.array(Ye).min(1)}).strict(),xt=a.z.string().refine(e=>e===""||e.startsWith("/"),"A JSON Pointer is empty or starts with '/'."),Dr=a.z.discriminatedUnion("op",[a.z.object({op:a.z.literal("add"),path:xt,value:V}).strict(),a.z.object({op:a.z.literal("remove"),path:xt,previous:V}).strict(),a.z.object({op:a.z.literal("replace"),path:xt,value:V,previous:V}).strict()]),Or=a.z.object({linesAdded:I,linesRemoved:I,linesUnchanged:I,charsAdded:I,charsRemoved:I,similarity:a.z.number().min(0).max(1).nullable()}).strict();function di(e,t){e.linesAdded>e.newLines&&d(t,["linesAdded"],"A hunk adds no more lines than it spans on the new side."),e.linesRemoved>e.oldLines&&d(t,["linesRemoved"],"A hunk removes no more lines than it spans on the old side."),e.linesAdded+e.linesRemoved===0&&d(t,["linesAdded"],"A hunk changes at least one line.")}var Pr=a.z.object({hunk:I,oldStart:I,oldLines:I,newStart:I,newLines:I,firstPage:a.z.number().int().nullable(),linesAdded:I,linesRemoved:I}).strict().superRefine(di),wr=(e,t)=>{e.forEach((n,r)=>{n.hunk!==r&&d(t,["hunks",r,"hunk"],"Hunks are numbered from 0 in order.")})},kr={attributes:a.z.array(Ye),stats:Or,hunks:a.z.array(Pr)},ui=a.z.object(kr).strict().superRefine((e,t)=>wr(e.hunks,t)),Fr=a.z.object({kind:a.z.enum(["equal","removed","added"]),text:a.z.string().min(1)}).strict(),pi={context:["equal"],removed:["equal","removed"],added:["equal","added"]};function mi(e,t){e.oldNumber===null!=(e.kind==="added")&&d(t,["oldNumber"],"Context and removed lines carry their old number; added lines carry none."),e.newNumber===null!=(e.kind==="removed")&&d(t,["newNumber"],"Context and added lines carry their new number; removed lines carry none."),e.segments.forEach((n,r)=>{pi[e.kind].includes(n.kind)||d(t,["segments",r,"kind"],`A ${e.kind} line has no ${n.kind} segment.`)})}var Lr=a.z.object({kind:a.z.enum(["context","removed","added"]),oldNumber:z.nullable(),newNumber:z.nullable(),page:a.z.number().int().nullable(),segments:a.z.array(Fr)}).strict().superRefine(mi),fi=a.z.object({lines:a.z.array(Lr).max(Ft),next:I.nullable()}).strict().superRefine((e,t)=>{e.next!==null&&e.lines.length===0&&d(t,["next"],"An empty page has no next page.")}),jt=a.z.number().int().min(1).max(Ft),hi=a.z.number().int().min(1).max(Lt),Tt=a.z.object({index:I,charStart:I,charEnd:I,page:a.z.number().int().nullable(),sheet:a.z.string().nullable(),slide:a.z.number().int().nullable(),startSec:a.z.number().finite().nullable(),endSec:a.z.number().finite().nullable(),breadcrumbs:a.z.string(),tokenCount:I,fidelity:dr}).strict();function yi(e,t){e.old===null!=(e.kind==="ADDED")&&d(t,["old"],"Every chunk change but ADDED has an old chunk."),e.new===null!=(e.kind==="REMOVED")&&d(t,["new"],"Every chunk change but REMOVED has a new chunk."),e.pairing===null==(e.kind==="MODIFIED")&&d(t,["pairing"],"A MODIFIED pair names the rule that paired it; no other change has one.")}var vr=a.z.object({entry:I,kind:ir,pairing:lr.nullable(),old:Tt.nullable(),new:Tt.nullable()}).strict().superRefine(yi),Mr=a.z.object({added:I,removed:I,modified:I,moved:I,unchanged:I}).strict();function gi(e,t){e.entries.forEach((o,i)=>{o.entry!==i&&d(t,["entries",i,"entry"],"Chunk entries are numbered from 0 in order.")});let n={ADDED:0,REMOVED:0,MODIFIED:0,MOVED:0};for(let o of e.entries)n[o.kind]++;let r=[["added",n.ADDED],["removed",n.REMOVED],["modified",n.MODIFIED],["moved",n.MOVED]];for(let[o,i]of r)e.stats[o]!==i&&d(t,["stats",o],`The ${o} count equals the number of entries of that kind.`)}var Ur=a.z.union([a.z.object({facet:vt,change:a.z.literal("UNCHANGED")}).strict(),a.z.object({facet:a.z.enum(["classification","metadata"]),change:a.z.literal("CHANGED"),fields:a.z.array(Ye).min(1)}).strict(),a.z.object({facet:a.z.enum(["labels","assets"]),change:a.z.literal("CHANGED"),added:a.z.array(At),removed:a.z.array(At),modified:a.z.array(Nr),unchangedCount:I}).strict(),a.z.object({facet:a.z.literal("tags"),change:a.z.literal("CHANGED"),added:a.z.array(a.z.string()),removed:a.z.array(a.z.string()),unchangedCount:I}).strict(),a.z.object({facet:a.z.literal("structured_data"),change:a.z.literal("CHANGED"),operations:a.z.array(Dr).min(1)}).strict(),a.z.object({facet:a.z.enum(["text","summary"]),change:a.z.literal("CHANGED"),...kr}).strict().superRefine((e,t)=>wr(e.hunks,t)),a.z.object({facet:a.z.literal("chunks"),change:a.z.literal("CHANGED"),stats:Mr,entries:a.z.array(vr),textUnchangedChunkingChanged:a.z.boolean()}).strict().superRefine(gi)]),Si=a.z.object({diffEngineVersion:z,facets:a.z.array(Ur)}).strict().superRefine((e,t)=>{(e.facets.length!==re.length||e.facets.some((n,r)=>n.facet!==re[r]))&&d(t,["facets"],"A comparison carries every facet once, in display order.")}),Re=e=>a.z.object({kind:a.z.literal("readable"),item:e}).strict(),Ht=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("run"),startedAt:N,finishedAt:N.nullable(),status:Ue}).strict(),Ei=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("ingest"),createdAt:N,updatedAt:N,syncStatus:ct.nullable()}).strict(),bi=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("failure"),failedAt:N.nullable(),syncStatus:Ct}).strict(),zr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("state"),settledAt:N}).strict(),jr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("change"),settledAt:N}).strict();function Ci(e,t){let n=e.cause==="RUN";e.runId!==null!==n&&d(t,["runId"],"A RUN state names its run; no other state does."),e.runOutcome!==null!==n&&d(t,["runOutcome"],"A RUN state carries the worker's outcome; no other state does."),e.changes!==null!=(e.previousStateId!==null)&&d(t,["changes"],"A state carries its counts exactly when its predecessor is readable."),e.diffEngineVersion!==null!=(e.changes!==null)&&d(t,["diffEngineVersion"],"The engine version comes with the counts it produced."),e.modelOnlyChange&&e.changes===null&&d(t,["modelOnlyChange"],"Only a change with counts can be a model-only change."),e.previousStateId===e.stateId&&d(t,["previousStateId"],"A state does not precede itself.")}var Hr=a.z.object({stateId:z,revision:z,cause:Mt,runId:z.nullable(),runOutcome:or.nullable(),settledAt:N,actor:a.z.string().min(1),classification:a.z.object({confidentialityLevel:Ut,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable()}).strict(),modelOnlyChange:a.z.boolean(),previousStateId:z.nullable(),changes:Tr.nullable(),diffEngineVersion:z.nullable()}).strict().superRefine(Ci),Kr=a.z.discriminatedUnion("kind",[Re(Hr),zr]),Gr=a.z.discriminatedUnion("kind",[Re(It),Ht]),_i=a.z.discriminatedUnion("kind",[Re(Rt),Ht]),Br=(e,t,n)=>{for(let r=1;r<e.length;r++)J(e[r-1],e[r])&&d(t,[...n,r],"Entries are listed newest first.")},je=e=>e.kind==="readable"?e.item.settledAt:e.settledAt;function Ii(e,t){pe(e.revisions,(r,o)=>o.revision-r.revision,t,["revisions"],"Revisions are listed newest first, each once.");let n=e.revisions.filter(r=>r.isCurrent);(n.length!==1||n[0]?.metadataId!==e.document.metadataId||n[0].revision!==e.document.revision)&&d(t,["revisions"],"Exactly one revision is current: the row the history names."),Br(e.states.map(je),t,["states"])}var Ri=a.z.object({document:a.z.object({metadataId:z,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:z,confidentialityLevel:Ut}).strict(),revisions:a.z.array(a.z.object({metadataId:z,revision:z,revisionId:a.z.string().nullable(),isCurrent:a.z.boolean()}).strict()),states:a.z.array(Kr),runs:a.z.array(Gr)}).strict().superRefine(Ii),Vr=a.z.object({stateId:z,previousStateId:z,metadataId:z,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:z,previousRevision:z,cause:Mt,actor:a.z.string().min(1),settledAt:N,changes:Tr}).strict().superRefine((e,t)=>{e.previousStateId===e.stateId&&d(t,["previousStateId"],"A state does not precede itself.")}),Jr=a.z.discriminatedUnion("kind",[Re(Vr),jr]),Kt=a.z.object({settledAt:N,id:z.max(Number.MAX_SAFE_INTEGER)}).strict(),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function xi(e){let t="";for(let n=0;n<e.length;n+=3){let r=e.length-n,o=e[n]<<16|(r>1?e[n+1]:0)<<8|(r>2?e[n+2]:0);t+=Ie[o>>18&63]+Ie[o>>12&63],r>1&&(t+=Ie[o>>6&63]),r>2&&(t+=Ie[o&63])}return t}function Ai(e){if(e.length%4===1)return null;let t=[],n=0,r=0;for(let o of e){let i=Ie.indexOf(o);if(i===-1)return null;n=n<<6|i,r+=6,r>=8&&(r-=8,t.push(n>>r&255),n&=(1<<r)-1)}return Uint8Array.from(t)}function Yr(e){let{settledAt:t,id:n}=Kt.parse(e);return xi(new TextEncoder().encode(j({id:n,settledAt:t})))}function $r(e){let t=Ai(e);if(t===null)return null;let n;try{n=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t))}catch{return null}let r=Kt.safeParse(n);return r.success&&Yr(r.data)===e?r.data:null}var Ti=a.z.object({rows:a.z.array(Jr).max(Lt),next:a.z.string().nullable()}).strict().superRefine((e,t)=>{Br(e.rows.map(je),t,["rows"]),e.next!==null&&e.rows.length===0&&d(t,["next"],"An empty page has no next page.");let n=e.next===null?null:$r(e.next);e.next!==null&&n===null&&d(t,["next"],"The next position is a cursor encodeChangeFeedCursor wrote.");let r=e.rows[e.rows.length-1];n!==null&&r!==void 0&&(J(n.settledAt,je(r))||J(je(r),n.settledAt))&&d(t,["next"],"The next position is the arriving state of the page's last row."),n!==null&&r?.kind==="readable"&&n.id!==r.item.stateId&&d(t,["next"],"The next position names the arriving state of the page's last readable row.")}),Ni=a.z.object({outcome:hr}).strict();var Di=Object.freeze({integrityRun:"integrity_run",resyncRequired:"resync-required"});var p=require("zod");var qr=[{code:"DEPLOYMENT_DISABLED",status:503,errorCode:5035},{code:"RUN_ALREADY_ACTIVE",status:409,errorCode:4091},{code:"BASIS_INVALID",status:409,errorCode:4092},{code:"RUN_ALREADY_FINISHED",status:409,errorCode:4093},{code:"FORBIDDEN",status:403,errorCode:null}];var Xr={INTEGRITY_TOMBSTONE_RETENTION_DAYS:{min:1,max:3650},INTEGRITY_FINDING_SAMPLE_LIMIT:{min:1,max:5e3},INTEGRITY_RUN_HEARTBEAT_TIMEOUT_SECONDS:{min:30,max:3600},INTEGRITY_RUN_RETENTION_COUNT:{min:2,max:100},POLICY_CONFLICT_MAX_TIE_GROUP_SIZE:{min:2,max:60},CHILD_TREE_MAX_NODES:{min:1,max:1e5},CHILD_TREE_MAX_TOTAL_BYTES:{min:1048576,max:4294967296},ARCHIVE_MAX_MEMBER_BYTES:{min:65536,max:1073741824},ARCHIVE_MAX_COMPRESSION_RATIO:{min:10,max:1e4}};var wi=e=>{for(let t of Object.values(e))Object.freeze(t);return Object.freeze(e)},xe=wi(Xr),Wr=e=>Object.hasOwn(xe,e),Zr=(e,t)=>{let{min:n,max:r}=xe[e];if(!Number.isInteger(t)||t<n||t>r)throw new RangeError(`${e} \u306F ${n}\u301C${r} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)},ki=(e,t)=>{Wr(e)&&Zr(e,t)},Fi=(e,t)=>{if(!Wr(e))throw new TypeError(`The range table bounds no parameter named ${JSON.stringify(e)}.`);Zr(e,t)};var qe=p.z.enum(["QDRANT","NEO4J"]),eo=p.z.enum(["PRODUCTION","VARIANT","LABEL"]),Jt=p.z.enum(["EXPECTED","LIVE","HISTORY","TOMBSTONE","AWAITING_SUCCESSOR","IN_FLIGHT","UNPLACED","UNRECORDED","UNREFERENCED","CHANGED_AFTER_START","PIPELINE_FAILED","PROJECTION_REFUSED","ORPHAN","TOMBSTONE_EXPIRED","UNPROPAGATED_DELETE","STALE_REVISION","MISPLACED","OUT_OF_TIER","UNMARKED_SUPERSEDED","FLAG_DRIFT","VARIANT_FLAG_DRIFT","DETACHED","UNKEYED","MISSING","COUNT_MISMATCH","UNPROJECTED","UNKEYED_ENTITY"]),Yt=Jt.exclude(["EXPECTED","LIVE","HISTORY"]),to=p.z.enum(["POINT","NODE","CHUNK","DOCUMENT"]),no=p.z.enum(["EXPECTED","HEALTHY","RETAINED","INFORMATIONAL","DISCREPANCY"]),ro=p.z.enum(["NONE","PURGE","FLAG","REPROJECT"]),P=(e,t)=>Object.freeze({disposition:e,repairAction:t}),oo=Object.freeze({EXPECTED:P("EXPECTED","NONE"),LIVE:P("HEALTHY","NONE"),HISTORY:P("RETAINED","NONE"),TOMBSTONE:P("RETAINED","NONE"),AWAITING_SUCCESSOR:P("RETAINED","NONE"),IN_FLIGHT:P("INFORMATIONAL","NONE"),UNPLACED:P("INFORMATIONAL","NONE"),UNRECORDED:P("INFORMATIONAL","NONE"),UNREFERENCED:P("INFORMATIONAL","NONE"),CHANGED_AFTER_START:P("INFORMATIONAL","NONE"),PIPELINE_FAILED:P("INFORMATIONAL","NONE"),PROJECTION_REFUSED:P("INFORMATIONAL","NONE"),ORPHAN:P("DISCREPANCY","PURGE"),TOMBSTONE_EXPIRED:P("DISCREPANCY","PURGE"),UNPROPAGATED_DELETE:P("DISCREPANCY","FLAG"),STALE_REVISION:P("DISCREPANCY","PURGE"),MISPLACED:P("DISCREPANCY","PURGE"),OUT_OF_TIER:P("DISCREPANCY","PURGE"),UNMARKED_SUPERSEDED:P("DISCREPANCY","FLAG"),FLAG_DRIFT:P("DISCREPANCY","REPROJECT"),VARIANT_FLAG_DRIFT:P("DISCREPANCY","NONE"),DETACHED:P("DISCREPANCY","PURGE"),UNKEYED:P("DISCREPANCY","PURGE"),MISSING:P("DISCREPANCY","REPROJECT"),COUNT_MISMATCH:P("DISCREPANCY","REPROJECT"),UNPROJECTED:P("DISCREPANCY","REPROJECT"),UNKEYED_ENTITY:P("DISCREPANCY","NONE")}),ao=p.z.enum(["SCAN","REPAIR"]),io=p.z.enum(["RUNNING","COMPLETED","FAILED","CANCELLED","ABANDONED"]),so=p.z.enum(["CONSISTENT","INCONSISTENT","UNDETERMINED"]),lo=p.z.enum(["QDRANT","NEO4J","DOCUMENTS"]),co=p.z.enum(["APPLIED","SKIPPED","FAILED"]),uo=p.z.enum(["RECLASSIFIED","IN_FLIGHT","DESTINATION_PENDING","BASIS_EXHAUSTED","PROJECTION_REFUSED","PIPELINE_FAILED","UNRECORDED","OUTSIDE"]),$t=100,K=p.z.number().int().nonnegative(),$e=p.z.number().int().min(300).max(599),Gt=["repairedCount","repairFailedCount","repairSkippedCount"],po=p.z.string().regex(/^[0-9a-f]{64}$/,"A store fingerprint is 64 lowercase hexadecimal digits."),Qr=xe.INTEGRITY_TOMBSTONE_RETENTION_DAYS,Li=p.z.object({runUid:ce,mode:ao,status:io,requestedBy:p.z.string().min(1),executor:p.z.string().min(1),basisRunUid:ce.nullable(),storeFingerprint:po,tombstoneRetentionDays:p.z.number().int().min(Qr.min).max(Qr.max),startedAt:N,finishedAt:N.nullable(),verdict:so.nullable(),errorClass:p.z.string().min(1).nullable(),reprojectDocuments:K.nullable(),reprojectRebuildDocuments:K.nullable()}).strict(),vi=(e,t)=>{let n=e.status==="COMPLETED";e.mode==="REPAIR"!=(e.basisRunUid!==null)&&d(t,["basisRunUid"],"A REPAIR run names its basis SCAN run, and a SCAN run names none."),n!==(e.verdict!==null)&&d(t,["verdict"],"Only a COMPLETED run has a verdict."),n!==(e.reprojectDocuments!==null)&&d(t,["reprojectDocuments"],"Only a COMPLETED run has the count of documents to re-project.");let{reprojectDocuments:r,reprojectRebuildDocuments:o}=e;r===null||o===null?r!==o&&d(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are counted together with the documents it re-projects."):o>r&&d(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are no more than the documents it re-projects."),e.status==="RUNNING"!=(e.finishedAt===null)&&d(t,["finishedAt"],"Only a RUNNING run has not finished."),e.finishedAt!==null&&J(e.finishedAt,e.startedAt)&&d(t,["finishedAt"],"A run does not finish before it starts."),(e.status==="FAILED"||e.status==="ABANDONED")!=(e.errorClass!==null)&&d(t,["errorClass"],"Only a FAILED or ABANDONED run names an error class.")},Xe=Li.superRefine(vi),Mi=p.z.object({store:qe,scopeKey:p.z.string().min(1),scopeRole:eo,itemClass:Jt,unit:to,disposition:no,repairAction:ro,itemCount:K.nullable(),unmeasuredReason:p.z.string().min(1).nullable(),measuredAt:N.nullable(),repairedCount:K.nullable(),repairFailedCount:K.nullable(),repairSkippedCount:K.nullable()}).strict(),Ui=(e,t)=>{let n=oo[e.itemClass];e.disposition!==n.disposition&&d(t,["disposition"],`A ${e.itemClass} quantity is ${n.disposition}.`),e.repairAction!==n.repairAction&&d(t,["repairAction"],`A repair's action on ${e.itemClass} items is ${n.repairAction}.`);let r=e.itemCount===null;r!==(e.unmeasuredReason!==null)&&d(t,["unmeasuredReason"],"An unmeasured quantity (itemCount null) has a reason, and a measured one has none."),r!==(e.measuredAt===null)&&d(t,["measuredAt"],"Only a measured quantity has a measurement time.");let{repairedCount:o,repairFailedCount:i,repairSkippedCount:s}=e;if(o===null||i===null||s===null){if(Gt.some(l=>e[l]!==null))for(let l of Gt)e[l]===null&&d(t,[l],"The repaired, failed and skipped counts are recorded together or not at all.");return}e.repairAction==="NONE"&&d(t,["repairAction"],"Only a class with a repair action carries repair counts."),e.itemCount!==null&&o+i+s>e.itemCount&&d(t,["itemCount"],"The repaired, failed and skipped counts together do not exceed the measured count.")},mo=Mi.superRefine(Ui),zi=p.z.object({run:Xe,phase:lo.nullable(),phaseScope:p.z.string().min(1).nullable(),phaseDone:K.nullable(),phaseTotal:K.nullable(),heartbeatAt:N,isStale:p.z.boolean(),staleAfter:N,cancelRequestedAt:N.nullable()}).strict(),ji=(e,t)=>{if(e.run.status!=="RUNNING"&&d(t,["run","status"],"The active run is a RUNNING run."),J(e.heartbeatAt,e.run.startedAt)&&d(t,["heartbeatAt"],"A run's heartbeat is not earlier than its start."),N.safeParse(e.heartbeatAt).success&&N.safeParse(e.staleAfter).success&&!J(e.heartbeatAt,e.staleAfter)&&d(t,["staleAfter"],"A run's heartbeat goes stale only after it beat."),e.phase===null)for(let n of["phaseScope","phaseDone","phaseTotal"])e[n]!==null&&d(t,[n],"A run with no phase has no phase progress.");e.phase==="DOCUMENTS"&&e.phaseScope!==null&&d(t,["phaseScope"],"The DOCUMENTS phase scans no scope.")},fo=zi.superRefine(ji),Hi=p.z.object({run:Xe,quantities:p.z.array(mo),previousStoreFingerprint:po.nullable()}).strict(),Ki=(e,t)=>{e.run.status!=="COMPLETED"&&d(t,["run","status"],"The last completed run is a COMPLETED run.");let n=new Set;for(let[r,o]of e.quantities.entries()){let i=JSON.stringify([o.store,o.scopeKey,o.itemClass]);if(n.has(i)&&d(t,["quantities",r],"A run records each (store, scope, class) cell once."),n.add(i),e.run.mode==="SCAN")for(let s of Gt)o[s]!==null&&d(t,["quantities",r,s],"A SCAN run repairs nothing, so its quantities carry no repair counts.")}},Gi=["FAILED","CANCELLED","ABANDONED"],Bi=p.z.object({run:Xe,repairAppliedItems:K.nullable(),hasNewerRepair:p.z.boolean()}).strict(),Vi=(e,t)=>{Gi.includes(e.run.status)||d(t,["run","status"],"A newer unsuccessful run is FAILED, CANCELLED or ABANDONED."),e.run.mode==="SCAN"&&e.repairAppliedItems!==null&&d(t,["repairAppliedItems"],"A SCAN run applies nothing."),e.run.mode==="REPAIR"&&!e.hasNewerRepair&&d(t,["hasNewerRepair"],"An unsuccessful REPAIR run is itself a repair newer than the last completed run.")},Ji=p.z.object({readAt:N,lastCompleted:Hi.superRefine(Ki).nullable(),active:fo.nullable(),newerUnsuccessful:Bi.superRefine(Vi).nullable()}).strict(),Yi=p.z.object({sequence:p.z.number().int().min(1),itemKey:p.z.string().min(1),metadataId:p.z.number().int().positive().nullable(),fileUri:p.z.string().nullable(),revision:p.z.number().int().nullable(),observed:p.z.record(p.z.string(),p.z.unknown()),repairOutcome:co.nullable(),repairErrorClass:p.z.string().min(1).nullable(),repairSkipReason:uo.nullable()}).strict(),$i=(e,t)=>{e.repairOutcome==="FAILED"!=(e.repairErrorClass!==null)&&d(t,["repairErrorClass"],"Only a FAILED finding names an error class."),e.repairOutcome==="SKIPPED"!=(e.repairSkipReason!==null)&&d(t,["repairSkipReason"],"Only a SKIPPED finding names a skip reason.")},ho=Yi.superRefine($i),qi=p.z.object({sotDomain:p.z.string().nullable()}).passthrough(),Xi=p.z.object({rows:p.z.array(ho),nextAfter:p.z.number().int().min(1).nullable(),recordedCount:K,totalCount:K.nullable()}).strict(),Wi=(e,t)=>{for(let[n,r]of e.rows.entries()){let o=e.rows[n-1];o!==void 0&&r.sequence<=o.sequence&&d(t,["rows",n,"sequence"],"A page lists its rows in ascending sequence.")}e.nextAfter!==null&&e.nextAfter!==e.rows.at(-1)?.sequence&&d(t,["nextAfter"],"The next page starts after the sequence of this page's last row.")},Zi=Xi.superRefine(Wi),Qi=p.z.object({runUid:ce,store:qe,scopeKey:p.z.string().min(1),itemClass:Yt,after:p.z.number().int().min(1).optional(),limit:p.z.number().int().min(1).max($t)}).strict(),es=p.z.object({runUid:ce,store:qe,scopeKey:p.z.string().min(1),itemClass:Yt.extract(["UNRECORDED"]),after:p.z.number().int().min(1).optional()}).strict(),ts=p.z.object({requeued:K,skipped:p.z.array(p.z.object({metadataId:p.z.number().int().min(1),reason:p.z.string().min(1)}).strict()),nextAfter:p.z.number().int().min(1).nullable()}).strict(),ns=ts.superRefine(Fe($t)),We=p.z.enum(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Bt=p.z.enum(["start","cancel"]),yo=We.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","FORBIDDEN","UPSTREAM_FAILED"]),go=We.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Vt={start:yo,cancel:go},rs=p.z.object({code:We.exclude(["UPSTREAM_FAILED"]),status:$e,errorCode:p.z.number().int().nullable()}).strict(),qt=Object.freeze(p.z.array(rs).parse(qr).map(e=>Object.freeze(e))),os=(e,t)=>{e.code==="UPSTREAM_FAILED"||e.code==="FORBIDDEN"&&e.status===null||qt.some(n=>n.code===e.code&&n.status===e.status)||d(t,["status"],`A ${e.code} failure carries the status of its row in the code table.`)},as=p.z.discriminatedUnion("command",[p.z.object({command:Bt.extract(["start"]),code:Vt.start,status:$e.nullable()}).strict(),p.z.object({command:Bt.extract(["cancel"]),code:Vt.cancel,status:$e.nullable()}).strict()]).superRefine(os),is=(e,t,n)=>{let r=Vt[e],o=qt.find(i=>i.status===t&&(i.errorCode===null||i.errorCode===n)&&r.safeParse(i.code).success);return o===void 0?"UPSTREAM_FAILED":o.code},ss=p.z.discriminatedUnion("ok",[p.z.object({ok:p.z.literal(!0),runUid:ce}).strict(),p.z.object({ok:p.z.literal(!1),status:$e,errorCode:p.z.number().int().nullable()}).strict()]);function So(e){let t=[];for(let r=0;r<e.length;r++){t.push(r);let o=e.charCodeAt(r);o>=55296&&o<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320&&r++}t.push(e.length);let n=t.length-1;return{length:n,slice(r,o){if(!(Number.isInteger(r)&&Number.isInteger(o))||r<0||r>o)throw new RangeError(`A code-point span is [charStart, charEnd) with 0 <= charStart <= charEnd: [${r}, ${o})`);return o>n?null:e.slice(t[r],t[o])}}}var Eo=e=>e.replace(/\s/gu,"");function oe(e,t){let n=new Map,r=i=>{let s=new Int32Array(i.length);return i.forEach((l,c)=>{let h=n.get(l);h===void 0&&(h=n.size,n.set(l,h)),s[c]=h}),s};return{old:r(e),new:r(t),alphabetSize:n.size}}function Ze(e,t,n,r){if(r===0)return;let o=e[e.length-1];if(o!==void 0&&o.oldStart+o.length===t&&o.newStart+o.length===n){o.length+=r;return}e.push({oldStart:t,newStart:n,length:r})}function bo(e,t,n,r,o,i,s){let l=0;for(;n+l<r&&o+l<i&&e[n+l]===t[o+l];)l++;Ze(s,n,o,l);let c=0;for(;r-c>n+l&&i-c>o+l&&e[r-1-c]===t[i-1-c];)c++;return{oldLow:n+l,oldHigh:r-c,newLow:o+l,newHigh:i-c,suffix:c}}function ls(e,t,n){let{oldLow:r,oldHigh:o,newLow:i,newHigh:s}=n,l=o-r,c=s-i,h=Math.ceil((l+c)/2),u=h,y=2*h+2,E=new Int32Array(y).fill(-1),A=new Int32Array(y).fill(-1);E[u+1]=0,A[u+1]=0;let b=l-c,O=b%2!==0,w=0,g=0,D=0,f=0;for(let _=0;_<h;_++){for(let T=-_+w;T<=_-g;T+=2){let R=u+T,x=T===-_||T!==_&&E[R-1]<E[R+1]?E[R+1]:E[R-1]+1,v=x-T;for(;x<l&&v<c&&e[r+x]===t[i+v];)x++,v++;if(E[R]=x,x>l)g+=2;else if(v>c)w+=2;else if(O){let U=u+b-T;if(U>=0&&U<y&&A[U]!==-1&&x>=l-A[U])return{kind:"split",oldSplit:r+x,newSplit:i+v}}}for(let T=-_+D;T<=_-f;T+=2){let R=u+T,x=T===-_||T!==_&&A[R-1]<A[R+1]?A[R+1]:A[R-1]+1,v=x-T;for(;x<l&&v<c&&e[o-1-x]===t[s-1-v];)x++,v++;if(A[R]=x,x>l)f+=2;else if(v>c)D+=2;else if(!O){let U=u+b-T;if(U>=0&&U<y&&E[U]!==-1){let C=E[U];if(C>=l-x)return{kind:"split",oldSplit:r+C,newSplit:i+u+C-U}}}}}return{kind:"disjoint"}}function ae(e,t){let n=[],r=[{kind:"region",oldLow:0,oldHigh:e.length,newLow:0,newHigh:t.length}];for(let o=r.pop();o!==void 0;o=r.pop()){if(o.kind==="run"){Ze(n,o.oldStart,o.newStart,o.length);continue}let i=bo(e,t,o.oldLow,o.oldHigh,o.newLow,o.newHigh,n);if(r.push({kind:"run",oldStart:i.oldHigh,newStart:i.newHigh,length:i.suffix}),i.oldLow===i.oldHigh||i.newLow===i.newHigh)continue;let s=ls(e,t,i);s.kind==="split"&&(r.push({kind:"region",oldLow:s.oldSplit,oldHigh:i.oldHigh,newLow:s.newSplit,newHigh:i.newHigh}),r.push({kind:"region",oldLow:i.oldLow,oldHigh:s.oldSplit,newLow:i.newLow,newHigh:s.newSplit}))}return n}function Co(e,t,n){let r=Math.ceil(t.length/32),o=new Array(n);t.forEach((l,c)=>{let h=o[l];h===void 0&&(h=new Uint32Array(r),o[l]=h),h[c>>>5]=(h[c>>>5]|1<<(c&31))>>>0});let i=new Uint32Array(r).fill(4294967295);for(let l of e){let c=o[l];if(c===void 0)continue;let h=0;for(let u=0;u<r;u++){let y=i[u],E=(y&c[u])>>>0,A=y+E+h;h=A>4294967295?1:0,i[u]=(A>>>0|y&~c[u])>>>0}}let s=0;for(let l=0;l<t.length;l++)s+=i[l>>>5]>>>(l&31)&1;return t.length-s}function cs(e,t,n){if(e.occurrences!==t.occurrences)return e.occurrences<t.occurrences;if(e.length!==t.length)return e.length>t.length;let r=Math.abs(2*e.oldStart+e.length-n),o=Math.abs(2*t.oldStart+t.length-n);return r!==o?r<o:e.newStart<t.newStart||e.newStart===t.newStart&&e.oldStart<t.oldStart}function _o(e,t){let{old:n,new:r,alphabetSize:o}=e,i=new Int32Array(o),s=new Int32Array(o),l=new Int32Array(o).fill(-1),c=new Int32Array(n.length),h=[],u=[{kind:"region",oldLow:0,oldHigh:n.length,newLow:0,newHigh:r.length}];for(let y=u.pop();y!==void 0;y=u.pop()){if(y.kind==="run"){Ze(h,y.oldStart,y.newStart,y.length);continue}let E=bo(n,r,y.oldLow,y.oldHigh,y.newLow,y.newHigh,h),A={kind:"run",oldStart:E.oldHigh,newStart:E.newHigh,length:E.suffix},{oldLow:b,oldHigh:O,newLow:w,newHigh:g}=E;if(b===O||w===g){u.push(A);continue}for(let R=O-1;R>=b;R--){let x=n[R];i[x]++,c[R]=l[x],l[x]=R}let D={best:null},f=R=>{(D.best===null||cs(R,D.best,b+O))&&(D.best=R)},_=new Map;for(let R=w;R<g;R++){let x=r[R],v=i[x];if(!(v===0||v>t.maxOccurrences||D.best!==null&&v>D.best.occurrences))for(let U=l[x];U!==-1;U=c[U]){let C=_.get(R-U);if(C!==void 0&&R>=C.newStart&&R<C.newEnd){v<C.occurrences&&(C.occurrences=v,f({occurrences:v,oldStart:C.oldStart,newStart:C.newStart,length:C.newEnd-C.newStart}));continue}let M=U,L=R;for(;M>b&&L>w&&n[M-1]===r[L-1];)M--,L--;let H=U-M+1;for(;M+H<O&&L+H<g&&n[M+H]===r[L+H];)H++;_.set(R-U,{oldStart:M,newStart:L,newEnd:L+H,occurrences:v}),f({occurrences:v,oldStart:M,newStart:L,length:H})}}let T=D.best;T!==null?(u.push(A),u.push({kind:"region",oldLow:T.oldStart+T.length,oldHigh:O,newLow:T.newStart+T.length,newHigh:g}),u.push({kind:"run",oldStart:T.oldStart,newStart:T.newStart,length:T.length}),u.push({kind:"region",oldLow:b,oldHigh:T.oldStart,newLow:w,newHigh:T.newStart})):(ds(n,r,E,i,s,t.cellBound,h),u.push(A));for(let R=b;R<O;R++){let x=n[R];i[x]=0,l[x]=-1}}return h}function ds(e,t,n,r,o,i,s){let{oldLow:l,oldHigh:c,newLow:h,newHigh:u}=n;if((c-l)*(u-h)>i)return;for(let b=h;b<u;b++)o[t[b]]++;let y=[];for(let b=l;b<c;b++)o[e[b]]>0&&y.push(b);let E=[];for(let b=h;b<u;b++)r[t[b]]>0&&E.push(b),o[t[b]]=0;let A=ae(Int32Array.from(y,b=>e[b]),Int32Array.from(E,b=>t[b]));for(let b of A)for(let O=0;O<b.length;O++)Ze(s,y[b.oldStart+O],E[b.newStart+O],1)}function Io(e,t,n){let r=[],o=0,i=0;for(let s of[...n,{oldStart:e,newStart:t,length:0}])(s.oldStart>o||s.newStart>i)&&r.push({oldStart:o,oldEnd:s.oldStart,newStart:i,newEnd:s.newStart}),o=s.oldStart+s.length,i=s.newStart+s.length;return r}function Xt(e,t,n,r){let o=new Map;for(let s of t){let l=r(s);l!==null&&o.set(l,[...o.get(l)??[],s])}let i=[];for(let s of e){let l=n(s),c=l===null?void 0:o.get(l)?.shift();c!==void 0&&i.push([s,c])}return i}function Ro(e,t){let n=new Map;for(let r of e){let o=t[r].clause;o!==null&&n.set(o,(n.get(o)??0)+1)}return n}var $=e=>e.flatMap((t,n)=>t===null?[n]:[]);function Wt(e,t){let n=e?.children??[],r=t?.children??[],o=oe(n.map(f=>f.hash),r.map(f=>f.hash)),i=n.map(()=>null),s=r.map(()=>null),l=[],c=n.map(()=>0),h=r.map(()=>0);for(let f of ae(o.old,o.new))for(let _=0;_<f.length;_++)i[f.oldStart+_]=f.newStart+_,s[f.newStart+_]=f.oldStart+_;let u=0;n.forEach((f,_)=>{c[_]=u,u+=i[_]===null?0:1}),u=0,r.forEach((f,_)=>{h[_]=u,s[_]!==null&&(l.push(_),u++)});let y=[],E=(f,_,T)=>{for(let[R,x]of f)i[R]=x,s[x]=R,y.push({entry:{kind:_,pairing:T,oldPosition:R,newPosition:x},order:[x,1,x]})},A=f=>n[f],b=f=>r[f];E(Xt($(i),$(s),f=>A(f).hash,f=>b(f).hash),"MOVED",null);let O=Ro($(i),n),w=Ro($(s),r),g=f=>f.clause!==null&&O.get(f.clause)===1&&w.get(f.clause)===1?f.clause:null;E(Xt($(i),$(s),f=>g(A(f)),f=>g(b(f))),"MODIFIED","clause"),E(Xt($(i),$(s),f=>JSON.stringify([c[f],A(f).breadcrumbs]),f=>JSON.stringify([h[f],b(f).breadcrumbs])),"MODIFIED","breadcrumbs");for(let f of $(i)){let _=c[f],T=_===0?0:l[_-1]+1;y.push({entry:{kind:"REMOVED",pairing:null,oldPosition:f,newPosition:null},order:[T,0,f]})}for(let f of $(s))y.push({entry:{kind:"ADDED",pairing:null,oldPosition:null,newPosition:f},order:[f,1,f]});y.sort((f,_)=>f.order[0]-_.order[0]||f.order[1]-_.order[1]||f.order[2]-_.order[2]);let D=f=>y.filter(({entry:_})=>_.kind===f).length;return{entries:y.map(({entry:f})=>f),stats:{added:D("ADDED"),removed:D("REMOVED"),modified:D("MODIFIED"),moved:D("MOVED"),unchanged:l.length}}}var Qe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),me=(e,t)=>`${e}/${String(t).replace(/~/g,"~0").replace(/\//g,"~1")}`;function Zt(e,t,n,r,o){j(t)!==j(n)&&(Qe(t)&&Qe(n)?us(e,t,n,r,o):Array.isArray(t)&&Array.isArray(n)?ps(e,t,n,r,o):r.push({op:"replace",path:e,value:n,previous:t}))}function us(e,t,n,r,o){let i=[...new Set([...Object.keys(t),...Object.keys(n)])].sort(Y);for(let s of i){let l=me(e,s);Object.hasOwn(n,s)?Object.hasOwn(t,s)?Zt(l,t[s],n[s],r,o):r.push({op:"add",path:l,value:n[s]}):r.push({op:"remove",path:l,previous:t[s]})}}function ps(e,t,n,r,o){let i=oe(t.map(j),n.map(j)),s=0;for(;s<t.length&&s<n.length&&i.old[s]===i.new[s];)s++;let l=0;for(;l<t.length-s&&l<n.length-s&&i.old[t.length-1-l]===i.new[n.length-1-l];)l++;let c=(t.length-s-l)*(n.length-s-l);if(c>o.remaining){r.push({op:"replace",path:e,value:n,previous:t});return}o.remaining-=c;let h=0,u=0,y=0;for(let E of[...ae(i.old,i.new),{oldStart:t.length,newStart:n.length,length:0}]){let A=t.slice(u,E.oldStart),b=n.slice(y,E.newStart),O=Math.min(A.length,b.length);for(let w=0;w<O;w++){let g=A[w],D=b[w];Qe(g)&&Qe(D)||Array.isArray(g)&&Array.isArray(D)?Zt(me(e,h),g,D,r,o):(r.push({op:"remove",path:me(e,h),previous:g}),r.push({op:"add",path:me(e,h),value:D})),h++}for(let w of A.slice(O))r.push({op:"remove",path:me(e,h),previous:w});for(let w of b.slice(O))r.push({op:"add",path:me(e,h),value:w}),h++;h+=E.length,u=E.oldStart+E.length,y=E.newStart+E.length}}function Qt(e,t){let n=[];return Zt("",e,t,n,{remaining:kt}),n}function xo(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!="object"||n===null||Array.isArray(n))continue;let{start:r,end:o,page_number:i}=n;Number.isInteger(r)&&Number.isInteger(o)&&Number.isInteger(i)&&t.push({start:r,end:o,pageNumber:i})}return t.sort((n,r)=>n.start-r.start)}function en(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i].start<=t?n=i+1:r=i}let o=e[n-1];return o!==void 0&&t<o.end?o.pageNumber:null}function Ao(e){let t=[],n=[],r={LF:0,CRLF:0,CR:0},o=0,i=0,s=0;for(let u=0;u<e.length;){let y=e.charCodeAt(u);if(y===10||y===13){t.push(e.slice(o,u)),n.push(s);let E=y===13&&e.charCodeAt(u+1)===10?2:1;r[E===2?"CRLF":y===13?"CR":"LF"]++,u+=E,i+=E,o=u,s=i;continue}u+=y>=55296&&y<=56319&&(e.charCodeAt(u+1)&64512)===56320?2:1,i++}o<e.length&&(t.push(e.slice(o)),n.push(s));let l=r.LF+r.CRLF+r.CR,c=["LF","CRLF","CR"].filter(u=>r[u]>0),h=l===0?"NONE":c.length===1?c[0]:"MIXED";return{lines:t,starts:n,lineEnding:h,finalNewline:l>0&&o===e.length}}var To=null;function No(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>767)return!1;return!0}function rn(e){return No(e)?e.split(""):(To??=new Intl.Segmenter("und",{granularity:"grapheme"}),Array.from(To.segment(e),t=>t.segment))}function tn(e){return No(e)?e.length:rn(e).length}function ms(e,t,n){let r=e.length+t.length;if(n.exhausted||e.length>Ge||t.length>Ge||r===0)return null;let o=oe(e,t),i=Co(o.old,o.new,o.alphabetSize);if(2*i/r<Be||r-2*i>Pt)return null;let s=r*(r-2*i);if(s>n.remaining)return n.exhausted=!0,null;n.remaining-=s;let l=ae(o.old,o.new),c=[],h=0,u=0;for(let g of[...l,{oldStart:e.length,newStart:t.length,length:0}])(g.oldStart>h||g.newStart>u)&&c.push({equal:!1,oldStart:h,oldEnd:g.oldStart,newStart:u,newEnd:g.newStart}),g.length>0&&c.push({equal:!0,oldStart:g.oldStart,oldEnd:g.oldStart+g.length,newStart:g.newStart,newEnd:g.newStart+g.length}),h=g.oldStart+g.length,u=g.newStart+g.length;let y=[];c.forEach((g,D)=>{let f=y[y.length-1],_=f!==void 0&&!f.equal,T=g.equal&&g.oldEnd-g.oldStart<=1&&_&&D+1<c.length;if(_&&(T||!g.equal)){f.oldEnd=g.oldEnd,f.newEnd=g.newEnd;return}y.push({...g})});let E=0,A=0,b=0,O=[],w=[];for(let g of y){let D=e.slice(g.oldStart,g.oldEnd).join(""),f=t.slice(g.newStart,g.newEnd).join("");if(g.equal){E+=g.oldEnd-g.oldStart,O.push({kind:"equal",text:D}),w.push({kind:"equal",text:f});continue}A+=g.oldEnd-g.oldStart,b+=g.newEnd-g.newStart,D!==""&&O.push({kind:"removed",text:D}),f!==""&&w.push({kind:"added",text:f})}return 2*E/r<Be?null:{oldSegments:O,newSegments:w,removed:A,added:b}}var Do={old:[],new:[]};function Ae(e){return e.filter(([,t,n])=>j(t)!==j(n)).map(([t,n,r])=>({field:t,before:n,after:r}))}var nn=(e,t)=>t===""?[]:[{kind:e,text:t}];function fs(e,t,n){let r=[],o=(l,c)=>({kind:"context",oldNumber:l+1,newNumber:c+1,page:en(n.pages.new,n.newText.starts[c]),segments:nn("equal",n.newText.lines[c])}),i=t.oldStart,s=t.newStart;for(let l of e){for(;i<l.oldStart;i++,s++)r.push(o(i,s));for(let c=l.oldStart;c<l.oldEnd;c++){let h=n.oldText.lines[c];r.push({kind:"removed",oldNumber:c+1,newNumber:null,page:en(n.pages.old,n.oldText.starts[c]),segments:n.removedSegments.get(c)??nn("removed",h)})}for(let c=l.newStart;c<l.newEnd;c++){let h=n.newText.lines[c];r.push({kind:"added",oldNumber:null,newNumber:c+1,page:en(n.pages.new,n.newText.starts[c]),segments:n.addedSegments.get(c)??nn("added",h)})}i=l.oldEnd,s=l.newEnd}for(;i<t.oldEnd;i++,s++)r.push(o(i,s));return r}function on(e,t,n,r){let o=Ao(e??""),i=Ao(t??""),s=Ae([["present",e!==null,t!==null],["lineEnding",o.lineEnding,i.lineEnding],["finalNewline",o.finalNewline,i.finalNewline]]),l=_o(oe(o.lines,i.lines),{maxOccurrences:Dt,cellBound:Ot}),c=Io(o.lines.length,i.lines.length,l),h=new Map,u=new Map,y={remaining:wt,exhausted:!1},E=0,A=0,b=0,O=0,w=0,g=0;for(let C of c){b+=C.oldEnd-C.oldStart,O+=C.newEnd-C.newStart;let M=Math.min(C.oldEnd-C.oldStart,C.newEnd-C.newStart);for(let L=0;C.oldStart+L<C.oldEnd||C.newStart+L<C.newEnd;L++){let H=C.oldStart+L,G=C.newStart+L;if(L>=M){let ye=H<C.oldEnd?tn(o.lines[H]):0,se=G<C.newEnd?tn(i.lines[G]):0;w+=ye,g+=se,E+=ye,A+=se;continue}let q=rn(o.lines[H]),Z=rn(i.lines[G]);w+=q.length,g+=Z.length;let Q=ms(q,Z,y);if(Q!==null){h.set(H,Q.oldSegments),u.set(G,Q.newSegments),E+=Q.removed,A+=Q.added;continue}E+=q.length,A+=Z.length}}let D=0;for(let C of l)for(let M=C.oldStart;M<C.oldStart+C.length;M++)D+=tn(o.lines[M]);let f=D+w,_=D+g,T={linesAdded:O,linesRemoved:b,linesUnchanged:o.lines.length-b,charsAdded:A,charsRemoved:E,similarity:f+_===0?null:2*(f-E)/(f+_)},R=r==="whole"?Math.max(o.lines.length,i.lines.length):r,x=[];for(let C of c){let M=x[x.length-1],L=M?.[M.length-1];M!==void 0&&L!==void 0&&C.oldStart-L.oldEnd<=2*R?M.push(C):x.push([C])}let v={oldText:o,newText:i,pages:n,removedSegments:h,addedSegments:u},U=x.map((C,M)=>{let L=C[0],H=C[C.length-1],G=Math.max(0,L.oldStart-R),q=L.newStart-(L.oldStart-G),Z=Math.min(o.lines.length,H.oldEnd+R),Q=H.newEnd+(Z-H.oldEnd),ye=fs(C,{oldStart:G,oldEnd:Z,newStart:q},v);return{hunk:M,oldStart:Z>G?G+1:G,oldLines:Z-G,newStart:Q>q?q+1:q,newLines:Q-q,firstPage:ye[0].page,linesAdded:C.reduce((se,ge)=>se+ge.newEnd-ge.newStart,0),linesRemoved:C.reduce((se,ge)=>se+ge.oldEnd-ge.oldStart,0),lines:ye}});return{attributes:s,stats:T,hunks:U}}function Te(e,t){let n=on(e.body,t.body,{old:xo(e.pageOffsets),new:xo(t.pageOffsets)},Ke),r=Ae([["mime",e.mime,t.mime],["source",e.source,t.source],["isTruncated",e.isTruncated,t.isTruncated],["pageOffsets",e.pageOffsets,t.pageOffsets]]);return{...n,attributes:[...r,...n.attributes]}}function Ne(e,t){return on(e,t,Do,Ke)}function Oo(e,t){return on(e,t,Do,"whole")}function De(e){return{attributes:[...e.attributes],stats:e.stats,hunks:e.hunks.map(({lines:t,...n})=>n)}}function Po(e,t,n,r){let o=Number.isInteger(t)&&t>=0?e.hunks[t]:void 0;if(o===void 0)throw new RangeError(`The diff has no hunk ${t}.`);if(!Number.isInteger(n)||n<0||n>=o.lines.length)throw new RangeError(`Hunk ${t} has no line at offset ${n}.`);if(!jt.safeParse(r).success)throw new RangeError(`A line page holds 1 to the page maximum lines, not ${r}.`);let i=Math.min(n+r,o.lines.length);return{lines:o.lines.slice(n,i),next:i<o.lines.length?i:null}}function et(e,t,n){let r=[...e].sort(t);for(let o=1;o<r.length;o++)if(t(r[o-1],r[o])===0)throw new RangeError(`A facet set holds the key ${JSON.stringify(n(r[o]))} more than once.`);return r}function wo(e,t,n,r){let o=0,i=0;for(;o<e.length||i<t.length;){let s=e[o],l=t[i],c=s===void 0?1:l===void 0?-1:n(s,l);r(c<=0?s:null,c>=0?l:null),o+=c<=0?1:0,i+=c>=0?1:0}}function an(e,t){let n=[],r=[],o=0;return wo(et(e??[],Y,String),et(t??[],Y,String),Y,(i,s)=>{i!==null&&s!==null?o++:i!==null?r.push(i):n.push(s)}),{added:n,removed:r,unchangedCount:o}}function ko(e,t,n){let r=[],o=[],i=[],s=0;return wo(et(e,n.compare,n.keyOf),et(t,n.compare,n.keyOf),n.compare,(l,c)=>{if(l===null){r.push({key:n.keyOf(c),value:{...c}});return}if(c===null){o.push({key:n.keyOf(l),value:{...l}});return}let h=new Map(n.fieldsOf(c)),u=Ae(n.fieldsOf(l).map(([y,E])=>[y,E,h.get(y)]));u.length===0?s++:i.push({key:n.keyOf(l),fields:u})}),{added:r,removed:o,modified:i,unchangedCount:s}}var hs={compare:(e,t)=>Y(e.labelKey,t.labelKey),keyOf:e=>e.labelKey,fieldsOf:e=>[["assignedBy",e.assignedBy],["confidenceScore",e.confidenceScore]]},ys={compare:Ve,keyOf:ee,fieldsOf:e=>[["mimeType",e.mimeType],["fileSize",e.fileSize],["textSha256",e.textSha256]]},sn=(e,t)=>ko(e,t,hs),ln=(e,t)=>ko(e,t,ys);function Oe(e,t,n){return Ae(n.map(r=>[r,e[r],t[r]]))}var vo=["confidentialityLevel","departmentId","folderPath","createdBy"],Mo=["fileName","filePath","fileId","revision","revisionId","fileSize","mimeType","fileHash","mtime"],ie=(e,t)=>({facet:e,addedCount:null,removedCount:null,modifiedCount:null,movedCount:null,unchangedCount:null,charsAdded:null,charsRemoved:null,...t}),Fo=(e,t)=>ie(e,{addedCount:t.stats.linesAdded,removedCount:t.stats.linesRemoved,unchangedCount:t.stats.linesUnchanged,charsAdded:t.stats.charsAdded,charsRemoved:t.stats.charsRemoved});function gs(e){switch(e.facet){case"classification":return ie("classification",{modifiedCount:Oe(e.from,e.to,vo).length});case"metadata":return ie("metadata",{modifiedCount:Oe(e.from,e.to,Mo).length});case"labels":case"assets":{let t=e.facet==="labels"?sn(e.from,e.to):ln(e.from,e.to);return ie(e.facet,{addedCount:t.added.length,removedCount:t.removed.length,modifiedCount:t.modified.length,unchangedCount:t.unchangedCount})}case"tags":{let t=an(e.from,e.to);return ie("tags",{addedCount:t.added.length,removedCount:t.removed.length,unchangedCount:t.unchangedCount})}case"structured_data":{let t=Qt(e.from,e.to),n=r=>t.filter(o=>o.op===r).length;return ie("structured_data",{addedCount:n("add"),removedCount:n("remove"),modifiedCount:n("replace")})}case"text":return Fo("text",Te(e.from,e.to));case"summary":return Fo("summary",Ne(e.from,e.to));case"chunks":{let{stats:t}=Wt(e.from,e.to);return ie("chunks",{addedCount:t.added,removedCount:t.removed,modifiedCount:t.modified,movedCount:t.moved,unchangedCount:t.unchanged})}}}function Uo(e){if(e.length===0)throw new RangeError("A change has at least one changed facet.");let t=new Set;for(let n of e){if(t.has(n.facet))throw new RangeError(`The ${n.facet} facet is given twice.`);if(t.add(n.facet),j(n.from)===j(n.to))throw new RangeError(`The ${n.facet} facet has equal values on both sides, so it did not change.`)}return[...e].sort((n,r)=>Je(n.facet,r.facet)).map(gs)}var Ss=(e,t)=>({index:e.index,charStart:e.charStart,charEnd:e.charEnd,page:e.page,sheet:e.sheet,slide:e.slide,startSec:e.startSec,endSec:e.endSec,breadcrumbs:e.breadcrumbs,tokenCount:e.tokenCount,fidelity:t});function Lo(e,t){let n=e.facets.chunks?.children.length??0;if(e.chunkFidelities.length!==n)throw new RangeError(`The ${t} state has ${n} child chunks but ${e.chunkFidelities.length} fidelity checks.`)}function Es(e,t,n){let r=t.facets,o=n.facets;if(j(r[e])===j(o[e]))return{facet:e,change:"UNCHANGED"};switch(e){case"classification":return{facet:e,change:"CHANGED",fields:Oe(r.classification,o.classification,vo)};case"metadata":return{facet:e,change:"CHANGED",fields:Oe(r.metadata,o.metadata,Mo)};case"labels":case"assets":{let i=e==="labels"?sn(r.labels,o.labels):ln(r.assets,o.assets);return{facet:e,change:"CHANGED",added:[...i.added],removed:[...i.removed],modified:[...i.modified],unchangedCount:i.unchangedCount}}case"tags":{let i=an(r.tags,o.tags);return{facet:e,change:"CHANGED",added:[...i.added],removed:[...i.removed],unchangedCount:i.unchangedCount}}case"structured_data":return{facet:e,change:"CHANGED",operations:Qt(r.structured_data,o.structured_data)};case"text":return{facet:e,change:"CHANGED",...De(Te(r.text,o.text))};case"summary":return{facet:e,change:"CHANGED",...De(Ne(r.summary,o.summary))};case"chunks":{let i=Wt(r.chunks,o.chunks),s=r.chunks?.children??[],l=o.chunks?.children??[],c=(h,u,y)=>y===null?null:Ss(h[y],u[y]);return{facet:e,change:"CHANGED",stats:i.stats,entries:i.entries.map((h,u)=>({entry:u,kind:h.kind,pairing:h.pairing,old:c(s,t.chunkFidelities,h.oldPosition),new:c(l,n.chunkFidelities,h.newPosition)})),textUnchangedChunkingChanged:r.text.body===o.text.body}}}}function zo(e,t){return Lo(e,"from"),Lo(t,"to"),{diffEngineVersion:Nt,facets:re.map(n=>Es(n,e,t))}}var k=require("zod"),jo=["caller_google_token","caller_identity","deployment"],Ho=["describe","name_children"],cn="su",tt=k.z.object({ja:k.z.string().regex(/\S/),en:k.z.string().regex(/\S/)}).strict();function Ko(e){try{return new RegExp(`^(?:${e})$`,cn)}catch{return null}}function Go(e){try{return new RegExp(e,cn)}catch{return null}}function bs(e){let t=new RegExp(`${e}|`,cn).exec("");return t===null?0:t.length-1}var Bo=k.z.object({scheme:k.z.string().regex(/^[a-z][a-z0-9+.-]{0,31}$/),title:tt,description:tt,uri_prefix:k.z.string(),input_pattern:k.z.string(),input_example:k.z.string(),input_hint:tt,guidance:tt,paste_patterns:k.z.array(k.z.string()),credential:k.z.enum(jo),capabilities:k.z.array(k.z.enum(Ho)),delivered_mime_type:k.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{e.uri_prefix.startsWith(`${e.scheme}://`)||t.addIssue({code:k.z.ZodIssueCode.custom,path:["uri_prefix"],message:`The URI prefix does not start with ${e.scheme}://.`});let n=Ko(e.input_pattern);n===null?t.addIssue({code:k.z.ZodIssueCode.custom,path:["input_pattern"],message:"The input pattern does not compile with the s and u flags."}):n.test(e.input_example)||t.addIssue({code:k.z.ZodIssueCode.custom,path:["input_example"],message:"The input example does not fully match the input pattern."}),e.paste_patterns.forEach((r,o)=>{Go(r)===null?t.addIssue({code:k.z.ZodIssueCode.custom,path:["paste_patterns",o],message:"The paste pattern does not compile with the s and u flags."}):bs(r)!==1&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["paste_patterns",o],message:"A paste pattern has exactly one capturing group, the identifier."})}),new Set(e.capabilities).size!==e.capabilities.length&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["capabilities"],message:"A capability is declared twice."})}),Cs=k.z.object({sources:k.z.array(Bo)}).strict().superRefine((e,t)=>{let n=e.sources.map(r=>r.scheme);new Set(n).size!==n.length&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["sources"],message:"A scheme is registered twice."})});function _s(e,t){let n=t.trim();return[...e].sort((r,o)=>o.uri_prefix.length-r.uri_prefix.length).find(r=>n.startsWith(r.uri_prefix))}function Is(e,t){return Ko(e.input_pattern)?.test(t)??!1}function Rs(e,t){for(let n of e)for(let r of n.paste_patterns){let o=Go(r)?.exec(t)?.[1];if(o!==void 0)return{source:n,identifier:o}}}var dn=[{key:"enable_summary_generation",featureFlagKey:null,label:"\u8981\u7D04\u751F\u6210",readByPipeline:!1},{key:"enable_structured_extraction",featureFlagKey:null,label:"\u69CB\u9020\u5316\u62BD\u51FA",readByPipeline:!1},{key:"enable_asset_extraction",featureFlagKey:"ENABLE_ASSET_EXTRACTION",label:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA",readByPipeline:!1},{key:"enable_vector_indexing",featureFlagKey:"ENABLE_VECTOR_INDEXING",label:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15",readByPipeline:!0},{key:"enable_graph_indexing",featureFlagKey:"ENABLE_GRAPH_INDEXING",label:"\u30B0\u30E9\u30D5\u6295\u5F71",readByPipeline:!0}],xs=new Set(dn.map(e=>e.key));function As(e){return xs.has(e)}function Ts(e){let t=dn.find(n=>n.key===e);if(t===void 0)throw new Error(`ENRICHMENT_STAGES does not carry ${e}; the canonical list and the key type have drifted apart.`);return t}var Ns={pageSize:{min:1,max:200,default:50},topologyLabels:{min:1,max:24,default:24}};var F=require("zod");var Vo=["zip","pdf","ooxml","legacy_office"],Ds=F.z.enum(Vo),un=["zipcrypto","aes","pdf_user_password","pdf_owner_password","office_encryption"],Os=F.z.enum(un),Jo=[...un,"strong_encryption"],Ps=F.z.enum(Jo),ws=Object.freeze({zipcrypto:"ZIP \u306E\u6697\u53F7 (ZipCrypto)",aes:"ZIP \u306E\u6697\u53F7 (AES)",pdf_user_password:"PDF \u306E\u958B\u304F\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9",pdf_owner_password:"PDF \u306E\u5236\u9650\u306E\u30D1\u30B9\u30EF\u30FC\u30C9",office_encryption:"Office \u306E\u6697\u53F7",strong_encryption:"ZIP \u306E\u5F37\u3044\u6697\u53F7 (\u5916\u305B\u306A\u3044)"}),Yo=["source_overwritten","copy_original","copy_promoted","child_decrypted"],ks=F.z.enum(Yo),Fs=Object.freeze({source_overwritten:"\u6E90\u3092\u89E3\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3067\u4E0A\u66F8\u304D\u3057\u305F",copy_original:"\u89E3\u3044\u305F\u5199\u3057\u3092\u539F\u672C\u306B\u3057\u3066\u3044\u308B",copy_promoted:"\u89E3\u3044\u305F\u5199\u3057\u3067\u6E90\u3092\u4E0A\u66F8\u304D\u3057\u305F (\u6607\u683C)",child_decrypted:"\u5B50\u306E\u7269\u3092\u89E3\u3044\u305F\u4E2D\u8EAB\u306B\u3057\u305F"}),$o=["permission_denied","immutable_source","foreign_application","local_source"],Ls=F.z.enum($o),vs=Object.freeze({permission_denied:"\u6E90\u3078\u66F8\u304F\u6A29\u9650\u304C\u7121\u3044",immutable_source:"\u30E1\u30FC\u30EB\u306F\u5909\u3048\u3089\u308C\u306A\u3044",foreign_application:"\u5225\u306E\u30A2\u30D7\u30EA (\u65E5\u5831) \u306E\u7269",local_source:"\u30DB\u30B9\u30C8\u306E\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB"}),Ms=e=>e==="permission_denied",Us=Object.freeze({passwordRequired:4225,protectionUnsupported:4226,sourceChanged:4094}),qo=["gmail","gdrive","gcs","file","daily-report"],zs=Object.freeze({gmail:"Gmail",gdrive:"Google \u30C9\u30E9\u30A4\u30D6",gcs:"Cloud Storage",file:"\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB","daily-report":"\u65E5\u5831"}),Xo=["glob","regex"],js=Object.freeze({glob:"\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9 (* \u3068 ?)",regex:"\u6B63\u898F\u8868\u73FE"}),fe=Object.freeze({label:200,sender:320,subject:400,file_name:400,uri_prefix:2048}),Hs=995,Wo=2147483647,Ks=e=>new TextEncoder().encode(e).length,Zo=e=>e.length,Qo=e=>F.z.string().min(1).refine(t=>Zo(t)<=e,{message:`Wider than the ${e} UTF-16 code units its column holds`}),nt=e=>Qo(e).nullable(),ea=F.z.object({sender:nt(fe.sender),subject:nt(fe.subject),file_name:nt(fe.file_name),uri_prefix:nt(fe.uri_prefix),source_kind:F.z.enum(qo).nullable(),syntax:F.z.enum(Xo)}),Gs=e=>e.sender===null&&e.subject===null&&e.file_name===null&&e.uri_prefix===null&&e.source_kind===null,pn=F.z.object({password_id:F.z.number().int().positive(),label:Qo(fe.label),conditions:ea,priority:F.z.number().int().nonnegative().max(Wo),is_active:F.z.boolean(),use_count:F.z.number().int().nonnegative(),last_used_at:N.nullable(),created_by:F.z.string().min(1),created_at:N,updated_by:F.z.string().min(1),updated_at:N}),Bs=F.z.object({passwords:F.z.array(pn)}),Vs=F.z.object({passwords:F.z.array(pn),timed_out:F.z.array(F.z.number().int().positive())});var he=-1,W=0;function ta(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Js(){let e=typeof globalThis<"u"&&globalThis.crypto?globalThis.crypto:typeof crypto<"u"?crypto:void 0;if(!e||typeof e.getRandomValues!="function")throw new Error("Cryptographically secure random number generator (crypto.getRandomValues) is required but not available.");let t=new Uint8Array(16);e.getRandomValues(t);let n=Date.now();if(n===he){if(W++,W>4095){for(;Date.now()<=he;);n=Date.now(),he=n,W=(t[6]<<4|t[7]&15)&1023}}else n>he?(he=n,W=(t[6]<<4|t[7]&15)&1023):(n=he,W++,W>4095&&(W=0));t[0]=Math.floor(n/1099511627776)&255,t[1]=Math.floor(n/4294967296)&255,t[2]=n>>>24&255,t[3]=n>>>16&255,t[4]=n>>>8&255,t[5]=n&255,t[6]=112|W>>>8&15,t[7]=W&255,t[8]=128|t[8]&63;let r=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Ys(e){if(!ta(e))throw new Error(`Invalid RFC 9562 UUIDv7 string: "${e}"`);let t=e.slice(0,8)+e.slice(9,13),n=parseInt(t,16);if(Number.isNaN(n))throw new Error(`Invalid hex timestamp in UUIDv7: "${t}"`);return new Date(n)}0&&(module.exports={AmountEntrySchema,AssetFacetItemSchema,BaseEnrichmentClient,BodySourceSchema,BoundingBoxSchema,CHILD_TREE_REBUILD_CHUNK,CHUNK_BODY_FIDELITIES,CHUNK_CHANGE_KINDS,CHUNK_MANIFEST_VERSION,CHUNK_PAIRINGS,CIRCUIT_BREAKER_SERVICES,COPY_REASONS,COPY_REASON_LABELS,CanonicalDomainKeySchema,ChangeFeedCursorSchema,ChapterSegmentSchema,ChildTreeRebuildRequestSchema,ChildTreeRebuildResultSchema,ChunkBodyFidelitySchema,ChunkChangeKindSchema,ChunkChangeSchema,ChunkManifestChildSchema,ChunkManifestParentSchema,ChunkManifestSchema,ChunkPairingSchema,ChunkRefSchema,ChunkStatsSchema,ChunkingStrategySchema,CircuitBreakerStatusSchema,ClassificationFacetSchema,ConfidentialityLevelSchema,CopyReasonSchema,DIFF_CONTEXT_LINES,DIFF_ENGINE_VERSION,DIFF_LINE_FACETS,DIFF_LINE_PAGE_MAX,DIFF_REGION_CELL_BOUND,DOCUMENT_CAPTURE_OUTCOMES,DOCUMENT_CHANGE_FEED_PAGE_MAX,DOCUMENT_CHANGE_FEED_PAGE_SIZE,DOCUMENT_FACETS,DOCUMENT_KINDS,DOCUMENT_KIND_LABELS,DOCUMENT_STATE_CAUSES,DOCUMENT_STATE_LOCK_TIMEOUT_MS,DOCUMENT_STATE_RUN_OUTCOMES,DiffLineFacetSchema,DiffLinePageLimitSchema,DiffLinePageSchema,DiffLineSchema,DiffSegmentSchema,DocumentCaptureAnswerSchema,DocumentCaptureOutcomeSchema,DocumentChangeFeedEntrySchema,DocumentChangeFeedLimitSchema,DocumentChangeFeedPageSchema,DocumentChangeFeedRowSchema,DocumentComparisonSchema,DocumentFacetSchema,DocumentFacetValuesSchema,DocumentHistorySchema,DocumentKindSchema,DocumentRunEntrySchema,DocumentStateCauseSchema,DocumentStateEntrySchema,DocumentStateRunOutcomeSchema,DocumentStateSummarySchema,DocumentStructuredDataSchema,ENRICHMENT_STAGES,EnrichmentClient,EnrichmentClientError,EnrichmentSyncStatusSchema,FACET_APPLICABLE_COUNTS,FACET_COUNT_FIELDS,FILE_PASSWORD_FIELD_WIDTHS,FILE_PASSWORD_MAX_BYTES,FILE_PASSWORD_PATTERN_SYNTAXES,FILE_PASSWORD_PATTERN_SYNTAX_LABELS,FILE_PASSWORD_PRIORITY_MAX,FILE_PASSWORD_SOURCE_KINDS,FILE_PASSWORD_SOURCE_KIND_LABELS,FILTERABLE_CONFIDENTIALITY_LEVELS,FacetChangeCountsSchema,FacetDiffSchema,FieldChangeSchema,FilePasswordConditionsSchema,FilePasswordListSchema,FilePasswordMatchSchema,FilePasswordViewSchema,FileUriSchema,GRAPH_INDEX_LIMITS,GraphSearchHitSchema,HISTOGRAM_MAX_OCCURRENCES,HunkIndexEntrySchema,INGESTION_EVENT_NAMES,INLINE_REFINE_CELL_BUDGET,INLINE_REFINE_MAX_EDIT_DISTANCE,INLINE_REFINE_MAX_GRAPHEMES,INLINE_REFINE_MIN_SIMILARITY,INTEGRITY_CLASS_POLICY,INTEGRITY_COMMAND_CODES,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX,IntegrityActiveRunSchema,IntegrityAuditOverviewSchema,IntegrityCancelFailureCodeSchema,IntegrityCellResyncRequestSchema,IntegrityCellResyncResultSchema,IntegrityCommandFailureCodeSchema,IntegrityCommandFailureSchema,IntegrityCommandReplySchema,IntegrityCommandSchema,IntegrityDispositionSchema,IntegrityFindingItemClassSchema,IntegrityFindingPageSchema,IntegrityFindingSchema,IntegrityFindingsQuerySchema,IntegrityItemClassSchema,IntegrityPhaseSchema,IntegrityPlacementObservedSchema,IntegrityQuantitySchema,IntegrityRepairActionSchema,IntegrityRepairOutcomeSchema,IntegrityRepairSkipReasonSchema,IntegrityRunHeaderSchema,IntegrityRunModeSchema,IntegrityRunStatusSchema,IntegrityScopeRoleSchema,IntegrityStartFailureCodeSchema,IntegrityStoreSchema,IntegrityUnitSchema,IntegrityVerdictSchema,JsonPatchOperationSchema,JsonValueSchema,KeyedItemChangeSchema,KeyedItemSchema,LEDGER_STEP_KEYS,LINE_ENDINGS,LabelFacetItemSchema,LedgerStepKeySchema,LineEndingSchema,MIME_KIND_RULES,MODE_TIERS,MetadataFacetSchema,ModelProviderSchema,NOTHING_TO_READ_TOKENS,NothingToReadTokenSchema,PIPELINE_FAILURE_STATUSES,PIPELINE_FLOWS,PIPELINE_PHASES,PIPELINE_STEPS,PIPELINE_STEP_KEYS,PROTECTION_FORMATS,PROTECTION_SCHEMES,PROTECTION_SCHEME_LABELS,PipelineFailureStatusSchema,PipelineRunRecordSchema,PipelineRunStatusSchema,PipelineRunSummarySchema,PipelineStepKeySchema,PipelineStepMetricSchema,PipelineStepRecordSchema,PipelineStepStatusSchema,PipelineTriggerSchema,ProtectionFormatSchema,ProtectionSchemeSchema,QUARANTINED_CONFIDENTIALITY_LEVEL,REMOVABLE_PROTECTION_SCHEMES,RESTRICTED_MARK_SUBJECTS,RUN_TERMINAL_STEP_ERROR_CODES,RUN_TERMINAL_STEP_KEY,RUN_TERMINAL_STEP_OUTCOMES,ReadableConfidentialityLevelSchema,RecentPipelineRunEntrySchema,RemovableProtectionSchemeSchema,RestrictedChangeMarkSchema,RestrictedFailureMarkSchema,RestrictedIngestMarkSchema,RestrictedMarkSubjectSchema,RestrictedRunMarkSchema,RestrictedStateMarkSchema,RunTerminalStepDetailSchema,RunTerminalStepErrorCodeSchema,RunTerminalStepOutcomeSchema,SEARCH_DEGRADATION_REASONS,SEARCH_FUSIONS,SEARCH_MODES,SEARCH_PARAM_LIMITS,SEARCH_QUALITY_TIERS,SOURCE_CAPABILITIES,SOURCE_CREDENTIALS,STALE_RUN_ERROR_CODE,STRUCTURED_DATA_ARRAY_CELL_BOUND,SYSTEM_PARAMETER_RANGES,SearchHitSchema,SearchMetadataSchema,SearchModeSchema,SearchRequestSchema,SearchResponseSchema,SourceCatalogSchema,SourceSpecSchema,StageProvenanceSchema,TREE_PATH_PATTERN,TenantIdSchema,TextDiffIndexSchema,TextFacetSchema,TextStatsSchema,TranscriptSegmentSchema,TreePathSchema,UNLOCK_DISPOSITIONS,UNLOCK_DISPOSITION_LABELS,UNLOCK_ERROR_CODES,UnlockDispositionSchema,assertBoundedSystemParameter,assertSystemParameterInRange,assetTypeName,canonicalJson,classifyDocumentKind,codePointSlicer,compareAssetKeys,compareCodeUnits,compareFacets,comparePhases,compareStates,compareTreePaths,decodeChangeFeedCursor,diffChunkBodies,diffLinePage,encodeChangeFeedCursor,enrichmentStage,flowFor,flowStepGates,formatSkipReason,generateUuidV7,identifierMatches,integrityCommandFailureCodeOf,isEnrichmentStageKey,isPromotable,isStrictlyEarlier,isUnknownTerm,isValidUuidV7,millisecondsBetween,modeFusesRankings,modeScoreIsSimilarity,orderedSteps,parseSkipReason,passwordByteLength,pastedIdentifier,readableEntrySchema,sourceOfUri,storedTermOf,storedTermSchema,storedTermText,storedWidth,stripWhitespace,summarizeTransition,summaryFacetDiff,textDiffIndex,textFacetDiff,treePathDepth,treePathLabel,treePathOf,treePathParent,treePathSegments,triesEveryFile,uuidv7ToDate});
|
|
1
|
+
"use strict";var rt=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var ra=Object.getOwnPropertyNames;var oa=Object.prototype.hasOwnProperty;var aa=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},ia=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ra(t))!oa.call(e,o)&&o!==n&&rt(e,o,{get:()=>t[o],enumerable:!(r=na(t,o))||r.enumerable});return e};var sa=e=>ia(rt({},"__esModule",{value:!0}),e);var $s={};aa($s,{AmountEntrySchema:()=>In,AssetFacetItemSchema:()=>zt,BaseEnrichmentClient:()=>be,BodySourceSchema:()=>ze,BoundingBoxSchema:()=>Aa,CHILD_TREE_REBUILD_CHUNK:()=>gn,CHUNK_BODY_FIDELITIES:()=>cr,CHUNK_CHANGE_KINDS:()=>ar,CHUNK_MANIFEST_VERSION:()=>tr,CHUNK_PAIRINGS:()=>sr,CIRCUIT_BREAKER_SERVICES:()=>_a,COPY_REASONS:()=>$o,COPY_REASON_LABELS:()=>vs,CanonicalDomainKeySchema:()=>Tn,ChangeFeedCursorSchema:()=>Kt,ChapterSegmentSchema:()=>_n,ChildTreeRebuildRequestSchema:()=>fa,ChildTreeRebuildResultSchema:()=>ya,ChunkBodyFidelitySchema:()=>dr,ChunkChangeKindSchema:()=>ir,ChunkChangeSchema:()=>vr,ChunkManifestChildSchema:()=>Cr,ChunkManifestParentSchema:()=>_r,ChunkManifestSchema:()=>Rr,ChunkPairingSchema:()=>lr,ChunkRefSchema:()=>Tt,ChunkStatsSchema:()=>Mr,ChunkingStrategySchema:()=>Da,CircuitBreakerStatusSchema:()=>Na,ClassificationFacetSchema:()=>gr,ConfidentialityLevelSchema:()=>ne,CopyReasonSchema:()=>Ls,DIFF_CONTEXT_LINES:()=>Ke,DIFF_ENGINE_VERSION:()=>Nt,DIFF_LINE_FACETS:()=>mr,DIFF_LINE_PAGE_MAX:()=>Ft,DIFF_REGION_CELL_BOUND:()=>Ot,DOCUMENT_CAPTURE_OUTCOMES:()=>fr,DOCUMENT_CHANGE_FEED_PAGE_MAX:()=>Lt,DOCUMENT_CHANGE_FEED_PAGE_SIZE:()=>Za,DOCUMENT_FACETS:()=>re,DOCUMENT_KINDS:()=>Le,DOCUMENT_KIND_LABELS:()=>Oa,DOCUMENT_STATE_CAUSES:()=>nr,DOCUMENT_STATE_LOCK_TIMEOUT_MS:()=>Qa,DOCUMENT_STATE_RUN_OUTCOMES:()=>rr,DiffLineFacetSchema:()=>ni,DiffLinePageLimitSchema:()=>Ht,DiffLinePageSchema:()=>fi,DiffLineSchema:()=>Lr,DiffSegmentSchema:()=>Fr,DocumentCaptureAnswerSchema:()=>Ni,DocumentCaptureOutcomeSchema:()=>hr,DocumentChangeFeedEntrySchema:()=>Vr,DocumentChangeFeedLimitSchema:()=>hi,DocumentChangeFeedPageSchema:()=>Ti,DocumentChangeFeedRowSchema:()=>Yr,DocumentComparisonSchema:()=>Si,DocumentFacetSchema:()=>vt,DocumentFacetValuesSchema:()=>li,DocumentHistorySchema:()=>Ii,DocumentKindSchema:()=>zn,DocumentRunEntrySchema:()=>Gr,DocumentStateCauseSchema:()=>Mt,DocumentStateEntrySchema:()=>Kr,DocumentStateRunOutcomeSchema:()=>or,DocumentStateSummarySchema:()=>jr,DocumentStructuredDataSchema:()=>Ta,ENRICHMENT_STAGES:()=>dn,EnrichmentClient:()=>pt,EnrichmentClientError:()=>te,EnrichmentSyncStatusSchema:()=>ct,FACET_APPLICABLE_COUNTS:()=>xr,FACET_COUNT_FIELDS:()=>Ir,FILE_PASSWORD_FIELD_WIDTHS:()=>fe,FILE_PASSWORD_MAX_BYTES:()=>js,FILE_PASSWORD_PATTERN_SYNTAXES:()=>Xo,FILE_PASSWORD_PATTERN_SYNTAX_LABELS:()=>Hs,FILE_PASSWORD_PRIORITY_MAX:()=>Wo,FILE_PASSWORD_SOURCE_KINDS:()=>qo,FILE_PASSWORD_SOURCE_KIND_LABELS:()=>zs,FILTERABLE_CONFIDENTIALITY_LEVELS:()=>Sa,FacetChangeCountsSchema:()=>Ar,FacetDiffSchema:()=>Ur,FieldChangeSchema:()=>Je,FilePasswordConditionsSchema:()=>ea,FilePasswordListSchema:()=>Bs,FilePasswordMatchSchema:()=>Vs,FilePasswordViewSchema:()=>pn,FileUriSchema:()=>xa,GRAPH_INDEX_LIMITS:()=>Ns,GraphSearchHitSchema:()=>Dn,HISTOGRAM_MAX_OCCURRENCES:()=>Dt,HunkIndexEntrySchema:()=>Pr,INGESTION_EVENT_NAMES:()=>Di,INLINE_REFINE_CELL_BUDGET:()=>wt,INLINE_REFINE_MAX_EDIT_DISTANCE:()=>Pt,INLINE_REFINE_MAX_GRAPHEMES:()=>Ge,INLINE_REFINE_MIN_SIMILARITY:()=>Be,INTEGRITY_CLASS_POLICY:()=>oo,INTEGRITY_COMMAND_CODES:()=>qt,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX:()=>$t,IntegrityActiveRunSchema:()=>fo,IntegrityAuditOverviewSchema:()=>Yi,IntegrityCancelFailureCodeSchema:()=>go,IntegrityCellResyncRequestSchema:()=>es,IntegrityCellResyncResultSchema:()=>ns,IntegrityCommandFailureCodeSchema:()=>We,IntegrityCommandFailureSchema:()=>as,IntegrityCommandReplySchema:()=>ss,IntegrityCommandSchema:()=>Bt,IntegrityDispositionSchema:()=>no,IntegrityFindingItemClassSchema:()=>Jt,IntegrityFindingPageSchema:()=>Zi,IntegrityFindingSchema:()=>ho,IntegrityFindingsQuerySchema:()=>Qi,IntegrityItemClassSchema:()=>Yt,IntegrityPhaseSchema:()=>lo,IntegrityPlacementObservedSchema:()=>qi,IntegrityQuantitySchema:()=>mo,IntegrityRepairActionSchema:()=>ro,IntegrityRepairOutcomeSchema:()=>co,IntegrityRepairSkipReasonSchema:()=>uo,IntegrityRunHeaderSchema:()=>Xe,IntegrityRunModeSchema:()=>ao,IntegrityRunStatusSchema:()=>io,IntegrityScopeRoleSchema:()=>eo,IntegrityStartFailureCodeSchema:()=>yo,IntegrityStoreSchema:()=>qe,IntegrityUnitSchema:()=>to,IntegrityVerdictSchema:()=>so,JsonPatchOperationSchema:()=>Dr,JsonValueSchema:()=>V,KeyedItemChangeSchema:()=>Nr,KeyedItemSchema:()=>At,LEDGER_STEP_KEYS:()=>Me,LINE_ENDINGS:()=>pr,LabelFacetItemSchema:()=>Er,LedgerStepKeySchema:()=>Ha,LineEndingSchema:()=>ti,MIME_KIND_RULES:()=>Ln,MODE_TIERS:()=>lt,MetadataFacetSchema:()=>Sr,ModelProviderSchema:()=>En,NOTHING_TO_READ_TOKENS:()=>qn,NothingToReadTokenSchema:()=>Xn,PIPELINE_FAILURE_STATUSES:()=>ht,PIPELINE_FLOWS:()=>vn,PIPELINE_PHASES:()=>wa,PIPELINE_STEPS:()=>yt,PIPELINE_STEP_KEYS:()=>Ce,PROTECTION_FORMATS:()=>Vo,PROTECTION_SCHEMES:()=>Yo,PROTECTION_SCHEME_LABELS:()=>ws,PipelineFailureStatusSchema:()=>Ct,PipelineRunRecordSchema:()=>Rt,PipelineRunStatusSchema:()=>Ue,PipelineRunSummarySchema:()=>It,PipelineStepKeySchema:()=>bt,PipelineStepMetricSchema:()=>Wa,PipelineStepRecordSchema:()=>Wn,PipelineStepStatusSchema:()=>Yn,PipelineTriggerSchema:()=>Jn,ProtectionFormatSchema:()=>Ds,ProtectionSchemeSchema:()=>Ps,QUARANTINED_CONFIDENTIALITY_LEVEL:()=>de,REMOVABLE_PROTECTION_SCHEMES:()=>un,RESTRICTED_MARK_SUBJECTS:()=>ur,RUN_TERMINAL_STEP_ERROR_CODES:()=>Gn,RUN_TERMINAL_STEP_KEY:()=>ve,RUN_TERMINAL_STEP_OUTCOMES:()=>Hn,ReadableConfidentialityLevelSchema:()=>Ut,RecentPipelineRunEntrySchema:()=>_i,RemovableProtectionSchemeSchema:()=>Os,RestrictedChangeMarkSchema:()=>Hr,RestrictedFailureMarkSchema:()=>bi,RestrictedIngestMarkSchema:()=>Ei,RestrictedMarkSubjectSchema:()=>ei,RestrictedRunMarkSchema:()=>jt,RestrictedStateMarkSchema:()=>zr,RunTerminalStepDetailSchema:()=>Kn,RunTerminalStepErrorCodeSchema:()=>Vn,RunTerminalStepOutcomeSchema:()=>jn,SEARCH_DEGRADATION_REASONS:()=>Ia,SEARCH_FUSIONS:()=>Ca,SEARCH_MODES:()=>st,SEARCH_PARAM_LIMITS:()=>ga,SEARCH_QUALITY_TIERS:()=>Ra,SOURCE_CAPABILITIES:()=>jo,SOURCE_CREDENTIALS:()=>Ho,STALE_RUN_ERROR_CODE:()=>Bn,STRUCTURED_DATA_ARRAY_CELL_BOUND:()=>kt,SYSTEM_PARAMETER_RANGES:()=>xe,SearchHitSchema:()=>Nn,SearchMetadataSchema:()=>An,SearchModeSchema:()=>xn,SearchRequestSchema:()=>dt,SearchResponseSchema:()=>ut,SourceCatalogSchema:()=>Cs,SourceSpecSchema:()=>Bo,StageProvenanceSchema:()=>$n,TREE_PATH_PATTERN:()=>Se,TenantIdSchema:()=>Cn,TextDiffIndexSchema:()=>ui,TextFacetSchema:()=>br,TextStatsSchema:()=>Or,TranscriptSegmentSchema:()=>Rn,TreePathSchema:()=>Ee,UNLOCK_DISPOSITIONS:()=>Jo,UNLOCK_DISPOSITION_LABELS:()=>Fs,UNLOCK_ERROR_CODES:()=>Us,UnlockDispositionSchema:()=>ks,assertBoundedSystemParameter:()=>Fi,assertSystemParameterInRange:()=>ki,assetTypeName:()=>hn,canonicalJson:()=>H,classifyDocumentKind:()=>Pa,codePointSlicer:()=>So,compareAssetKeys:()=>Ve,compareCodeUnits:()=>J,compareFacets:()=>Ye,comparePhases:()=>Ma,compareStates:()=>zo,compareTreePaths:()=>at,decodeChangeFeedCursor:()=>$r,diffChunkBodies:()=>Oo,diffLinePage:()=>Po,encodeChangeFeedCursor:()=>Jr,enrichmentStage:()=>Ts,flowFor:()=>Fa,flowStepGates:()=>La,formatSkipReason:()=>Ba,generateUuidV7:()=>Ys,identifierMatches:()=>Rs,integrityCommandFailureCodeOf:()=>is,isEnrichmentStageKey:()=>As,isPromotable:()=>Ms,isStrictlyEarlier:()=>Y,isUnknownTerm:()=>Un,isValidUuidV7:()=>ta,millisecondsBetween:()=>yn,modeFusesRankings:()=>ba,modeScoreIsSimilarity:()=>Ea,orderedSteps:()=>va,parseSkipReason:()=>_t,passwordByteLength:()=>Ks,pastedIdentifier:()=>Is,readableEntrySchema:()=>Ie,sourceOfUri:()=>_s,storedTermOf:()=>Ua,storedTermSchema:()=>_e,storedTermText:()=>za,storedWidth:()=>Zo,stripWhitespace:()=>Eo,summarizeTransition:()=>Uo,summaryFacetDiff:()=>Ne,textDiffIndex:()=>De,textFacetDiff:()=>Te,treePathDepth:()=>da,treePathLabel:()=>ua,treePathOf:()=>ee,treePathParent:()=>pa,treePathSegments:()=>ca,triesEveryFile:()=>Gs,uuidv7ToDate:()=>Js});module.exports=sa($s);var H=e=>{if(e===null||typeof e=="string"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="number"){if(!Number.isFinite(e))throw new RangeError(`A canonical JSON number is finite: ${e}`);return JSON.stringify(e)}if(Array.isArray(e))return`[${e.map(H).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${H(t[r])}`).join(",")}}`};var fn=require("zod");var ot={embedded_image:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF",embedded_chart:"\u57CB\u3081\u8FBC\u307F\u306E\u56F3\u8868",embedded_table:"\u57CB\u3081\u8FBC\u307F\u306E\u8868",attachment:"\u6DFB\u4ED8",archive_member:"\u66F8\u5EAB\u306E\u4E2D\u8EAB",keyframe:"\u5834\u9762\u306E\u753B\u50CF",audio_track:"\u97F3\u58F0",transcript_segment:"\u66F8\u304D\u8D77\u3053\u3057"};var Se=/^[a-z_]+-(0|[1-9][0-9]*)(\/[a-z_]+-(0|[1-9][0-9]*))*$/,Ee=fn.z.string().regex(Se,"A tree path joins <asset_type>-<asset_index> segments with '/' from the root down."),le=e=>{if(!Se.test(e))throw new RangeError(`not a tree path: ${JSON.stringify(e)}`);return e.split("/").map(t=>{let n=t.lastIndexOf("-");return{kind:t.slice(0,n),digits:t.slice(n+1)}})},ca=e=>le(e).map(({kind:t,digits:n})=>({assetType:t,assetIndex:Number(n)})),da=e=>le(e).length,mn=(e,t)=>e<t?-1:e>t?1:0,at=(e,t)=>{let n=le(e),r=le(t);for(let o=0;o<Math.min(n.length,r.length);o+=1){let i=n[o],s=r[o],l=mn(i.kind,s.kind)||i.digits.length-s.digits.length||mn(i.digits,s.digits);if(l!==0)return l}return n.length-r.length},hn=e=>{if(!Object.hasOwn(ot,e))throw new RangeError(`no name for the asset type ${JSON.stringify(e)}`);return ot[e]},ua=e=>le(e).map(({kind:t,digits:n})=>`${hn(t)} ${n}`).join(" > "),ee=e=>e.parentPath===void 0?`${e.assetType}-${e.assetIndex}`:`${e.parentPath}/${e.assetType}-${e.assetIndex}`,pa=e=>le(e).length===1?null:e.slice(0,e.lastIndexOf("/"));var X=require("zod");var we=require("zod"),ce=we.z.string().uuid().transform(e=>e.toLowerCase()),N=we.z.string().datetime({offset:!0}),ke=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!Object.hasOwn(e,"__proto__"),d=(e,t,n)=>{e.addIssue({code:we.z.ZodIssueCode.custom,path:[...t],message:n})},ma=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:Z|([+-])(\d{2}):?(\d{2}))$/,Pe=e=>{let t=N.safeParse(e).success?ma.exec(e):null;if(t===null)return null;let[,n,r,o,i,s,l,c,h,u,y]=t,E=new Date(0);E.setUTCFullYear(Number(n),Number(r)-1,Number(o)),E.setUTCHours(Number(i),Number(s),l===void 0?0:Number(l),0);let A=h===void 0?0:(h==="+"?1:-1)*(Number(u)*3600+Number(y)*60);return{epochSeconds:E.getTime()/1e3-A,fraction:c===void 0?"":c}},Y=(e,t)=>{let n=Pe(e),r=Pe(t);if(n===null||r===null)return!1;if(n.epochSeconds!==r.epochSeconds)return n.epochSeconds<r.epochSeconds;let o=Math.max(n.fraction.length,r.fraction.length);return n.fraction.padEnd(o,"0")<r.fraction.padEnd(o,"0")},yn=(e,t)=>{let n=Pe(e),r=Pe(t);if(n===null||r===null)return null;let o=Math.max(3,n.fraction.length,r.fraction.length),i=10n**BigInt(o),s=(BigInt(r.epochSeconds)-BigInt(n.epochSeconds))*i+BigInt(r.fraction.padEnd(o,"0"))-BigInt(n.fraction.padEnd(o,"0")),l=10n**BigInt(o-3);return Number(s>0n?(s+l-1n)/l:s/l)};var Fe=e=>{if(!Number.isInteger(e)||e<1)throw new RangeError(`A requeue chunk reads a positive integer of documents: ${e}`);return(t,n)=>{let r=t.requeued+t.skipped.length;r>e&&d(n,["requeued"],`One chunk settles at most ${e} documents.`),t.nextAfter!==null!=(r===e)&&d(n,["nextAfter"],"A chunk continues exactly when it read the limit.");let o=new Set;for(let[i,s]of t.skipped.entries())o.has(s.metadataId)&&d(n,["skipped",i,"metadataId"],"A chunk keeps a document back once."),o.add(s.metadataId)}};var gn=100,Sn=X.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),fa=X.z.object({after:Sn.optional()}).strict(),ha=X.z.object({requeued:X.z.number().int().nonnegative(),skipped:X.z.array(X.z.object({metadataId:X.z.number().int().min(1),reason:X.z.string().min(1)}).strict()),nextAfter:Sn.nullable()}).strict(),ya=ha.superRefine(Fe(gn));var te=class extends Error{statusCode;responseBody;parsedBody;constructor(t,n,r,o){super(t),this.name="EnrichmentClientError",this.statusCode=n,this.responseBody=r,this.parsedBody=o}},be=class{baseUrl;apiKey;fetchFn;timeoutMs;constructor(t){if(!t||typeof t.baseUrl!="string"||t.baseUrl.trim().length===0)throw new Error("baseUrl is required and must be a non-empty string for EnrichmentClient.");let n=t.baseUrl.trim().replace(/\/$/,"");if(t.apiKey&&n.startsWith("http://")&&!n.includes("localhost")&&!n.includes("127.0.0.1"))throw new Error("Security Violation: Transmitting Bearer tokens over unencrypted HTTP to non-localhost hosts is strictly prohibited.");this.baseUrl=n,this.apiKey=t.apiKey,this.fetchFn=t.fetchFn??fetch,this.timeoutMs=t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:3e4}async request(t,n,r){let o=`${this.baseUrl}${t}`,i={Accept:"application/json","Content-Type":"application/json","X-Tenant-Id":n};this.apiKey&&(i.Authorization=`Bearer ${this.apiKey}`);let s=new AbortController,l=setTimeout(()=>s.abort(),this.timeoutMs),c;try{c=await this.fetchFn(o,{method:"POST",headers:i,body:JSON.stringify(r),signal:s.signal})}catch(u){let y=u instanceof Error?u.message:String(u);throw new te(`Network request failed for POST ${o}: ${y}`,0,"")}finally{clearTimeout(l)}if(!c.ok){let u=await c.text().catch(()=>""),y;try{y=JSON.parse(u)}catch{}throw new te(`API request failed with status ${c.status}: ${u}`,c.status,u,y)}let h=await c.text().catch(()=>"");if(h.trim().length!==0)try{return JSON.parse(h)}catch(u){let y=u instanceof Error?u.message:String(u);throw new te(`Failed to parse response JSON from ${o}: ${y}`,c.status,h)}}};var m=require("zod");var it=require("zod"),En=it.z.enum(["google_cloud","google_vision","yomitoku_local","faster_whisper_local","google_speech","ollama_local","openai","anthropic","azure_openai","bedrock","custom_openai_compatible"]),ne=it.z.enum(["PUBLIC","INTERNAL","DEPARTMENT","CONFIDENTIAL","RESTRICTED"]),de="RESTRICTED";var ga={rrfK:{min:1,max:200,default:60},alpha:{min:0,max:1,default:.7},threshold:{min:0,max:1},limit:{min:1,max:50,default:10},queryLength:{min:1,max:500},filterTextLength:{min:1,max:100}},bn=ne.options.filter(e=>e!==de);if(bn.length===0)throw new Error("The confidentiality vocabulary left nothing filterable after removing the quarantined level; a validator built from this list would reject every request.");var Sa=bn,st=["KEYWORD","SPARSE","DENSE","HYBRID","GRAPH_TRAVERSE"],lt={KEYWORD:{dense:!1,sparse:!1,graph:!1,lexical:!0},SPARSE:{dense:!1,sparse:!0,graph:!1,lexical:!1},DENSE:{dense:!0,sparse:!1,graph:!1,lexical:!1},HYBRID:{dense:!0,sparse:!0,graph:!0,lexical:!0},GRAPH_TRAVERSE:{dense:!1,sparse:!1,graph:!0,lexical:!1}};function Ea(e){let t=lt[e];return t.dense&&!t.sparse}function ba(e){let t=lt[e];return[t.dense,t.sparse,t.graph,t.lexical].filter(Boolean).length>1}var Ca=["rrf","linear"],_a=["vector","graph"],Ra=["FULL","DEGRADED_LEXICAL_ONLY","DEGRADED_PARTIAL"],Ia=["vector_search_disabled","graph_search_disabled","circuit_breaker_open:vector","circuit_breaker_open:graph","vector_tier_not_configured","graph_tier_not_configured","no_active_vector_collection","vector_collections_missing","row_scope_permits_no_rows","vector_tier_unavailable","graph_tier_unavailable","vector_tier_timed_out","graph_tier_timed_out","tiers_not_executed"];var Cn=m.z.string().trim().min(1,"tenant_id must be a non-empty string"),xa=m.z.string().trim().min(1,"file_uri must be a non-empty string"),ct=m.z.enum(["PENDING","EXTRACTING","ENRICHING","PROJECTING","SYNCED","FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"]),Aa=m.z.object({page:m.z.number().int().positive().optional(),x:m.z.number().nonnegative().optional(),y:m.z.number().nonnegative().optional(),width:m.z.number().positive().optional(),height:m.z.number().positive().optional(),start_sec:m.z.number().nonnegative().optional(),end_sec:m.z.number().nonnegative().optional(),frame_index:m.z.number().int().nonnegative().optional(),timestamp_sec:m.z.number().nonnegative().optional(),scene_confidence:m.z.number().min(0).max(1).optional()}),_n=m.z.object({title:m.z.string().trim().min(1),start_sec:m.z.number().nonnegative(),end_sec:m.z.number().nonnegative(),summary:m.z.string()}),Rn=m.z.object({start_sec:m.z.number().nonnegative(),end_sec:m.z.number().nonnegative(),speaker:m.z.string().trim().min(1),text:m.z.string()}),In=m.z.object({label:m.z.string(),value:m.z.number(),currency:m.z.string()}),Ta=m.z.object({document_type:m.z.string().optional(),title:m.z.string().optional(),organization:m.z.string().optional(),key_entities:m.z.array(m.z.string()).optional(),dates:m.z.array(m.z.string()).optional(),amounts:m.z.array(In).optional(),media_type:m.z.enum(["video","audio"]).optional(),duration_sec:m.z.number().nonnegative().optional(),chapters:m.z.array(_n).optional(),transcript_segments:m.z.array(Rn).optional()}),Na=m.z.enum(["CLOSED","OPEN","HALF_OPEN"]),xn=m.z.enum(st),An=m.z.object({circuit_breaker_status:m.z.string(),quality_tier:m.z.string(),latency_ms:m.z.number().nonnegative(),total_hits:m.z.number().int().nonnegative(),fallback_applied:m.z.boolean(),degraded_reason:m.z.string().nullable()}),Tn=m.z.enum(["CONTRACT_LEGAL","EMAIL_THREAD","DAILY_REPORT","FINANCIAL_REPORT","TECHNICAL_SPEC","MASTER_DATA","MEDIA_ASSET","GENERAL_DOCUMENT"]),Da=m.z.enum(["hierarchical","conversation","section","fixed_size","table_aware","semantic","none","multimodal"]),Nn=m.z.object({metadata_id:m.z.number().int().positive(),chunk_index:m.z.number().int().nonnegative(),text:m.z.string(),score:m.z.number()}),Dn=m.z.object({metadata_id:m.z.number().int().positive(),relation:m.z.string(),target_name:m.z.string()}),dt=m.z.object({query:m.z.string().trim().min(1,"query must not be empty"),tenant_id:Cn,domain_key:Tn.optional(),limit:m.z.number().int().positive().optional(),department_id:m.z.number().int().positive().optional(),search_mode:xn.optional(),strategy_id:m.z.number().int().positive().optional()}).strict(),ut=m.z.object({hits:m.z.array(Nn),graph_hits:m.z.array(Dn),tiers:m.z.record(m.z.string(),m.z.boolean()),metadata:An});var pt=class extends be{async search(t){let n=dt.parse(t),r=await this.request("/ai/search/hybrid",n.tenant_id,n);return ut.parse(r)}};var a=require("zod");var S=require("zod");var Le=["email","pdf","office","image","media","archive","markdown","text","google_native","other"],Oa={email:"\u30E1\u30FC\u30EB",pdf:"PDF",office:"Office \u6587\u66F8",image:"\u753B\u50CF",media:"\u97F3\u58F0\u30FB\u52D5\u753B",archive:"\u66F8\u5EAB",markdown:"Markdown",text:"\u30C6\u30AD\u30B9\u30C8",google_native:"Google \u30CD\u30A4\u30C6\u30A3\u30D6",other:"\u305D\u306E\u4ED6"},Ln=[["message/rfc822","email"],["application/pdf","pdf"],["application/vnd.openxmlformats-officedocument.*","office"],["application/msword","office"],["application/vnd.ms-excel","office"],["application/vnd.ms-powerpoint","office"],["application/zip","archive"],["application/x-zip-compressed","archive"],["application/x-zip","archive"],["application/x-tar","archive"],["application/x-gtar","archive"],["application/gzip","archive"],["application/x-gzip","archive"],["application/x-bzip2","archive"],["application/x-xz","archive"],["application/x-7z-compressed","archive"],["application/vnd.rar","archive"],["application/x-rar-compressed","archive"],["application/x-rar","archive"],["application/vnd.google-apps.*","google_native"],["image/svg+xml","text"],["image/emf","other"],["image/x-emf","other"],["image/wmf","other"],["image/x-wmf","other"],["image/*","image"],["audio/*","media"],["video/*","media"],["text/markdown","markdown"],["text/x-markdown","markdown"],["text/*","text"],["application/json","text"],["application/xml","text"]];function Pa(e){let t=(e.split(";")[0]??"").trim().toLowerCase();for(let[n,r]of Ln)if(n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n)return r;return"other"}var Ce=["delete_child_assets","unlock_document","extract_text","analyze_media","extract_assets","ocr_document","ocr_children","resolve_body","enrich_document","project_to_indexes"],ve="record_document_state",Me=[...Ce,ve],wa=["EXTRACTING","ENRICHING","PROJECTING"],ht=["FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"],mt=e=>({featureFlagKey:e,whenClosed:"skip",failureStatus:null}),On=(e,t)=>({featureFlagKey:e,whenClosed:"fail",failureStatus:t}),yt={delete_child_assets:{key:"delete_child_assets",label:"\u65E7\u7248\u306E\u5B50\u30A2\u30BB\u30C3\u30C8\u524A\u9664",description:"\u3053\u306E\u7248\u3088\u308A\u524D\u306E\u7248\u304C\u751F\u3093\u3060\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u4FDD\u7BA1\u5C64\u3068\u7D22\u5F15\u304B\u3089\u5916\u3059\u3002",endpoint:"/ai/assets/delete",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},unlock_document:{key:"unlock_document",label:"\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u89E3\u9664",description:"\u6587\u66F8\u304C\u6301\u3064\u30D1\u30B9\u30EF\u30FC\u30C9 (ZIP\u30FBPDF\u30FBOffice) \u3092\u3001\u6761\u4EF6\u306E\u5F53\u305F\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3067\u5916\u3057\u3001\u89E3\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u539F\u672C\u306B\u3059\u308B (\u6E90\u3092\u4E0A\u66F8\u304D\u3059\u308B\u304B\u89E3\u3044\u305F\u5199\u3057\u3092\u539F\u672C\u306B\u3057\u3001\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u7121\u3044\u6587\u66F8\u306F\u98DB\u3070\u3059)\u3002",endpoint:"/ai/documents/unlock",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},extract_text:{key:"extract_text",label:"\u6587\u5B57\u5C64\u306E\u62BD\u51FA",description:"\u6587\u66F8\u304C\u6301\u3064\u6587\u5B57\u5C64 (PDF \u306E\u6587\u5B57\u30FBOffice \u306E\u672C\u6587\u30FB\u30E1\u30FC\u30EB\u306E\u672C\u6587\u3068\u898B\u51FA\u3057) \u3092\u8AAD\u307F\u3001\u4F4D\u7F6E\u60C5\u5831\u3068\u5171\u306B\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/enrichment/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},analyze_media:{key:"analyze_media",label:"\u30E1\u30C7\u30A3\u30A2\u89E3\u6790",description:"\u97F3\u58F0\u30FB\u52D5\u753B\u3092\u8EE2\u5199\u3057\u3001\u767A\u8A71\u533A\u9593\u4ED8\u304D\u306E\u30C1\u30E3\u30F3\u30AF\u3068\u30AD\u30FC\u30D5\u30EC\u30FC\u30E0\u6570\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/media/analyze",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_MEDIA_ANALYSIS")],capability:"transcription",fanOut:null},extract_assets:{key:"extract_assets",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u62BD\u51FA",description:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF\u30FB\u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u30FBMarkdown \u304C\u53C2\u7167\u3059\u308B\u753B\u50CF\u30FB\u66F8\u5EAB (ZIP\u30FB7z\u30FBRAR\u30FBtar\u30FBgzip\u30FBbzip2\u30FBxz) \u306E\u4E2D\u8EAB\u3092\u5B50\u30A2\u30BB\u30C3\u30C8\u3068\u3057\u3066\u53D6\u308A\u51FA\u3057 (\u6DFB\u4ED8\u306E\u66F8\u5EAB\u3082\u4E2D\u8EAB\u3078\u5C55\u958B\u3059\u308B)\u3001\u914D\u5099\u306E\u7F6E\u304D\u5834\u3078\u5199\u3057\u3066\u767B\u9332\u3059\u308B\u3002",endpoint:"/ai/assets/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_ASSET_EXTRACTION")],capability:"asset_extraction",fanOut:null},ocr_children:{key:"ocr_children",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u8AAD\u307F\u53D6\u308A",description:"\u5207\u308A\u51FA\u3057\u305F\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u62BD\u51FA\u9806\u306B 1 \u4EF6\u305A\u3064\u8AAD\u307F\u3001\u6587\u5B57\u5C64\u3092\u8AAD\u3081\u308B\u5B50 (\u30C6\u30AD\u30B9\u30C8\u30FB\u30E1\u30FC\u30EB\u30FBOffice\u30FBPDF) \u306F\u305D\u306E\u6587\u5B57\u5C64\u3092\u3001\u8AAD\u3081\u306A\u3044\u5B50\u306F\u7248\u9762\u3092\u5149\u5B66\u8A8D\u8B58\u3067\u8AAD\u3093\u3067 (\u89AA\u306E\u672C\u6587\u3067\u3042\u308B\u7248\u9762\u306E\u8A8D\u8B58\u304C\u65E2\u306B\u8AAD\u3093\u3060\u30DA\u30FC\u30B8\u306B\u8F09\u308B PDF \u306E\u753B\u50CF\u306F\u8AAD\u307F\u76F4\u3055\u306A\u3044)\u3001\u5B50\u3054\u3068\u306B\u672C\u6587\u3068\u51FA\u6240\u3092\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:"ocr",fanOut:"children"},ocr_document:{key:"ocr_document",label:"\u6587\u66F8\u306E OCR",description:"\u6587\u66F8\u81EA\u8EAB\u306E\u7248\u9762 (\u753B\u50CF\u30FBPDF \u306E\u5404\u30DA\u30FC\u30B8) \u3092\u5149\u5B66\u8A8D\u8B58\u306B\u304B\u3051\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[mt("ENABLE_OCR")],capability:"ocr",fanOut:null},resolve_body:{key:"resolve_body",label:"\u672C\u6587\u306E\u78BA\u5B9A",description:"\u6587\u5B57\u5C64\u30FBOCR\u30FB\u8EE2\u5199\u306E\u3069\u308C\u3092\u672C\u6587\u3068\u3059\u308B\u304B\u3092\u6C7A\u3081\u3001\u51FA\u6240\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/enrichment/body",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:null,fanOut:null},enrich_document:{key:"enrich_document",label:"\u8981\u7D04\u3068\u69CB\u9020\u5316\u62BD\u51FA",description:"\u672C\u6587\u3092\u30E2\u30C7\u30EB\u3078\u6E21\u3057\u3001\u8981\u7D04\u30FB\u30BF\u30B0\u30FB\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u30FB\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u3092\u5F97\u308B\u3002",endpoint:"/ai/enrichment/document",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:"enrichment",fanOut:null},project_to_indexes:{key:"project_to_indexes",label:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71",description:"\u672C\u6587\u3092\u30C1\u30E3\u30F3\u30AF\u306B\u3057\u3066\u57CB\u3081\u8FBC\u307F\u3001\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u3068\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u3078\u66F8\u304F\u3002",endpoint:"/ai/enrichment/project",phase:"PROJECTING",failureStatus:"FAILED_VECTOR",gates:[On("ENABLE_VECTOR_INDEXING","FAILED_VECTOR"),On("ENABLE_GRAPH_INDEXING","FAILED_GRAPH")],capability:null,fanOut:null}},ft={whenClosed:"fail",failureStatus:"FAILED_EXTRACT"},Pn=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets","ocr_document"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],wn=[{step:"delete_child_assets",dependsOn:[]},{step:"unlock_document",dependsOn:["delete_child_assets"]},{step:"extract_text",dependsOn:["unlock_document"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets","ocr_document"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],ka=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"resolve_body",dependsOn:["ocr_children"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],kn=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"resolve_body",dependsOn:["extract_text"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],vn={email:{kind:"email",steps:Pn},pdf:{kind:"pdf",steps:wn},office:{kind:"office",steps:wn},google_native:{kind:"google_native",steps:Pn},image:{kind:"image",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"ocr_document",dependsOn:["delete_child_assets"],gatePolicy:ft},{step:"resolve_body",dependsOn:["ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},media:{kind:"media",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"analyze_media",dependsOn:["delete_child_assets"],gatePolicy:ft},{step:"resolve_body",dependsOn:["analyze_media"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"existing"}]},archive:{kind:"archive",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"unlock_document",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["unlock_document"],gatePolicy:ft},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"resolve_body",dependsOn:["ocr_children"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},markdown:{kind:"markdown",steps:ka},text:{kind:"text",steps:kn},other:{kind:"other",steps:kn}};function Fa(e){return vn[e]}function La(e){let{gates:t}=yt[e.step],{gatePolicy:n}=e;return n===void 0?t:t.map(r=>({featureFlagKey:r.featureFlagKey,whenClosed:n.whenClosed,failureStatus:n.failureStatus}))}function va(e){let t=new Map(e.steps.map(i=>[i.step,i]));for(let i of e.steps){if(i.gatePolicy!==void 0&&yt[i.step].gates.length===0)throw new Error(`Flow ${e.kind}: step ${i.step} overrides its gate policy, but the step has no gate to close.`);for(let s of i.dependsOn)if(!t.has(s))throw new Error(`Flow ${e.kind}: step ${i.step} depends on ${s}, which the flow does not contain.`)}let n=[...e.steps],r=new Set,o=[];for(;n.length>0;){let i=n.findIndex(l=>l.dependsOn.every(c=>r.has(c)));if(i===-1)throw new Error(`Flow ${e.kind}: the steps ${n.map(l=>l.step).join(", ")} depend on each other in a cycle.`);let[s]=n.splice(i,1);r.add(s.step),o.push(s)}return o}var Fn={EXTRACTING:0,ENRICHING:1,PROJECTING:2};function Ma(e,t){return Fn[e]-Fn[t]}var ue=require("zod");function Ua(e,t){return Mn(e,t)?t:{known:!1,raw:t}}function Mn(e,t){return e.includes(t)}function Un(e){return typeof e!="string"}function za(e){return Un(e)?e.raw:e}function _e(e){let t=ue.z.object({known:ue.z.literal(!1),raw:ue.z.string()}).strict().refine(n=>!Mn(e,n.raw),{message:"A value the vocabulary knows is carried as itself, never as an unknown term.",path:["raw"]});return ue.z.union([ue.z.enum(e),t])}var zn=S.z.enum(Le),bt=S.z.enum(Ce),Ha=S.z.enum(Me),Ct=S.z.enum(ht),Hn=["RECORDED","UNCHANGED","ALREADY_RECORDED"],jn=S.z.enum(Hn),Kn=S.z.object({outcome:jn}).strict(),Gn=["history_no_current_row","history_lock_timeout","history_write_failed"],Bn="stale_run",Vn=S.z.enum(Gn),Ue=S.z.enum(["RUNNING","SUCCEEDED","FAILED"]),Yn=S.z.enum(["RUNNING","SUCCEEDED","SKIPPED","FAILED"]),Jn=S.z.enum(["ingest","retry","resync"]),ze=S.z.enum(["text_layer","ocr","transcript"]),B=S.z.number().int().nonnegative().nullable(),$n=S.z.object({provider:S.z.string().nullable(),model:S.z.string().nullable(),engine:S.z.string().nullable(),prompt_key:S.z.string().nullable(),prompt_version:S.z.number().int().nullable(),duration_ms:B,input_chars:B,output_chars:B,pages_read:B,pages_total:B,chunk_count:B,points_upserted:B,collection:S.z.string().nullable(),embedding_model:S.z.string().nullable(),strategy_id:S.z.number().int().positive().nullable(),graph_nodes:B,body_source:ze.nullable(),detail:S.z.custom(ke,"A report's detail holds no own __proto__ member.").pipe(S.z.record(S.z.string(),S.z.unknown()))}).strict(),qn=["no_pages","no_pages_rendered","covered_by_page_recognition"],Xn=S.z.enum(qn),gt="gate_closed:",St="source_skipped:",Et="nothing_to_read:",ja=["no_children","not_protected","superseded","recording_disabled","recording_misconfigured"],Ka=e=>ja.includes(e),Ga=/^[A-Z][A-Z0-9_]*$/;function _t(e){if(Ka(e))return{kind:e};if(e.startsWith(gt)){let t=e.slice(gt.length);return Ga.test(t)?{kind:"gate_closed",featureFlagKey:t}:null}if(e.startsWith(St)){let t=bt.safeParse(e.slice(St.length));return t.success?{kind:"source_skipped",stepKey:t.data}:null}if(e.startsWith(Et)){let t=Xn.safeParse(e.slice(Et.length));return t.success?{kind:"nothing_to_read",token:t.data}:null}return null}function Ba(e){let t=Va(e);if(_t(t)===null)throw new RangeError(`Skip reason ${JSON.stringify(e)} has no text form: ${JSON.stringify(t)} is outside the skip-reason grammar.`);return t}function Va(e){switch(e.kind){case"gate_closed":return`${gt}${e.featureFlagKey}`;case"no_children":case"not_protected":case"superseded":case"recording_disabled":case"recording_misconfigured":return e.kind;case"source_skipped":return`${St}${e.stepKey}`;case"nothing_to_read":return`${Et}${e.token}`;default:{let t=e;throw new RangeError(`Unknown skip reason kind: ${JSON.stringify(t)}`)}}}var Ya=S.z.object({id:S.z.number().int().positive(),runId:S.z.number().int().positive(),sequence:S.z.number().int().nonnegative(),stepKey:_e(Me),targetMetadataId:S.z.number().int().positive(),targetTreePath:Ee.nullable(),status:Yn,skipReason:S.z.string().nullable(),provenance:$n.nullable(),strategyId:S.z.number().int().positive().nullable(),httpStatus:S.z.number().int().nullable(),errorCode:S.z.string().nullable(),errorMessage:S.z.string().nullable(),startedAt:N,finishedAt:N.nullable(),durationMs:B}).strict();function Ja(e,t){switch(e.stepKey===ve&&qa(e,t),e.status){case"SKIPPED":e.skipReason===null&&d(t,["skipReason"],"A SKIPPED step must record why it was skipped."),e.provenance!==null&&d(t,["provenance"],"A SKIPPED step read nothing, so it has no report.");return;case"SUCCEEDED":e.provenance===null&&d(t,["provenance"],"A SUCCEEDED step must carry its report."),e.skipReason!==null&&d(t,["skipReason"],"A SUCCEEDED step was not skipped.");return;case"RUNNING":e.finishedAt!==null&&d(t,["finishedAt"],"A RUNNING step has not finished.");return;case"FAILED":e.skipReason!==null&&d(t,["skipReason"],"A FAILED step was not skipped.");return}}var $a=["superseded","recording_disabled","recording_misconfigured"];function qa(e,t){if(e.strategyId!==null&&d(t,["strategyId"],"The terminal step applies no strategy."),e.httpStatus!==null&&d(t,["httpStatus"],"The terminal step calls no API, so it has no HTTP status."),e.status==="SUCCEEDED"&&e.provenance!==null){Kn.safeParse(e.provenance.detail).success||d(t,["provenance","detail"],"A succeeded terminal step's detail is exactly { outcome }.");for(let[n,r]of Object.entries(e.provenance))n!=="detail"&&r!==null&&d(t,["provenance",n],"A succeeded terminal step reports nothing but its outcome.")}if(e.status==="FAILED"&&(e.provenance!==null&&d(t,["provenance"],"Neither the failure close nor the recovery sweeper writes a terminal step's report."),e.errorCode!==Bn&&!Vn.safeParse(e.errorCode).success&&d(t,["errorCode"],"A failed terminal step names a history error code, or the stale-run code the sweeper writes.")),e.status==="SKIPPED"&&e.skipReason!==null){let n=_t(e.skipReason);(n===null||!$a.includes(n.kind))&&d(t,["skipReason"],"A skipped terminal step names one of the terminal skip reasons.")}}var Wn=Ya.superRefine(Ja),Zn=S.z.object({id:S.z.number().int().positive(),tenantId:S.z.string().min(1),metadataId:S.z.number().int().positive(),revision:S.z.number().int().positive(),runUid:S.z.string().uuid(),jobId:S.z.string().min(1),attempt:S.z.number().int().positive(),trigger:Jn,documentKind:_e(Le),flowKey:S.z.string().min(1),status:Ue,retryScheduled:S.z.boolean(),failedStepKey:_e(Ce).nullable(),errorMessage:S.z.string().nullable(),requestedBy:S.z.string().min(1),startedAt:N,finishedAt:N.nullable(),steps:S.z.array(Wn)}).strict();function Qn(e,t){e.retryScheduled&&e.status!=="FAILED"&&d(t,["retryScheduled"],"Only a FAILED run can have a retry scheduled.")}var Rt=Zn.superRefine(Qn),It=Zn.omit({steps:!0}).superRefine(Qn);function Xa(e,t){e.sampleCount>0||(e.durationP50Ms!==null&&d(t,["durationP50Ms"],"A step with no sample has no median latency."),e.durationP95Ms!==null&&d(t,["durationP95Ms"],"A step with no sample has no 95th-percentile latency."))}var Wa=S.z.object({documentKind:zn,stepKey:bt,sampleCount:S.z.number().int().nonnegative(),succeeded:S.z.number().int().nonnegative(),failed:S.z.number().int().nonnegative(),skipped:S.z.number().int().nonnegative(),durationP50Ms:B,durationP95Ms:B,lastStartedAt:N.nullable()}).strict().superRefine(Xa);var Nt=2,Ke=3,Dt=64,Ot=1e6,Ge=4096,Be=.3,Pt=1024,wt=67108864,kt=16777216,Ft=500,Lt=50,Za=50,Qa=1e4,tr=1,re=["classification","metadata","labels","tags","structured_data","text","summary","chunks","assets"],vt=a.z.enum(re),nr=["RUN","PRE_WRITE","MANUAL","BACKFILL"],Mt=a.z.enum(nr),rr=["SUCCEEDED","FAILED"],or=a.z.enum(rr),ar=["ADDED","REMOVED","MODIFIED","MOVED"],ir=a.z.enum(ar),sr=["clause","breadcrumbs"],lr=a.z.enum(sr),cr=["EXACT","WHITESPACE_NORMALIZED","UNVERIFIED"],dr=a.z.enum(cr),ur=["run","ingest","failure","state","change"],ei=a.z.enum(ur),pr=["LF","CRLF","CR","MIXED","NONE"],ti=a.z.enum(pr),mr=["text","summary","chunks"],ni=a.z.enum(mr),fr=["RECORDED","UNCHANGED"],hr=a.z.enum(fr),yr=a.z.lazy(()=>a.z.custom(ke,"A JSON object here holds no own __proto__ member.").pipe(a.z.record(a.z.string(),V))),V=a.z.lazy(()=>a.z.union([a.z.string(),a.z.number().finite(),a.z.boolean(),a.z.null(),a.z.array(V),yr])),Ut=ne.exclude([de]),z=a.z.number().int().positive(),R=a.z.number().int().nonnegative(),je=a.z.string().regex(/^[0-9a-f]{64}$/,"A SHA-256 is 64 lowercase hexadecimal digits."),J=(e,t)=>e<t?-1:e>t?1:0,Ve=(e,t)=>at(ee(e),ee(t)),pe=(e,t,n,r,o)=>{for(let i=1;i<e.length;i++)t(e[i-1],e[i])>=0&&d(n,[...r,i],o)},gr=a.z.object({confidentialityLevel:ne,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable(),createdBy:a.z.string()}).strict(),Sr=a.z.object({fileName:a.z.string(),filePath:a.z.string(),fileId:a.z.string().nullable(),revision:z,revisionId:a.z.string().nullable(),fileSize:R,mimeType:a.z.string(),fileHash:a.z.string().nullable(),mtime:N}).strict(),Er=a.z.object({labelKey:a.z.string().min(1),assignedBy:a.z.string(),confidenceScore:a.z.number().finite()}).strict(),ri=a.z.string().refine(e=>!e.includes("/")&&Se.test(`${e}-0`),"An asset type is the kind of a tree path segment: lowercase letters and underscores."),zt=a.z.object({assetType:ri,assetIndex:R.max(Number.MAX_SAFE_INTEGER),mimeType:a.z.string(),fileSize:R,textSha256:je.nullable(),parentPath:Ee.optional()}).strict(),oi=zt.pick({assetType:!0,assetIndex:!0,parentPath:!0}).strip(),br=a.z.object({body:a.z.string().nullable(),mime:a.z.string().nullable(),source:ze.nullable(),isTruncated:a.z.boolean(),pageOffsets:V}).strict(),Cr=a.z.object({index:R,hash:je,whitespaceFreeHash:je,charStart:R,charEnd:R,breadcrumbs:a.z.string(),clause:a.z.string().nullable(),page:a.z.number().int().nullable(),sheet:a.z.string().nullable(),slide:a.z.number().int().nullable(),startSec:a.z.number().finite().nullable(),endSec:a.z.number().finite().nullable(),tokenCount:R,parentOrdinal:R}).strict(),_r=a.z.object({ordinal:R,contentHash:je,charLength:R}).strict();function ai(e,t){pe(e.children,(r,o)=>r.index-o.index,t,["children"],"Children are listed in strictly ascending index.");let n=0;e.children.forEach((r,o)=>{r.charStart>r.charEnd&&d(t,["children",o,"charEnd"],"A span ends at or after its start."),r.parentOrdinal===n?n++:r.parentOrdinal>n&&d(t,["children",o,"parentOrdinal"],"Parents are numbered in the order they first appear.")}),(e.parents.length!==n||e.parents.some((r,o)=>r.ordinal!==o))&&d(t,["parents"],"Each parent the children reach is listed exactly once, in ordinal order.")}var Rr=a.z.object({version:a.z.literal(tr),children:a.z.array(Cr).min(1),parents:a.z.array(_r)}).strict().superRefine(ai);function ii(e,t){pe(e.labels,(n,r)=>J(n.labelKey,r.labelKey),t,["labels"],"Labels are ordered by labelKey with no key repeated."),pe(e.tags??[],J,t,["tags"],"Tags are ordered with no tag repeated."),e.assets.every(n=>oi.safeParse(n).success)&&(pe(e.assets,Ve,t,["assets"],"Assets are ordered by their tree paths in tree order with no path repeated."),si(e.assets,t))}function si(e,t){let n=new Set;e.forEach((r,o)=>{Object.hasOwn(r,"parentPath")&&r.parentPath===void 0&&d(t,["assets",o,"parentPath"],"parentPath is absent at depth 1, never undefined."),r.parentPath!==void 0&&!n.has(r.parentPath)&&d(t,["assets",o,"parentPath"],"Each parentPath names an earlier item's tree path."),n.add(ee(r))})}var li=a.z.object({classification:gr,metadata:Sr,labels:a.z.array(Er),tags:a.z.array(a.z.string()).nullable(),structured_data:V,text:br,summary:a.z.string().nullable(),chunks:Rr.nullable(),assets:a.z.array(zt)}).strict().superRefine(ii),Ir=["addedCount","removedCount","modifiedCount","movedCount","unchangedCount","charsAdded","charsRemoved"],xr={classification:["modifiedCount"],metadata:["modifiedCount"],labels:["addedCount","removedCount","modifiedCount","unchangedCount"],tags:["addedCount","removedCount","unchangedCount"],structured_data:["addedCount","removedCount","modifiedCount"],text:["addedCount","removedCount","unchangedCount","charsAdded","charsRemoved"],summary:["addedCount","removedCount","unchangedCount","charsAdded","charsRemoved"],chunks:["addedCount","removedCount","modifiedCount","movedCount","unchangedCount"],assets:["addedCount","removedCount","modifiedCount","unchangedCount"]};function ci(e,t){let n=xr[e.facet];for(let r of Ir)n.includes(r)&&e[r]===null&&d(t,[r],`The ${e.facet} facet always counts ${r}.`),!n.includes(r)&&e[r]!==null&&d(t,[r],`${r} does not apply to the ${e.facet} facet.`)}var Ar=a.z.object({facet:vt,addedCount:R.nullable(),removedCount:R.nullable(),modifiedCount:R.nullable(),movedCount:R.nullable(),unchangedCount:R.nullable(),charsAdded:R.nullable(),charsRemoved:R.nullable()}).strict().superRefine(ci),er=new Map(re.map((e,t)=>[e,t])),Ye=(e,t)=>er.get(e)-er.get(t),Tr=a.z.array(Ar).min(1).superRefine((e,t)=>pe(e,(n,r)=>Ye(n.facet,r.facet),t,[],"A change lists each changed facet once, in display order.")),Je=a.z.object({field:a.z.string().min(1),before:V,after:V}).strict(),At=a.z.object({key:a.z.string().min(1),value:yr}).strict(),Nr=a.z.object({key:a.z.string().min(1),fields:a.z.array(Je).min(1)}).strict(),xt=a.z.string().refine(e=>e===""||e.startsWith("/"),"A JSON Pointer is empty or starts with '/'."),Dr=a.z.discriminatedUnion("op",[a.z.object({op:a.z.literal("add"),path:xt,value:V}).strict(),a.z.object({op:a.z.literal("remove"),path:xt,previous:V}).strict(),a.z.object({op:a.z.literal("replace"),path:xt,value:V,previous:V}).strict()]),Or=a.z.object({linesAdded:R,linesRemoved:R,linesUnchanged:R,charsAdded:R,charsRemoved:R,similarity:a.z.number().min(0).max(1).nullable()}).strict();function di(e,t){e.linesAdded>e.newLines&&d(t,["linesAdded"],"A hunk adds no more lines than it spans on the new side."),e.linesRemoved>e.oldLines&&d(t,["linesRemoved"],"A hunk removes no more lines than it spans on the old side."),e.linesAdded+e.linesRemoved===0&&d(t,["linesAdded"],"A hunk changes at least one line.")}var Pr=a.z.object({hunk:R,oldStart:R,oldLines:R,newStart:R,newLines:R,firstPage:a.z.number().int().nullable(),linesAdded:R,linesRemoved:R}).strict().superRefine(di),wr=(e,t)=>{e.forEach((n,r)=>{n.hunk!==r&&d(t,["hunks",r,"hunk"],"Hunks are numbered from 0 in order.")})},kr={attributes:a.z.array(Je),stats:Or,hunks:a.z.array(Pr)},ui=a.z.object(kr).strict().superRefine((e,t)=>wr(e.hunks,t)),Fr=a.z.object({kind:a.z.enum(["equal","removed","added"]),text:a.z.string().min(1)}).strict(),pi={context:["equal"],removed:["equal","removed"],added:["equal","added"]};function mi(e,t){e.oldNumber===null!=(e.kind==="added")&&d(t,["oldNumber"],"Context and removed lines carry their old number; added lines carry none."),e.newNumber===null!=(e.kind==="removed")&&d(t,["newNumber"],"Context and added lines carry their new number; removed lines carry none."),e.segments.forEach((n,r)=>{pi[e.kind].includes(n.kind)||d(t,["segments",r,"kind"],`A ${e.kind} line has no ${n.kind} segment.`)})}var Lr=a.z.object({kind:a.z.enum(["context","removed","added"]),oldNumber:z.nullable(),newNumber:z.nullable(),page:a.z.number().int().nullable(),segments:a.z.array(Fr)}).strict().superRefine(mi),fi=a.z.object({lines:a.z.array(Lr).max(Ft),next:R.nullable()}).strict().superRefine((e,t)=>{e.next!==null&&e.lines.length===0&&d(t,["next"],"An empty page has no next page.")}),Ht=a.z.number().int().min(1).max(Ft),hi=a.z.number().int().min(1).max(Lt),Tt=a.z.object({index:R,charStart:R,charEnd:R,page:a.z.number().int().nullable(),sheet:a.z.string().nullable(),slide:a.z.number().int().nullable(),startSec:a.z.number().finite().nullable(),endSec:a.z.number().finite().nullable(),breadcrumbs:a.z.string(),tokenCount:R,fidelity:dr}).strict();function yi(e,t){e.old===null!=(e.kind==="ADDED")&&d(t,["old"],"Every chunk change but ADDED has an old chunk."),e.new===null!=(e.kind==="REMOVED")&&d(t,["new"],"Every chunk change but REMOVED has a new chunk."),e.pairing===null==(e.kind==="MODIFIED")&&d(t,["pairing"],"A MODIFIED pair names the rule that paired it; no other change has one.")}var vr=a.z.object({entry:R,kind:ir,pairing:lr.nullable(),old:Tt.nullable(),new:Tt.nullable()}).strict().superRefine(yi),Mr=a.z.object({added:R,removed:R,modified:R,moved:R,unchanged:R}).strict();function gi(e,t){e.entries.forEach((o,i)=>{o.entry!==i&&d(t,["entries",i,"entry"],"Chunk entries are numbered from 0 in order.")});let n={ADDED:0,REMOVED:0,MODIFIED:0,MOVED:0};for(let o of e.entries)n[o.kind]++;let r=[["added",n.ADDED],["removed",n.REMOVED],["modified",n.MODIFIED],["moved",n.MOVED]];for(let[o,i]of r)e.stats[o]!==i&&d(t,["stats",o],`The ${o} count equals the number of entries of that kind.`)}var Ur=a.z.union([a.z.object({facet:vt,change:a.z.literal("UNCHANGED")}).strict(),a.z.object({facet:a.z.enum(["classification","metadata"]),change:a.z.literal("CHANGED"),fields:a.z.array(Je).min(1)}).strict(),a.z.object({facet:a.z.enum(["labels","assets"]),change:a.z.literal("CHANGED"),added:a.z.array(At),removed:a.z.array(At),modified:a.z.array(Nr),unchangedCount:R}).strict(),a.z.object({facet:a.z.literal("tags"),change:a.z.literal("CHANGED"),added:a.z.array(a.z.string()),removed:a.z.array(a.z.string()),unchangedCount:R}).strict(),a.z.object({facet:a.z.literal("structured_data"),change:a.z.literal("CHANGED"),operations:a.z.array(Dr).min(1)}).strict(),a.z.object({facet:a.z.enum(["text","summary"]),change:a.z.literal("CHANGED"),...kr}).strict().superRefine((e,t)=>wr(e.hunks,t)),a.z.object({facet:a.z.literal("chunks"),change:a.z.literal("CHANGED"),stats:Mr,entries:a.z.array(vr),textUnchangedChunkingChanged:a.z.boolean()}).strict().superRefine(gi)]),Si=a.z.object({diffEngineVersion:z,facets:a.z.array(Ur)}).strict().superRefine((e,t)=>{(e.facets.length!==re.length||e.facets.some((n,r)=>n.facet!==re[r]))&&d(t,["facets"],"A comparison carries every facet once, in display order.")}),Ie=e=>a.z.object({kind:a.z.literal("readable"),item:e}).strict(),jt=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("run"),startedAt:N,finishedAt:N.nullable(),status:Ue}).strict(),Ei=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("ingest"),createdAt:N,updatedAt:N,syncStatus:ct.nullable()}).strict(),bi=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("failure"),failedAt:N.nullable(),syncStatus:Ct}).strict(),zr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("state"),settledAt:N}).strict(),Hr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("change"),settledAt:N}).strict();function Ci(e,t){let n=e.cause==="RUN";e.runId!==null!==n&&d(t,["runId"],"A RUN state names its run; no other state does."),e.runOutcome!==null!==n&&d(t,["runOutcome"],"A RUN state carries the worker's outcome; no other state does."),e.changes!==null!=(e.previousStateId!==null)&&d(t,["changes"],"A state carries its counts exactly when its predecessor is readable."),e.diffEngineVersion!==null!=(e.changes!==null)&&d(t,["diffEngineVersion"],"The engine version comes with the counts it produced."),e.modelOnlyChange&&e.changes===null&&d(t,["modelOnlyChange"],"Only a change with counts can be a model-only change."),e.previousStateId===e.stateId&&d(t,["previousStateId"],"A state does not precede itself.")}var jr=a.z.object({stateId:z,revision:z,cause:Mt,runId:z.nullable(),runOutcome:or.nullable(),settledAt:N,actor:a.z.string().min(1),classification:a.z.object({confidentialityLevel:Ut,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable()}).strict(),modelOnlyChange:a.z.boolean(),previousStateId:z.nullable(),changes:Tr.nullable(),diffEngineVersion:z.nullable()}).strict().superRefine(Ci),Kr=a.z.discriminatedUnion("kind",[Ie(jr),zr]),Gr=a.z.discriminatedUnion("kind",[Ie(Rt),jt]),_i=a.z.discriminatedUnion("kind",[Ie(It),jt]),Br=(e,t,n)=>{for(let r=1;r<e.length;r++)Y(e[r-1],e[r])&&d(t,[...n,r],"Entries are listed newest first.")},He=e=>e.kind==="readable"?e.item.settledAt:e.settledAt;function Ri(e,t){pe(e.revisions,(r,o)=>o.revision-r.revision,t,["revisions"],"Revisions are listed newest first, each once.");let n=e.revisions.filter(r=>r.isCurrent);(n.length!==1||n[0]?.metadataId!==e.document.metadataId||n[0].revision!==e.document.revision)&&d(t,["revisions"],"Exactly one revision is current: the row the history names."),Br(e.states.map(He),t,["states"])}var Ii=a.z.object({document:a.z.object({metadataId:z,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:z,confidentialityLevel:Ut}).strict(),revisions:a.z.array(a.z.object({metadataId:z,revision:z,revisionId:a.z.string().nullable(),isCurrent:a.z.boolean()}).strict()),states:a.z.array(Kr),runs:a.z.array(Gr)}).strict().superRefine(Ri),Vr=a.z.object({stateId:z,previousStateId:z,metadataId:z,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:z,previousRevision:z,cause:Mt,actor:a.z.string().min(1),settledAt:N,changes:Tr}).strict().superRefine((e,t)=>{e.previousStateId===e.stateId&&d(t,["previousStateId"],"A state does not precede itself.")}),Yr=a.z.discriminatedUnion("kind",[Ie(Vr),Hr]),Kt=a.z.object({settledAt:N,id:z.max(Number.MAX_SAFE_INTEGER)}).strict(),Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function xi(e){let t="";for(let n=0;n<e.length;n+=3){let r=e.length-n,o=e[n]<<16|(r>1?e[n+1]:0)<<8|(r>2?e[n+2]:0);t+=Re[o>>18&63]+Re[o>>12&63],r>1&&(t+=Re[o>>6&63]),r>2&&(t+=Re[o&63])}return t}function Ai(e){if(e.length%4===1)return null;let t=[],n=0,r=0;for(let o of e){let i=Re.indexOf(o);if(i===-1)return null;n=n<<6|i,r+=6,r>=8&&(r-=8,t.push(n>>r&255),n&=(1<<r)-1)}return Uint8Array.from(t)}function Jr(e){let{settledAt:t,id:n}=Kt.parse(e);return xi(new TextEncoder().encode(H({id:n,settledAt:t})))}function $r(e){let t=Ai(e);if(t===null)return null;let n;try{n=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t))}catch{return null}let r=Kt.safeParse(n);return r.success&&Jr(r.data)===e?r.data:null}var Ti=a.z.object({rows:a.z.array(Yr).max(Lt),next:a.z.string().nullable()}).strict().superRefine((e,t)=>{Br(e.rows.map(He),t,["rows"]),e.next!==null&&e.rows.length===0&&d(t,["next"],"An empty page has no next page.");let n=e.next===null?null:$r(e.next);e.next!==null&&n===null&&d(t,["next"],"The next position is a cursor encodeChangeFeedCursor wrote.");let r=e.rows[e.rows.length-1];n!==null&&r!==void 0&&(Y(n.settledAt,He(r))||Y(He(r),n.settledAt))&&d(t,["next"],"The next position is the arriving state of the page's last row."),n!==null&&r?.kind==="readable"&&n.id!==r.item.stateId&&d(t,["next"],"The next position names the arriving state of the page's last readable row.")}),Ni=a.z.object({outcome:hr}).strict();var Di=Object.freeze({integrityRun:"integrity_run",resyncRequired:"resync-required"});var p=require("zod");var qr=[{code:"DEPLOYMENT_DISABLED",status:503,errorCode:5035},{code:"RUN_ALREADY_ACTIVE",status:409,errorCode:4091},{code:"BASIS_INVALID",status:409,errorCode:4092},{code:"RUN_ALREADY_FINISHED",status:409,errorCode:4093},{code:"FORBIDDEN",status:403,errorCode:null}];var Xr={INTEGRITY_TOMBSTONE_RETENTION_DAYS:{min:1,max:3650},INTEGRITY_FINDING_SAMPLE_LIMIT:{min:1,max:5e3},INTEGRITY_RUN_HEARTBEAT_TIMEOUT_SECONDS:{min:30,max:3600},INTEGRITY_RUN_RETENTION_COUNT:{min:2,max:100},POLICY_CONFLICT_MAX_TIE_GROUP_SIZE:{min:2,max:60},CHILD_TREE_MAX_NODES:{min:1,max:1e5},CHILD_TREE_MAX_TOTAL_BYTES:{min:1048576,max:4294967296},CHILD_TREE_MAX_SECONDS:{min:60,max:3600},ARCHIVE_MAX_MEMBER_BYTES:{min:65536,max:1073741824},ARCHIVE_MAX_COMPRESSION_RATIO:{min:10,max:1e4},ARCHIVE_READER_MAX_MEMORY_BYTES:{min:268435456,max:17179869184},ARCHIVE_READER_MAX_SECONDS:{min:10,max:3600}};var wi=e=>{for(let t of Object.values(e))Object.freeze(t);return Object.freeze(e)},xe=wi(Xr),Wr=e=>Object.hasOwn(xe,e),Zr=(e,t)=>{let{min:n,max:r}=xe[e];if(!Number.isInteger(t)||t<n||t>r)throw new RangeError(`${e} \u306F ${n}\u301C${r} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)},ki=(e,t)=>{Wr(e)&&Zr(e,t)},Fi=(e,t)=>{if(!Wr(e))throw new TypeError(`The range table bounds no parameter named ${JSON.stringify(e)}.`);Zr(e,t)};var qe=p.z.enum(["QDRANT","NEO4J"]),eo=p.z.enum(["PRODUCTION","VARIANT","LABEL"]),Yt=p.z.enum(["EXPECTED","LIVE","HISTORY","TOMBSTONE","AWAITING_SUCCESSOR","IN_FLIGHT","UNPLACED","UNRECORDED","UNREFERENCED","CHANGED_AFTER_START","PIPELINE_FAILED","PROJECTION_REFUSED","ORPHAN","TOMBSTONE_EXPIRED","UNPROPAGATED_DELETE","STALE_REVISION","MISPLACED","OUT_OF_TIER","UNMARKED_SUPERSEDED","FLAG_DRIFT","VARIANT_FLAG_DRIFT","DETACHED","UNKEYED","MISSING","COUNT_MISMATCH","UNPROJECTED","UNKEYED_ENTITY"]),Jt=Yt.exclude(["EXPECTED","LIVE","HISTORY"]),to=p.z.enum(["POINT","NODE","CHUNK","DOCUMENT"]),no=p.z.enum(["EXPECTED","HEALTHY","RETAINED","INFORMATIONAL","DISCREPANCY"]),ro=p.z.enum(["NONE","PURGE","FLAG","REPROJECT"]),P=(e,t)=>Object.freeze({disposition:e,repairAction:t}),oo=Object.freeze({EXPECTED:P("EXPECTED","NONE"),LIVE:P("HEALTHY","NONE"),HISTORY:P("RETAINED","NONE"),TOMBSTONE:P("RETAINED","NONE"),AWAITING_SUCCESSOR:P("RETAINED","NONE"),IN_FLIGHT:P("INFORMATIONAL","NONE"),UNPLACED:P("INFORMATIONAL","NONE"),UNRECORDED:P("INFORMATIONAL","NONE"),UNREFERENCED:P("INFORMATIONAL","NONE"),CHANGED_AFTER_START:P("INFORMATIONAL","NONE"),PIPELINE_FAILED:P("INFORMATIONAL","NONE"),PROJECTION_REFUSED:P("INFORMATIONAL","NONE"),ORPHAN:P("DISCREPANCY","PURGE"),TOMBSTONE_EXPIRED:P("DISCREPANCY","PURGE"),UNPROPAGATED_DELETE:P("DISCREPANCY","FLAG"),STALE_REVISION:P("DISCREPANCY","PURGE"),MISPLACED:P("DISCREPANCY","PURGE"),OUT_OF_TIER:P("DISCREPANCY","PURGE"),UNMARKED_SUPERSEDED:P("DISCREPANCY","FLAG"),FLAG_DRIFT:P("DISCREPANCY","REPROJECT"),VARIANT_FLAG_DRIFT:P("DISCREPANCY","NONE"),DETACHED:P("DISCREPANCY","PURGE"),UNKEYED:P("DISCREPANCY","PURGE"),MISSING:P("DISCREPANCY","REPROJECT"),COUNT_MISMATCH:P("DISCREPANCY","REPROJECT"),UNPROJECTED:P("DISCREPANCY","REPROJECT"),UNKEYED_ENTITY:P("DISCREPANCY","NONE")}),ao=p.z.enum(["SCAN","REPAIR"]),io=p.z.enum(["RUNNING","COMPLETED","FAILED","CANCELLED","ABANDONED"]),so=p.z.enum(["CONSISTENT","INCONSISTENT","UNDETERMINED"]),lo=p.z.enum(["QDRANT","NEO4J","DOCUMENTS"]),co=p.z.enum(["APPLIED","SKIPPED","FAILED"]),uo=p.z.enum(["RECLASSIFIED","IN_FLIGHT","DESTINATION_PENDING","BASIS_EXHAUSTED","PROJECTION_REFUSED","PIPELINE_FAILED","UNRECORDED","OUTSIDE"]),$t=100,K=p.z.number().int().nonnegative(),$e=p.z.number().int().min(300).max(599),Gt=["repairedCount","repairFailedCount","repairSkippedCount"],po=p.z.string().regex(/^[0-9a-f]{64}$/,"A store fingerprint is 64 lowercase hexadecimal digits."),Qr=xe.INTEGRITY_TOMBSTONE_RETENTION_DAYS,Li=p.z.object({runUid:ce,mode:ao,status:io,requestedBy:p.z.string().min(1),executor:p.z.string().min(1),basisRunUid:ce.nullable(),storeFingerprint:po,tombstoneRetentionDays:p.z.number().int().min(Qr.min).max(Qr.max),startedAt:N,finishedAt:N.nullable(),verdict:so.nullable(),errorClass:p.z.string().min(1).nullable(),reprojectDocuments:K.nullable(),reprojectRebuildDocuments:K.nullable()}).strict(),vi=(e,t)=>{let n=e.status==="COMPLETED";e.mode==="REPAIR"!=(e.basisRunUid!==null)&&d(t,["basisRunUid"],"A REPAIR run names its basis SCAN run, and a SCAN run names none."),n!==(e.verdict!==null)&&d(t,["verdict"],"Only a COMPLETED run has a verdict."),n!==(e.reprojectDocuments!==null)&&d(t,["reprojectDocuments"],"Only a COMPLETED run has the count of documents to re-project.");let{reprojectDocuments:r,reprojectRebuildDocuments:o}=e;r===null||o===null?r!==o&&d(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are counted together with the documents it re-projects."):o>r&&d(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are no more than the documents it re-projects."),e.status==="RUNNING"!=(e.finishedAt===null)&&d(t,["finishedAt"],"Only a RUNNING run has not finished."),e.finishedAt!==null&&Y(e.finishedAt,e.startedAt)&&d(t,["finishedAt"],"A run does not finish before it starts."),(e.status==="FAILED"||e.status==="ABANDONED")!=(e.errorClass!==null)&&d(t,["errorClass"],"Only a FAILED or ABANDONED run names an error class.")},Xe=Li.superRefine(vi),Mi=p.z.object({store:qe,scopeKey:p.z.string().min(1),scopeRole:eo,itemClass:Yt,unit:to,disposition:no,repairAction:ro,itemCount:K.nullable(),unmeasuredReason:p.z.string().min(1).nullable(),measuredAt:N.nullable(),repairedCount:K.nullable(),repairFailedCount:K.nullable(),repairSkippedCount:K.nullable()}).strict(),Ui=(e,t)=>{let n=oo[e.itemClass];e.disposition!==n.disposition&&d(t,["disposition"],`A ${e.itemClass} quantity is ${n.disposition}.`),e.repairAction!==n.repairAction&&d(t,["repairAction"],`A repair's action on ${e.itemClass} items is ${n.repairAction}.`);let r=e.itemCount===null;r!==(e.unmeasuredReason!==null)&&d(t,["unmeasuredReason"],"An unmeasured quantity (itemCount null) has a reason, and a measured one has none."),r!==(e.measuredAt===null)&&d(t,["measuredAt"],"Only a measured quantity has a measurement time.");let{repairedCount:o,repairFailedCount:i,repairSkippedCount:s}=e;if(o===null||i===null||s===null){if(Gt.some(l=>e[l]!==null))for(let l of Gt)e[l]===null&&d(t,[l],"The repaired, failed and skipped counts are recorded together or not at all.");return}e.repairAction==="NONE"&&d(t,["repairAction"],"Only a class with a repair action carries repair counts."),e.itemCount!==null&&o+i+s>e.itemCount&&d(t,["itemCount"],"The repaired, failed and skipped counts together do not exceed the measured count.")},mo=Mi.superRefine(Ui),zi=p.z.object({run:Xe,phase:lo.nullable(),phaseScope:p.z.string().min(1).nullable(),phaseDone:K.nullable(),phaseTotal:K.nullable(),heartbeatAt:N,isStale:p.z.boolean(),staleAfter:N,cancelRequestedAt:N.nullable()}).strict(),Hi=(e,t)=>{if(e.run.status!=="RUNNING"&&d(t,["run","status"],"The active run is a RUNNING run."),Y(e.heartbeatAt,e.run.startedAt)&&d(t,["heartbeatAt"],"A run's heartbeat is not earlier than its start."),N.safeParse(e.heartbeatAt).success&&N.safeParse(e.staleAfter).success&&!Y(e.heartbeatAt,e.staleAfter)&&d(t,["staleAfter"],"A run's heartbeat goes stale only after it beat."),e.phase===null)for(let n of["phaseScope","phaseDone","phaseTotal"])e[n]!==null&&d(t,[n],"A run with no phase has no phase progress.");e.phase==="DOCUMENTS"&&e.phaseScope!==null&&d(t,["phaseScope"],"The DOCUMENTS phase scans no scope.")},fo=zi.superRefine(Hi),ji=p.z.object({run:Xe,quantities:p.z.array(mo),previousStoreFingerprint:po.nullable()}).strict(),Ki=(e,t)=>{e.run.status!=="COMPLETED"&&d(t,["run","status"],"The last completed run is a COMPLETED run.");let n=new Set;for(let[r,o]of e.quantities.entries()){let i=JSON.stringify([o.store,o.scopeKey,o.itemClass]);if(n.has(i)&&d(t,["quantities",r],"A run records each (store, scope, class) cell once."),n.add(i),e.run.mode==="SCAN")for(let s of Gt)o[s]!==null&&d(t,["quantities",r,s],"A SCAN run repairs nothing, so its quantities carry no repair counts.")}},Gi=["FAILED","CANCELLED","ABANDONED"],Bi=p.z.object({run:Xe,repairAppliedItems:K.nullable(),hasNewerRepair:p.z.boolean()}).strict(),Vi=(e,t)=>{Gi.includes(e.run.status)||d(t,["run","status"],"A newer unsuccessful run is FAILED, CANCELLED or ABANDONED."),e.run.mode==="SCAN"&&e.repairAppliedItems!==null&&d(t,["repairAppliedItems"],"A SCAN run applies nothing."),e.run.mode==="REPAIR"&&!e.hasNewerRepair&&d(t,["hasNewerRepair"],"An unsuccessful REPAIR run is itself a repair newer than the last completed run.")},Yi=p.z.object({readAt:N,lastCompleted:ji.superRefine(Ki).nullable(),active:fo.nullable(),newerUnsuccessful:Bi.superRefine(Vi).nullable()}).strict(),Ji=p.z.object({sequence:p.z.number().int().min(1),itemKey:p.z.string().min(1),metadataId:p.z.number().int().positive().nullable(),fileUri:p.z.string().nullable(),revision:p.z.number().int().nullable(),observed:p.z.record(p.z.string(),p.z.unknown()),repairOutcome:co.nullable(),repairErrorClass:p.z.string().min(1).nullable(),repairSkipReason:uo.nullable()}).strict(),$i=(e,t)=>{e.repairOutcome==="FAILED"!=(e.repairErrorClass!==null)&&d(t,["repairErrorClass"],"Only a FAILED finding names an error class."),e.repairOutcome==="SKIPPED"!=(e.repairSkipReason!==null)&&d(t,["repairSkipReason"],"Only a SKIPPED finding names a skip reason.")},ho=Ji.superRefine($i),qi=p.z.object({sotDomain:p.z.string().nullable()}).passthrough(),Xi=p.z.object({rows:p.z.array(ho),nextAfter:p.z.number().int().min(1).nullable(),recordedCount:K,totalCount:K.nullable()}).strict(),Wi=(e,t)=>{for(let[n,r]of e.rows.entries()){let o=e.rows[n-1];o!==void 0&&r.sequence<=o.sequence&&d(t,["rows",n,"sequence"],"A page lists its rows in ascending sequence.")}e.nextAfter!==null&&e.nextAfter!==e.rows.at(-1)?.sequence&&d(t,["nextAfter"],"The next page starts after the sequence of this page's last row.")},Zi=Xi.superRefine(Wi),Qi=p.z.object({runUid:ce,store:qe,scopeKey:p.z.string().min(1),itemClass:Jt,after:p.z.number().int().min(1).optional(),limit:p.z.number().int().min(1).max($t)}).strict(),es=p.z.object({runUid:ce,store:qe,scopeKey:p.z.string().min(1),itemClass:Jt.extract(["UNRECORDED"]),after:p.z.number().int().min(1).optional()}).strict(),ts=p.z.object({requeued:K,skipped:p.z.array(p.z.object({metadataId:p.z.number().int().min(1),reason:p.z.string().min(1)}).strict()),nextAfter:p.z.number().int().min(1).nullable()}).strict(),ns=ts.superRefine(Fe($t)),We=p.z.enum(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Bt=p.z.enum(["start","cancel"]),yo=We.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","FORBIDDEN","UPSTREAM_FAILED"]),go=We.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Vt={start:yo,cancel:go},rs=p.z.object({code:We.exclude(["UPSTREAM_FAILED"]),status:$e,errorCode:p.z.number().int().nullable()}).strict(),qt=Object.freeze(p.z.array(rs).parse(qr).map(e=>Object.freeze(e))),os=(e,t)=>{e.code==="UPSTREAM_FAILED"||e.code==="FORBIDDEN"&&e.status===null||qt.some(n=>n.code===e.code&&n.status===e.status)||d(t,["status"],`A ${e.code} failure carries the status of its row in the code table.`)},as=p.z.discriminatedUnion("command",[p.z.object({command:Bt.extract(["start"]),code:Vt.start,status:$e.nullable()}).strict(),p.z.object({command:Bt.extract(["cancel"]),code:Vt.cancel,status:$e.nullable()}).strict()]).superRefine(os),is=(e,t,n)=>{let r=Vt[e],o=qt.find(i=>i.status===t&&(i.errorCode===null||i.errorCode===n)&&r.safeParse(i.code).success);return o===void 0?"UPSTREAM_FAILED":o.code},ss=p.z.discriminatedUnion("ok",[p.z.object({ok:p.z.literal(!0),runUid:ce}).strict(),p.z.object({ok:p.z.literal(!1),status:$e,errorCode:p.z.number().int().nullable()}).strict()]);function So(e){let t=[];for(let r=0;r<e.length;r++){t.push(r);let o=e.charCodeAt(r);o>=55296&&o<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320&&r++}t.push(e.length);let n=t.length-1;return{length:n,slice(r,o){if(!(Number.isInteger(r)&&Number.isInteger(o))||r<0||r>o)throw new RangeError(`A code-point span is [charStart, charEnd) with 0 <= charStart <= charEnd: [${r}, ${o})`);return o>n?null:e.slice(t[r],t[o])}}}var Eo=e=>e.replace(/\s/gu,"");function oe(e,t){let n=new Map,r=i=>{let s=new Int32Array(i.length);return i.forEach((l,c)=>{let h=n.get(l);h===void 0&&(h=n.size,n.set(l,h)),s[c]=h}),s};return{old:r(e),new:r(t),alphabetSize:n.size}}function Ze(e,t,n,r){if(r===0)return;let o=e[e.length-1];if(o!==void 0&&o.oldStart+o.length===t&&o.newStart+o.length===n){o.length+=r;return}e.push({oldStart:t,newStart:n,length:r})}function bo(e,t,n,r,o,i,s){let l=0;for(;n+l<r&&o+l<i&&e[n+l]===t[o+l];)l++;Ze(s,n,o,l);let c=0;for(;r-c>n+l&&i-c>o+l&&e[r-1-c]===t[i-1-c];)c++;return{oldLow:n+l,oldHigh:r-c,newLow:o+l,newHigh:i-c,suffix:c}}function ls(e,t,n){let{oldLow:r,oldHigh:o,newLow:i,newHigh:s}=n,l=o-r,c=s-i,h=Math.ceil((l+c)/2),u=h,y=2*h+2,E=new Int32Array(y).fill(-1),A=new Int32Array(y).fill(-1);E[u+1]=0,A[u+1]=0;let b=l-c,O=b%2!==0,w=0,g=0,D=0,f=0;for(let _=0;_<h;_++){for(let T=-_+w;T<=_-g;T+=2){let I=u+T,x=T===-_||T!==_&&E[I-1]<E[I+1]?E[I+1]:E[I-1]+1,v=x-T;for(;x<l&&v<c&&e[r+x]===t[i+v];)x++,v++;if(E[I]=x,x>l)g+=2;else if(v>c)w+=2;else if(O){let U=u+b-T;if(U>=0&&U<y&&A[U]!==-1&&x>=l-A[U])return{kind:"split",oldSplit:r+x,newSplit:i+v}}}for(let T=-_+D;T<=_-f;T+=2){let I=u+T,x=T===-_||T!==_&&A[I-1]<A[I+1]?A[I+1]:A[I-1]+1,v=x-T;for(;x<l&&v<c&&e[o-1-x]===t[s-1-v];)x++,v++;if(A[I]=x,x>l)f+=2;else if(v>c)D+=2;else if(!O){let U=u+b-T;if(U>=0&&U<y&&E[U]!==-1){let C=E[U];if(C>=l-x)return{kind:"split",oldSplit:r+C,newSplit:i+u+C-U}}}}}return{kind:"disjoint"}}function ae(e,t){let n=[],r=[{kind:"region",oldLow:0,oldHigh:e.length,newLow:0,newHigh:t.length}];for(let o=r.pop();o!==void 0;o=r.pop()){if(o.kind==="run"){Ze(n,o.oldStart,o.newStart,o.length);continue}let i=bo(e,t,o.oldLow,o.oldHigh,o.newLow,o.newHigh,n);if(r.push({kind:"run",oldStart:i.oldHigh,newStart:i.newHigh,length:i.suffix}),i.oldLow===i.oldHigh||i.newLow===i.newHigh)continue;let s=ls(e,t,i);s.kind==="split"&&(r.push({kind:"region",oldLow:s.oldSplit,oldHigh:i.oldHigh,newLow:s.newSplit,newHigh:i.newHigh}),r.push({kind:"region",oldLow:i.oldLow,oldHigh:s.oldSplit,newLow:i.newLow,newHigh:s.newSplit}))}return n}function Co(e,t,n){let r=Math.ceil(t.length/32),o=new Array(n);t.forEach((l,c)=>{let h=o[l];h===void 0&&(h=new Uint32Array(r),o[l]=h),h[c>>>5]=(h[c>>>5]|1<<(c&31))>>>0});let i=new Uint32Array(r).fill(4294967295);for(let l of e){let c=o[l];if(c===void 0)continue;let h=0;for(let u=0;u<r;u++){let y=i[u],E=(y&c[u])>>>0,A=y+E+h;h=A>4294967295?1:0,i[u]=(A>>>0|y&~c[u])>>>0}}let s=0;for(let l=0;l<t.length;l++)s+=i[l>>>5]>>>(l&31)&1;return t.length-s}function cs(e,t,n){if(e.occurrences!==t.occurrences)return e.occurrences<t.occurrences;if(e.length!==t.length)return e.length>t.length;let r=Math.abs(2*e.oldStart+e.length-n),o=Math.abs(2*t.oldStart+t.length-n);return r!==o?r<o:e.newStart<t.newStart||e.newStart===t.newStart&&e.oldStart<t.oldStart}function _o(e,t){let{old:n,new:r,alphabetSize:o}=e,i=new Int32Array(o),s=new Int32Array(o),l=new Int32Array(o).fill(-1),c=new Int32Array(n.length),h=[],u=[{kind:"region",oldLow:0,oldHigh:n.length,newLow:0,newHigh:r.length}];for(let y=u.pop();y!==void 0;y=u.pop()){if(y.kind==="run"){Ze(h,y.oldStart,y.newStart,y.length);continue}let E=bo(n,r,y.oldLow,y.oldHigh,y.newLow,y.newHigh,h),A={kind:"run",oldStart:E.oldHigh,newStart:E.newHigh,length:E.suffix},{oldLow:b,oldHigh:O,newLow:w,newHigh:g}=E;if(b===O||w===g){u.push(A);continue}for(let I=O-1;I>=b;I--){let x=n[I];i[x]++,c[I]=l[x],l[x]=I}let D={best:null},f=I=>{(D.best===null||cs(I,D.best,b+O))&&(D.best=I)},_=new Map;for(let I=w;I<g;I++){let x=r[I],v=i[x];if(!(v===0||v>t.maxOccurrences||D.best!==null&&v>D.best.occurrences))for(let U=l[x];U!==-1;U=c[U]){let C=_.get(I-U);if(C!==void 0&&I>=C.newStart&&I<C.newEnd){v<C.occurrences&&(C.occurrences=v,f({occurrences:v,oldStart:C.oldStart,newStart:C.newStart,length:C.newEnd-C.newStart}));continue}let M=U,L=I;for(;M>b&&L>w&&n[M-1]===r[L-1];)M--,L--;let j=U-M+1;for(;M+j<O&&L+j<g&&n[M+j]===r[L+j];)j++;_.set(I-U,{oldStart:M,newStart:L,newEnd:L+j,occurrences:v}),f({occurrences:v,oldStart:M,newStart:L,length:j})}}let T=D.best;T!==null?(u.push(A),u.push({kind:"region",oldLow:T.oldStart+T.length,oldHigh:O,newLow:T.newStart+T.length,newHigh:g}),u.push({kind:"run",oldStart:T.oldStart,newStart:T.newStart,length:T.length}),u.push({kind:"region",oldLow:b,oldHigh:T.oldStart,newLow:w,newHigh:T.newStart})):(ds(n,r,E,i,s,t.cellBound,h),u.push(A));for(let I=b;I<O;I++){let x=n[I];i[x]=0,l[x]=-1}}return h}function ds(e,t,n,r,o,i,s){let{oldLow:l,oldHigh:c,newLow:h,newHigh:u}=n;if((c-l)*(u-h)>i)return;for(let b=h;b<u;b++)o[t[b]]++;let y=[];for(let b=l;b<c;b++)o[e[b]]>0&&y.push(b);let E=[];for(let b=h;b<u;b++)r[t[b]]>0&&E.push(b),o[t[b]]=0;let A=ae(Int32Array.from(y,b=>e[b]),Int32Array.from(E,b=>t[b]));for(let b of A)for(let O=0;O<b.length;O++)Ze(s,y[b.oldStart+O],E[b.newStart+O],1)}function Ro(e,t,n){let r=[],o=0,i=0;for(let s of[...n,{oldStart:e,newStart:t,length:0}])(s.oldStart>o||s.newStart>i)&&r.push({oldStart:o,oldEnd:s.oldStart,newStart:i,newEnd:s.newStart}),o=s.oldStart+s.length,i=s.newStart+s.length;return r}function Xt(e,t,n,r){let o=new Map;for(let s of t){let l=r(s);l!==null&&o.set(l,[...o.get(l)??[],s])}let i=[];for(let s of e){let l=n(s),c=l===null?void 0:o.get(l)?.shift();c!==void 0&&i.push([s,c])}return i}function Io(e,t){let n=new Map;for(let r of e){let o=t[r].clause;o!==null&&n.set(o,(n.get(o)??0)+1)}return n}var $=e=>e.flatMap((t,n)=>t===null?[n]:[]);function Wt(e,t){let n=e?.children??[],r=t?.children??[],o=oe(n.map(f=>f.hash),r.map(f=>f.hash)),i=n.map(()=>null),s=r.map(()=>null),l=[],c=n.map(()=>0),h=r.map(()=>0);for(let f of ae(o.old,o.new))for(let _=0;_<f.length;_++)i[f.oldStart+_]=f.newStart+_,s[f.newStart+_]=f.oldStart+_;let u=0;n.forEach((f,_)=>{c[_]=u,u+=i[_]===null?0:1}),u=0,r.forEach((f,_)=>{h[_]=u,s[_]!==null&&(l.push(_),u++)});let y=[],E=(f,_,T)=>{for(let[I,x]of f)i[I]=x,s[x]=I,y.push({entry:{kind:_,pairing:T,oldPosition:I,newPosition:x},order:[x,1,x]})},A=f=>n[f],b=f=>r[f];E(Xt($(i),$(s),f=>A(f).hash,f=>b(f).hash),"MOVED",null);let O=Io($(i),n),w=Io($(s),r),g=f=>f.clause!==null&&O.get(f.clause)===1&&w.get(f.clause)===1?f.clause:null;E(Xt($(i),$(s),f=>g(A(f)),f=>g(b(f))),"MODIFIED","clause"),E(Xt($(i),$(s),f=>JSON.stringify([c[f],A(f).breadcrumbs]),f=>JSON.stringify([h[f],b(f).breadcrumbs])),"MODIFIED","breadcrumbs");for(let f of $(i)){let _=c[f],T=_===0?0:l[_-1]+1;y.push({entry:{kind:"REMOVED",pairing:null,oldPosition:f,newPosition:null},order:[T,0,f]})}for(let f of $(s))y.push({entry:{kind:"ADDED",pairing:null,oldPosition:null,newPosition:f},order:[f,1,f]});y.sort((f,_)=>f.order[0]-_.order[0]||f.order[1]-_.order[1]||f.order[2]-_.order[2]);let D=f=>y.filter(({entry:_})=>_.kind===f).length;return{entries:y.map(({entry:f})=>f),stats:{added:D("ADDED"),removed:D("REMOVED"),modified:D("MODIFIED"),moved:D("MOVED"),unchanged:l.length}}}var Qe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),me=(e,t)=>`${e}/${String(t).replace(/~/g,"~0").replace(/\//g,"~1")}`;function Zt(e,t,n,r,o){H(t)!==H(n)&&(Qe(t)&&Qe(n)?us(e,t,n,r,o):Array.isArray(t)&&Array.isArray(n)?ps(e,t,n,r,o):r.push({op:"replace",path:e,value:n,previous:t}))}function us(e,t,n,r,o){let i=[...new Set([...Object.keys(t),...Object.keys(n)])].sort(J);for(let s of i){let l=me(e,s);Object.hasOwn(n,s)?Object.hasOwn(t,s)?Zt(l,t[s],n[s],r,o):r.push({op:"add",path:l,value:n[s]}):r.push({op:"remove",path:l,previous:t[s]})}}function ps(e,t,n,r,o){let i=oe(t.map(H),n.map(H)),s=0;for(;s<t.length&&s<n.length&&i.old[s]===i.new[s];)s++;let l=0;for(;l<t.length-s&&l<n.length-s&&i.old[t.length-1-l]===i.new[n.length-1-l];)l++;let c=(t.length-s-l)*(n.length-s-l);if(c>o.remaining){r.push({op:"replace",path:e,value:n,previous:t});return}o.remaining-=c;let h=0,u=0,y=0;for(let E of[...ae(i.old,i.new),{oldStart:t.length,newStart:n.length,length:0}]){let A=t.slice(u,E.oldStart),b=n.slice(y,E.newStart),O=Math.min(A.length,b.length);for(let w=0;w<O;w++){let g=A[w],D=b[w];Qe(g)&&Qe(D)||Array.isArray(g)&&Array.isArray(D)?Zt(me(e,h),g,D,r,o):(r.push({op:"remove",path:me(e,h),previous:g}),r.push({op:"add",path:me(e,h),value:D})),h++}for(let w of A.slice(O))r.push({op:"remove",path:me(e,h),previous:w});for(let w of b.slice(O))r.push({op:"add",path:me(e,h),value:w}),h++;h+=E.length,u=E.oldStart+E.length,y=E.newStart+E.length}}function Qt(e,t){let n=[];return Zt("",e,t,n,{remaining:kt}),n}function xo(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!="object"||n===null||Array.isArray(n))continue;let{start:r,end:o,page_number:i}=n;Number.isInteger(r)&&Number.isInteger(o)&&Number.isInteger(i)&&t.push({start:r,end:o,pageNumber:i})}return t.sort((n,r)=>n.start-r.start)}function en(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i].start<=t?n=i+1:r=i}let o=e[n-1];return o!==void 0&&t<o.end?o.pageNumber:null}function Ao(e){let t=[],n=[],r={LF:0,CRLF:0,CR:0},o=0,i=0,s=0;for(let u=0;u<e.length;){let y=e.charCodeAt(u);if(y===10||y===13){t.push(e.slice(o,u)),n.push(s);let E=y===13&&e.charCodeAt(u+1)===10?2:1;r[E===2?"CRLF":y===13?"CR":"LF"]++,u+=E,i+=E,o=u,s=i;continue}u+=y>=55296&&y<=56319&&(e.charCodeAt(u+1)&64512)===56320?2:1,i++}o<e.length&&(t.push(e.slice(o)),n.push(s));let l=r.LF+r.CRLF+r.CR,c=["LF","CRLF","CR"].filter(u=>r[u]>0),h=l===0?"NONE":c.length===1?c[0]:"MIXED";return{lines:t,starts:n,lineEnding:h,finalNewline:l>0&&o===e.length}}var To=null;function No(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>767)return!1;return!0}function rn(e){return No(e)?e.split(""):(To??=new Intl.Segmenter("und",{granularity:"grapheme"}),Array.from(To.segment(e),t=>t.segment))}function tn(e){return No(e)?e.length:rn(e).length}function ms(e,t,n){let r=e.length+t.length;if(n.exhausted||e.length>Ge||t.length>Ge||r===0)return null;let o=oe(e,t),i=Co(o.old,o.new,o.alphabetSize);if(2*i/r<Be||r-2*i>Pt)return null;let s=r*(r-2*i);if(s>n.remaining)return n.exhausted=!0,null;n.remaining-=s;let l=ae(o.old,o.new),c=[],h=0,u=0;for(let g of[...l,{oldStart:e.length,newStart:t.length,length:0}])(g.oldStart>h||g.newStart>u)&&c.push({equal:!1,oldStart:h,oldEnd:g.oldStart,newStart:u,newEnd:g.newStart}),g.length>0&&c.push({equal:!0,oldStart:g.oldStart,oldEnd:g.oldStart+g.length,newStart:g.newStart,newEnd:g.newStart+g.length}),h=g.oldStart+g.length,u=g.newStart+g.length;let y=[];c.forEach((g,D)=>{let f=y[y.length-1],_=f!==void 0&&!f.equal,T=g.equal&&g.oldEnd-g.oldStart<=1&&_&&D+1<c.length;if(_&&(T||!g.equal)){f.oldEnd=g.oldEnd,f.newEnd=g.newEnd;return}y.push({...g})});let E=0,A=0,b=0,O=[],w=[];for(let g of y){let D=e.slice(g.oldStart,g.oldEnd).join(""),f=t.slice(g.newStart,g.newEnd).join("");if(g.equal){E+=g.oldEnd-g.oldStart,O.push({kind:"equal",text:D}),w.push({kind:"equal",text:f});continue}A+=g.oldEnd-g.oldStart,b+=g.newEnd-g.newStart,D!==""&&O.push({kind:"removed",text:D}),f!==""&&w.push({kind:"added",text:f})}return 2*E/r<Be?null:{oldSegments:O,newSegments:w,removed:A,added:b}}var Do={old:[],new:[]};function Ae(e){return e.filter(([,t,n])=>H(t)!==H(n)).map(([t,n,r])=>({field:t,before:n,after:r}))}var nn=(e,t)=>t===""?[]:[{kind:e,text:t}];function fs(e,t,n){let r=[],o=(l,c)=>({kind:"context",oldNumber:l+1,newNumber:c+1,page:en(n.pages.new,n.newText.starts[c]),segments:nn("equal",n.newText.lines[c])}),i=t.oldStart,s=t.newStart;for(let l of e){for(;i<l.oldStart;i++,s++)r.push(o(i,s));for(let c=l.oldStart;c<l.oldEnd;c++){let h=n.oldText.lines[c];r.push({kind:"removed",oldNumber:c+1,newNumber:null,page:en(n.pages.old,n.oldText.starts[c]),segments:n.removedSegments.get(c)??nn("removed",h)})}for(let c=l.newStart;c<l.newEnd;c++){let h=n.newText.lines[c];r.push({kind:"added",oldNumber:null,newNumber:c+1,page:en(n.pages.new,n.newText.starts[c]),segments:n.addedSegments.get(c)??nn("added",h)})}i=l.oldEnd,s=l.newEnd}for(;i<t.oldEnd;i++,s++)r.push(o(i,s));return r}function on(e,t,n,r){let o=Ao(e??""),i=Ao(t??""),s=Ae([["present",e!==null,t!==null],["lineEnding",o.lineEnding,i.lineEnding],["finalNewline",o.finalNewline,i.finalNewline]]),l=_o(oe(o.lines,i.lines),{maxOccurrences:Dt,cellBound:Ot}),c=Ro(o.lines.length,i.lines.length,l),h=new Map,u=new Map,y={remaining:wt,exhausted:!1},E=0,A=0,b=0,O=0,w=0,g=0;for(let C of c){b+=C.oldEnd-C.oldStart,O+=C.newEnd-C.newStart;let M=Math.min(C.oldEnd-C.oldStart,C.newEnd-C.newStart);for(let L=0;C.oldStart+L<C.oldEnd||C.newStart+L<C.newEnd;L++){let j=C.oldStart+L,G=C.newStart+L;if(L>=M){let ye=j<C.oldEnd?tn(o.lines[j]):0,se=G<C.newEnd?tn(i.lines[G]):0;w+=ye,g+=se,E+=ye,A+=se;continue}let q=rn(o.lines[j]),Z=rn(i.lines[G]);w+=q.length,g+=Z.length;let Q=ms(q,Z,y);if(Q!==null){h.set(j,Q.oldSegments),u.set(G,Q.newSegments),E+=Q.removed,A+=Q.added;continue}E+=q.length,A+=Z.length}}let D=0;for(let C of l)for(let M=C.oldStart;M<C.oldStart+C.length;M++)D+=tn(o.lines[M]);let f=D+w,_=D+g,T={linesAdded:O,linesRemoved:b,linesUnchanged:o.lines.length-b,charsAdded:A,charsRemoved:E,similarity:f+_===0?null:2*(f-E)/(f+_)},I=r==="whole"?Math.max(o.lines.length,i.lines.length):r,x=[];for(let C of c){let M=x[x.length-1],L=M?.[M.length-1];M!==void 0&&L!==void 0&&C.oldStart-L.oldEnd<=2*I?M.push(C):x.push([C])}let v={oldText:o,newText:i,pages:n,removedSegments:h,addedSegments:u},U=x.map((C,M)=>{let L=C[0],j=C[C.length-1],G=Math.max(0,L.oldStart-I),q=L.newStart-(L.oldStart-G),Z=Math.min(o.lines.length,j.oldEnd+I),Q=j.newEnd+(Z-j.oldEnd),ye=fs(C,{oldStart:G,oldEnd:Z,newStart:q},v);return{hunk:M,oldStart:Z>G?G+1:G,oldLines:Z-G,newStart:Q>q?q+1:q,newLines:Q-q,firstPage:ye[0].page,linesAdded:C.reduce((se,ge)=>se+ge.newEnd-ge.newStart,0),linesRemoved:C.reduce((se,ge)=>se+ge.oldEnd-ge.oldStart,0),lines:ye}});return{attributes:s,stats:T,hunks:U}}function Te(e,t){let n=on(e.body,t.body,{old:xo(e.pageOffsets),new:xo(t.pageOffsets)},Ke),r=Ae([["mime",e.mime,t.mime],["source",e.source,t.source],["isTruncated",e.isTruncated,t.isTruncated],["pageOffsets",e.pageOffsets,t.pageOffsets]]);return{...n,attributes:[...r,...n.attributes]}}function Ne(e,t){return on(e,t,Do,Ke)}function Oo(e,t){return on(e,t,Do,"whole")}function De(e){return{attributes:[...e.attributes],stats:e.stats,hunks:e.hunks.map(({lines:t,...n})=>n)}}function Po(e,t,n,r){let o=Number.isInteger(t)&&t>=0?e.hunks[t]:void 0;if(o===void 0)throw new RangeError(`The diff has no hunk ${t}.`);if(!Number.isInteger(n)||n<0||n>=o.lines.length)throw new RangeError(`Hunk ${t} has no line at offset ${n}.`);if(!Ht.safeParse(r).success)throw new RangeError(`A line page holds 1 to the page maximum lines, not ${r}.`);let i=Math.min(n+r,o.lines.length);return{lines:o.lines.slice(n,i),next:i<o.lines.length?i:null}}function et(e,t,n){let r=[...e].sort(t);for(let o=1;o<r.length;o++)if(t(r[o-1],r[o])===0)throw new RangeError(`A facet set holds the key ${JSON.stringify(n(r[o]))} more than once.`);return r}function wo(e,t,n,r){let o=0,i=0;for(;o<e.length||i<t.length;){let s=e[o],l=t[i],c=s===void 0?1:l===void 0?-1:n(s,l);r(c<=0?s:null,c>=0?l:null),o+=c<=0?1:0,i+=c>=0?1:0}}function an(e,t){let n=[],r=[],o=0;return wo(et(e??[],J,String),et(t??[],J,String),J,(i,s)=>{i!==null&&s!==null?o++:i!==null?r.push(i):n.push(s)}),{added:n,removed:r,unchangedCount:o}}function ko(e,t,n){let r=[],o=[],i=[],s=0;return wo(et(e,n.compare,n.keyOf),et(t,n.compare,n.keyOf),n.compare,(l,c)=>{if(l===null){r.push({key:n.keyOf(c),value:{...c}});return}if(c===null){o.push({key:n.keyOf(l),value:{...l}});return}let h=new Map(n.fieldsOf(c)),u=Ae(n.fieldsOf(l).map(([y,E])=>[y,E,h.get(y)]));u.length===0?s++:i.push({key:n.keyOf(l),fields:u})}),{added:r,removed:o,modified:i,unchangedCount:s}}var hs={compare:(e,t)=>J(e.labelKey,t.labelKey),keyOf:e=>e.labelKey,fieldsOf:e=>[["assignedBy",e.assignedBy],["confidenceScore",e.confidenceScore]]},ys={compare:Ve,keyOf:ee,fieldsOf:e=>[["mimeType",e.mimeType],["fileSize",e.fileSize],["textSha256",e.textSha256]]},sn=(e,t)=>ko(e,t,hs),ln=(e,t)=>ko(e,t,ys);function Oe(e,t,n){return Ae(n.map(r=>[r,e[r],t[r]]))}var vo=["confidentialityLevel","departmentId","folderPath","createdBy"],Mo=["fileName","filePath","fileId","revision","revisionId","fileSize","mimeType","fileHash","mtime"],ie=(e,t)=>({facet:e,addedCount:null,removedCount:null,modifiedCount:null,movedCount:null,unchangedCount:null,charsAdded:null,charsRemoved:null,...t}),Fo=(e,t)=>ie(e,{addedCount:t.stats.linesAdded,removedCount:t.stats.linesRemoved,unchangedCount:t.stats.linesUnchanged,charsAdded:t.stats.charsAdded,charsRemoved:t.stats.charsRemoved});function gs(e){switch(e.facet){case"classification":return ie("classification",{modifiedCount:Oe(e.from,e.to,vo).length});case"metadata":return ie("metadata",{modifiedCount:Oe(e.from,e.to,Mo).length});case"labels":case"assets":{let t=e.facet==="labels"?sn(e.from,e.to):ln(e.from,e.to);return ie(e.facet,{addedCount:t.added.length,removedCount:t.removed.length,modifiedCount:t.modified.length,unchangedCount:t.unchangedCount})}case"tags":{let t=an(e.from,e.to);return ie("tags",{addedCount:t.added.length,removedCount:t.removed.length,unchangedCount:t.unchangedCount})}case"structured_data":{let t=Qt(e.from,e.to),n=r=>t.filter(o=>o.op===r).length;return ie("structured_data",{addedCount:n("add"),removedCount:n("remove"),modifiedCount:n("replace")})}case"text":return Fo("text",Te(e.from,e.to));case"summary":return Fo("summary",Ne(e.from,e.to));case"chunks":{let{stats:t}=Wt(e.from,e.to);return ie("chunks",{addedCount:t.added,removedCount:t.removed,modifiedCount:t.modified,movedCount:t.moved,unchangedCount:t.unchanged})}}}function Uo(e){if(e.length===0)throw new RangeError("A change has at least one changed facet.");let t=new Set;for(let n of e){if(t.has(n.facet))throw new RangeError(`The ${n.facet} facet is given twice.`);if(t.add(n.facet),H(n.from)===H(n.to))throw new RangeError(`The ${n.facet} facet has equal values on both sides, so it did not change.`)}return[...e].sort((n,r)=>Ye(n.facet,r.facet)).map(gs)}var Ss=(e,t)=>({index:e.index,charStart:e.charStart,charEnd:e.charEnd,page:e.page,sheet:e.sheet,slide:e.slide,startSec:e.startSec,endSec:e.endSec,breadcrumbs:e.breadcrumbs,tokenCount:e.tokenCount,fidelity:t});function Lo(e,t){let n=e.facets.chunks?.children.length??0;if(e.chunkFidelities.length!==n)throw new RangeError(`The ${t} state has ${n} child chunks but ${e.chunkFidelities.length} fidelity checks.`)}function Es(e,t,n){let r=t.facets,o=n.facets;if(H(r[e])===H(o[e]))return{facet:e,change:"UNCHANGED"};switch(e){case"classification":return{facet:e,change:"CHANGED",fields:Oe(r.classification,o.classification,vo)};case"metadata":return{facet:e,change:"CHANGED",fields:Oe(r.metadata,o.metadata,Mo)};case"labels":case"assets":{let i=e==="labels"?sn(r.labels,o.labels):ln(r.assets,o.assets);return{facet:e,change:"CHANGED",added:[...i.added],removed:[...i.removed],modified:[...i.modified],unchangedCount:i.unchangedCount}}case"tags":{let i=an(r.tags,o.tags);return{facet:e,change:"CHANGED",added:[...i.added],removed:[...i.removed],unchangedCount:i.unchangedCount}}case"structured_data":return{facet:e,change:"CHANGED",operations:Qt(r.structured_data,o.structured_data)};case"text":return{facet:e,change:"CHANGED",...De(Te(r.text,o.text))};case"summary":return{facet:e,change:"CHANGED",...De(Ne(r.summary,o.summary))};case"chunks":{let i=Wt(r.chunks,o.chunks),s=r.chunks?.children??[],l=o.chunks?.children??[],c=(h,u,y)=>y===null?null:Ss(h[y],u[y]);return{facet:e,change:"CHANGED",stats:i.stats,entries:i.entries.map((h,u)=>({entry:u,kind:h.kind,pairing:h.pairing,old:c(s,t.chunkFidelities,h.oldPosition),new:c(l,n.chunkFidelities,h.newPosition)})),textUnchangedChunkingChanged:r.text.body===o.text.body}}}}function zo(e,t){return Lo(e,"from"),Lo(t,"to"),{diffEngineVersion:Nt,facets:re.map(n=>Es(n,e,t))}}var k=require("zod"),Ho=["caller_google_token","caller_identity","deployment"],jo=["describe","name_children"],cn="su",tt=k.z.object({ja:k.z.string().regex(/\S/),en:k.z.string().regex(/\S/)}).strict();function Ko(e){try{return new RegExp(`^(?:${e})$`,cn)}catch{return null}}function Go(e){try{return new RegExp(e,cn)}catch{return null}}function bs(e){let t=new RegExp(`${e}|`,cn).exec("");return t===null?0:t.length-1}var Bo=k.z.object({scheme:k.z.string().regex(/^[a-z][a-z0-9+.-]{0,31}$/),title:tt,description:tt,uri_prefix:k.z.string(),input_pattern:k.z.string(),input_example:k.z.string(),input_hint:tt,guidance:tt,paste_patterns:k.z.array(k.z.string()),credential:k.z.enum(Ho),capabilities:k.z.array(k.z.enum(jo)),delivered_mime_type:k.z.string().min(1).nullable()}).strict().superRefine((e,t)=>{e.uri_prefix.startsWith(`${e.scheme}://`)||t.addIssue({code:k.z.ZodIssueCode.custom,path:["uri_prefix"],message:`The URI prefix does not start with ${e.scheme}://.`});let n=Ko(e.input_pattern);n===null?t.addIssue({code:k.z.ZodIssueCode.custom,path:["input_pattern"],message:"The input pattern does not compile with the s and u flags."}):n.test(e.input_example)||t.addIssue({code:k.z.ZodIssueCode.custom,path:["input_example"],message:"The input example does not fully match the input pattern."}),e.paste_patterns.forEach((r,o)=>{Go(r)===null?t.addIssue({code:k.z.ZodIssueCode.custom,path:["paste_patterns",o],message:"The paste pattern does not compile with the s and u flags."}):bs(r)!==1&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["paste_patterns",o],message:"A paste pattern has exactly one capturing group, the identifier."})}),new Set(e.capabilities).size!==e.capabilities.length&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["capabilities"],message:"A capability is declared twice."})}),Cs=k.z.object({sources:k.z.array(Bo)}).strict().superRefine((e,t)=>{let n=e.sources.map(r=>r.scheme);new Set(n).size!==n.length&&t.addIssue({code:k.z.ZodIssueCode.custom,path:["sources"],message:"A scheme is registered twice."})});function _s(e,t){let n=t.trim();return[...e].sort((r,o)=>o.uri_prefix.length-r.uri_prefix.length).find(r=>n.startsWith(r.uri_prefix))}function Rs(e,t){return Ko(e.input_pattern)?.test(t)??!1}function Is(e,t){for(let n of e)for(let r of n.paste_patterns){let o=Go(r)?.exec(t)?.[1];if(o!==void 0)return{source:n,identifier:o}}}var dn=[{key:"enable_summary_generation",featureFlagKey:null,label:"\u8981\u7D04\u751F\u6210",readByPipeline:!1},{key:"enable_structured_extraction",featureFlagKey:null,label:"\u69CB\u9020\u5316\u62BD\u51FA",readByPipeline:!1},{key:"enable_asset_extraction",featureFlagKey:"ENABLE_ASSET_EXTRACTION",label:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA",readByPipeline:!1},{key:"enable_vector_indexing",featureFlagKey:"ENABLE_VECTOR_INDEXING",label:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15",readByPipeline:!0},{key:"enable_graph_indexing",featureFlagKey:"ENABLE_GRAPH_INDEXING",label:"\u30B0\u30E9\u30D5\u6295\u5F71",readByPipeline:!0}],xs=new Set(dn.map(e=>e.key));function As(e){return xs.has(e)}function Ts(e){let t=dn.find(n=>n.key===e);if(t===void 0)throw new Error(`ENRICHMENT_STAGES does not carry ${e}; the canonical list and the key type have drifted apart.`);return t}var Ns={pageSize:{min:1,max:200,default:50},topologyLabels:{min:1,max:24,default:24}};var F=require("zod");var Vo=["zip","7z","rar","pdf","ooxml","legacy_office"],Ds=F.z.enum(Vo),un=["zipcrypto","aes","7z_aes","rar_encryption","pdf_user_password","pdf_owner_password","office_encryption"],Os=F.z.enum(un),Yo=[...un,"strong_encryption"],Ps=F.z.enum(Yo),ws=Object.freeze({zipcrypto:"ZIP \u306E\u6697\u53F7 (ZipCrypto)",aes:"ZIP \u306E\u6697\u53F7 (AES)","7z_aes":"7z \u306E\u6697\u53F7 (AES-256)",rar_encryption:"RAR \u306E\u6697\u53F7",pdf_user_password:"PDF \u306E\u958B\u304F\u305F\u3081\u306E\u30D1\u30B9\u30EF\u30FC\u30C9",pdf_owner_password:"PDF \u306E\u5236\u9650\u306E\u30D1\u30B9\u30EF\u30FC\u30C9",office_encryption:"Office \u306E\u6697\u53F7",strong_encryption:"ZIP \u306E\u5F37\u3044\u6697\u53F7 (\u5916\u305B\u306A\u3044)"}),Jo=["source_overwritten","copy_original","copy_promoted","child_decrypted"],ks=F.z.enum(Jo),Fs=Object.freeze({source_overwritten:"\u6E90\u3092\u89E3\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3067\u4E0A\u66F8\u304D\u3057\u305F",copy_original:"\u89E3\u3044\u305F\u5199\u3057\u3092\u539F\u672C\u306B\u3057\u3066\u3044\u308B",copy_promoted:"\u89E3\u3044\u305F\u5199\u3057\u3067\u6E90\u3092\u4E0A\u66F8\u304D\u3057\u305F (\u6607\u683C)",child_decrypted:"\u5B50\u306E\u7269\u3092\u89E3\u3044\u305F\u4E2D\u8EAB\u306B\u3057\u305F"}),$o=["permission_denied","immutable_source","foreign_application","local_source","format_changed"],Ls=F.z.enum($o),vs=Object.freeze({permission_denied:"\u6E90\u3078\u66F8\u304F\u6A29\u9650\u304C\u7121\u3044",immutable_source:"\u30E1\u30FC\u30EB\u306F\u5909\u3048\u3089\u308C\u306A\u3044",foreign_application:"\u5225\u306E\u30A2\u30D7\u30EA (\u65E5\u5831) \u306E\u7269",local_source:"\u30DB\u30B9\u30C8\u306E\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB",format_changed:"\u66F8\u304D\u76F4\u305B\u306A\u3044\u66F8\u5F0F\u306A\u306E\u3067 ZIP \u306B\u3057\u305F"}),Ms=e=>e==="permission_denied",Us=Object.freeze({passwordRequired:4225,protectionUnsupported:4226,sourceChanged:4094}),qo=["gmail","gdrive","gcs","file","daily-report"],zs=Object.freeze({gmail:"Gmail",gdrive:"Google \u30C9\u30E9\u30A4\u30D6",gcs:"Cloud Storage",file:"\u30ED\u30FC\u30AB\u30EB\u306E\u30D5\u30A1\u30A4\u30EB","daily-report":"\u65E5\u5831"}),Xo=["glob","regex"],Hs=Object.freeze({glob:"\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9 (* \u3068 ?)",regex:"\u6B63\u898F\u8868\u73FE"}),fe=Object.freeze({label:200,sender:320,subject:400,file_name:400,uri_prefix:2048}),js=995,Wo=2147483647,Ks=e=>new TextEncoder().encode(e).length,Zo=e=>e.length,Qo=e=>F.z.string().min(1).refine(t=>Zo(t)<=e,{message:`Wider than the ${e} UTF-16 code units its column holds`}),nt=e=>Qo(e).nullable(),ea=F.z.object({sender:nt(fe.sender),subject:nt(fe.subject),file_name:nt(fe.file_name),uri_prefix:nt(fe.uri_prefix),source_kind:F.z.enum(qo).nullable(),syntax:F.z.enum(Xo)}),Gs=e=>e.sender===null&&e.subject===null&&e.file_name===null&&e.uri_prefix===null&&e.source_kind===null,pn=F.z.object({password_id:F.z.number().int().positive(),label:Qo(fe.label),conditions:ea,priority:F.z.number().int().nonnegative().max(Wo),is_active:F.z.boolean(),use_count:F.z.number().int().nonnegative(),last_used_at:N.nullable(),created_by:F.z.string().min(1),created_at:N,updated_by:F.z.string().min(1),updated_at:N}),Bs=F.z.object({passwords:F.z.array(pn)}),Vs=F.z.object({passwords:F.z.array(pn),timed_out:F.z.array(F.z.number().int().positive())});var he=-1,W=0;function ta(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Ys(){let e=typeof globalThis<"u"&&globalThis.crypto?globalThis.crypto:typeof crypto<"u"?crypto:void 0;if(!e||typeof e.getRandomValues!="function")throw new Error("Cryptographically secure random number generator (crypto.getRandomValues) is required but not available.");let t=new Uint8Array(16);e.getRandomValues(t);let n=Date.now();if(n===he){if(W++,W>4095){for(;Date.now()<=he;);n=Date.now(),he=n,W=(t[6]<<4|t[7]&15)&1023}}else n>he?(he=n,W=(t[6]<<4|t[7]&15)&1023):(n=he,W++,W>4095&&(W=0));t[0]=Math.floor(n/1099511627776)&255,t[1]=Math.floor(n/4294967296)&255,t[2]=n>>>24&255,t[3]=n>>>16&255,t[4]=n>>>8&255,t[5]=n&255,t[6]=112|W>>>8&15,t[7]=W&255,t[8]=128|t[8]&63;let r=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Js(e){if(!ta(e))throw new Error(`Invalid RFC 9562 UUIDv7 string: "${e}"`);let t=e.slice(0,8)+e.slice(9,13),n=parseInt(t,16);if(Number.isNaN(n))throw new Error(`Invalid hex timestamp in UUIDv7: "${t}"`);return new Date(n)}0&&(module.exports={AmountEntrySchema,AssetFacetItemSchema,BaseEnrichmentClient,BodySourceSchema,BoundingBoxSchema,CHILD_TREE_REBUILD_CHUNK,CHUNK_BODY_FIDELITIES,CHUNK_CHANGE_KINDS,CHUNK_MANIFEST_VERSION,CHUNK_PAIRINGS,CIRCUIT_BREAKER_SERVICES,COPY_REASONS,COPY_REASON_LABELS,CanonicalDomainKeySchema,ChangeFeedCursorSchema,ChapterSegmentSchema,ChildTreeRebuildRequestSchema,ChildTreeRebuildResultSchema,ChunkBodyFidelitySchema,ChunkChangeKindSchema,ChunkChangeSchema,ChunkManifestChildSchema,ChunkManifestParentSchema,ChunkManifestSchema,ChunkPairingSchema,ChunkRefSchema,ChunkStatsSchema,ChunkingStrategySchema,CircuitBreakerStatusSchema,ClassificationFacetSchema,ConfidentialityLevelSchema,CopyReasonSchema,DIFF_CONTEXT_LINES,DIFF_ENGINE_VERSION,DIFF_LINE_FACETS,DIFF_LINE_PAGE_MAX,DIFF_REGION_CELL_BOUND,DOCUMENT_CAPTURE_OUTCOMES,DOCUMENT_CHANGE_FEED_PAGE_MAX,DOCUMENT_CHANGE_FEED_PAGE_SIZE,DOCUMENT_FACETS,DOCUMENT_KINDS,DOCUMENT_KIND_LABELS,DOCUMENT_STATE_CAUSES,DOCUMENT_STATE_LOCK_TIMEOUT_MS,DOCUMENT_STATE_RUN_OUTCOMES,DiffLineFacetSchema,DiffLinePageLimitSchema,DiffLinePageSchema,DiffLineSchema,DiffSegmentSchema,DocumentCaptureAnswerSchema,DocumentCaptureOutcomeSchema,DocumentChangeFeedEntrySchema,DocumentChangeFeedLimitSchema,DocumentChangeFeedPageSchema,DocumentChangeFeedRowSchema,DocumentComparisonSchema,DocumentFacetSchema,DocumentFacetValuesSchema,DocumentHistorySchema,DocumentKindSchema,DocumentRunEntrySchema,DocumentStateCauseSchema,DocumentStateEntrySchema,DocumentStateRunOutcomeSchema,DocumentStateSummarySchema,DocumentStructuredDataSchema,ENRICHMENT_STAGES,EnrichmentClient,EnrichmentClientError,EnrichmentSyncStatusSchema,FACET_APPLICABLE_COUNTS,FACET_COUNT_FIELDS,FILE_PASSWORD_FIELD_WIDTHS,FILE_PASSWORD_MAX_BYTES,FILE_PASSWORD_PATTERN_SYNTAXES,FILE_PASSWORD_PATTERN_SYNTAX_LABELS,FILE_PASSWORD_PRIORITY_MAX,FILE_PASSWORD_SOURCE_KINDS,FILE_PASSWORD_SOURCE_KIND_LABELS,FILTERABLE_CONFIDENTIALITY_LEVELS,FacetChangeCountsSchema,FacetDiffSchema,FieldChangeSchema,FilePasswordConditionsSchema,FilePasswordListSchema,FilePasswordMatchSchema,FilePasswordViewSchema,FileUriSchema,GRAPH_INDEX_LIMITS,GraphSearchHitSchema,HISTOGRAM_MAX_OCCURRENCES,HunkIndexEntrySchema,INGESTION_EVENT_NAMES,INLINE_REFINE_CELL_BUDGET,INLINE_REFINE_MAX_EDIT_DISTANCE,INLINE_REFINE_MAX_GRAPHEMES,INLINE_REFINE_MIN_SIMILARITY,INTEGRITY_CLASS_POLICY,INTEGRITY_COMMAND_CODES,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX,IntegrityActiveRunSchema,IntegrityAuditOverviewSchema,IntegrityCancelFailureCodeSchema,IntegrityCellResyncRequestSchema,IntegrityCellResyncResultSchema,IntegrityCommandFailureCodeSchema,IntegrityCommandFailureSchema,IntegrityCommandReplySchema,IntegrityCommandSchema,IntegrityDispositionSchema,IntegrityFindingItemClassSchema,IntegrityFindingPageSchema,IntegrityFindingSchema,IntegrityFindingsQuerySchema,IntegrityItemClassSchema,IntegrityPhaseSchema,IntegrityPlacementObservedSchema,IntegrityQuantitySchema,IntegrityRepairActionSchema,IntegrityRepairOutcomeSchema,IntegrityRepairSkipReasonSchema,IntegrityRunHeaderSchema,IntegrityRunModeSchema,IntegrityRunStatusSchema,IntegrityScopeRoleSchema,IntegrityStartFailureCodeSchema,IntegrityStoreSchema,IntegrityUnitSchema,IntegrityVerdictSchema,JsonPatchOperationSchema,JsonValueSchema,KeyedItemChangeSchema,KeyedItemSchema,LEDGER_STEP_KEYS,LINE_ENDINGS,LabelFacetItemSchema,LedgerStepKeySchema,LineEndingSchema,MIME_KIND_RULES,MODE_TIERS,MetadataFacetSchema,ModelProviderSchema,NOTHING_TO_READ_TOKENS,NothingToReadTokenSchema,PIPELINE_FAILURE_STATUSES,PIPELINE_FLOWS,PIPELINE_PHASES,PIPELINE_STEPS,PIPELINE_STEP_KEYS,PROTECTION_FORMATS,PROTECTION_SCHEMES,PROTECTION_SCHEME_LABELS,PipelineFailureStatusSchema,PipelineRunRecordSchema,PipelineRunStatusSchema,PipelineRunSummarySchema,PipelineStepKeySchema,PipelineStepMetricSchema,PipelineStepRecordSchema,PipelineStepStatusSchema,PipelineTriggerSchema,ProtectionFormatSchema,ProtectionSchemeSchema,QUARANTINED_CONFIDENTIALITY_LEVEL,REMOVABLE_PROTECTION_SCHEMES,RESTRICTED_MARK_SUBJECTS,RUN_TERMINAL_STEP_ERROR_CODES,RUN_TERMINAL_STEP_KEY,RUN_TERMINAL_STEP_OUTCOMES,ReadableConfidentialityLevelSchema,RecentPipelineRunEntrySchema,RemovableProtectionSchemeSchema,RestrictedChangeMarkSchema,RestrictedFailureMarkSchema,RestrictedIngestMarkSchema,RestrictedMarkSubjectSchema,RestrictedRunMarkSchema,RestrictedStateMarkSchema,RunTerminalStepDetailSchema,RunTerminalStepErrorCodeSchema,RunTerminalStepOutcomeSchema,SEARCH_DEGRADATION_REASONS,SEARCH_FUSIONS,SEARCH_MODES,SEARCH_PARAM_LIMITS,SEARCH_QUALITY_TIERS,SOURCE_CAPABILITIES,SOURCE_CREDENTIALS,STALE_RUN_ERROR_CODE,STRUCTURED_DATA_ARRAY_CELL_BOUND,SYSTEM_PARAMETER_RANGES,SearchHitSchema,SearchMetadataSchema,SearchModeSchema,SearchRequestSchema,SearchResponseSchema,SourceCatalogSchema,SourceSpecSchema,StageProvenanceSchema,TREE_PATH_PATTERN,TenantIdSchema,TextDiffIndexSchema,TextFacetSchema,TextStatsSchema,TranscriptSegmentSchema,TreePathSchema,UNLOCK_DISPOSITIONS,UNLOCK_DISPOSITION_LABELS,UNLOCK_ERROR_CODES,UnlockDispositionSchema,assertBoundedSystemParameter,assertSystemParameterInRange,assetTypeName,canonicalJson,classifyDocumentKind,codePointSlicer,compareAssetKeys,compareCodeUnits,compareFacets,comparePhases,compareStates,compareTreePaths,decodeChangeFeedCursor,diffChunkBodies,diffLinePage,encodeChangeFeedCursor,enrichmentStage,flowFor,flowStepGates,formatSkipReason,generateUuidV7,identifierMatches,integrityCommandFailureCodeOf,isEnrichmentStageKey,isPromotable,isStrictlyEarlier,isUnknownTerm,isValidUuidV7,millisecondsBetween,modeFusesRankings,modeScoreIsSimilarity,orderedSteps,parseSkipReason,passwordByteLength,pastedIdentifier,readableEntrySchema,sourceOfUri,storedTermOf,storedTermSchema,storedTermText,storedWidth,stripWhitespace,summarizeTransition,summaryFacetDiff,textDiffIndex,textFacetDiff,treePathDepth,treePathLabel,treePathOf,treePathParent,treePathSegments,triesEveryFile,uuidv7ToDate});
|