@aiquants/enrichment-core 0.4.0 → 0.5.1
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 +107 -19
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1586 -643
- package/dist/index.d.ts +1586 -643
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ve=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var bo=Object.prototype.hasOwnProperty;var Ro=(e,t)=>{for(var n in t)Ve(e,n,{get:t[n],enumerable:!0})},Io=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Co(t))!bo.call(e,o)&&o!==n&&Ve(e,o,{get:()=>t[o],enumerable:!(r=Eo(t,o))||r.enumerable});return e};var xo=e=>Io(Ve({},"__esModule",{value:!0}),e);var Di={};Ro(Di,{AmountEntrySchema:()=>nn,AssetFacetItemSchema:()=>Wn,BaseEnrichmentClient:()=>ue,BodySourceSchema:()=>Ne,BoundingBoxSchema:()=>Fo,CHUNK_BODY_FIDELITIES:()=>Hn,CHUNK_CHANGE_KINDS:()=>vn,CHUNK_MANIFEST_VERSION:()=>wn,CHUNK_PAIRINGS:()=>Un,CIRCUIT_BREAKER_SERVICES:()=>qt,CanonicalDomainKeySchema:()=>an,ChangeFeedCursorSchema:()=>Dt,ChapterSegmentSchema:()=>en,ChunkBodyFidelitySchema:()=>Kn,ChunkChangeKindSchema:()=>Mn,ChunkChangeSchema:()=>fr,ChunkManifestChildSchema:()=>Zn,ChunkManifestParentSchema:()=>er,ChunkManifestSchema:()=>tr,ChunkPairingSchema:()=>zn,ChunkRefSchema:()=>mt,ChunkStatsSchema:()=>hr,ChunkingStrategySchema:()=>vo,CircuitBreakerStatusSchema:()=>Lo,ClassificationFacetSchema:()=>$n,ConfidentialityLevelSchema:()=>Q,DIFF_CONTEXT_LINES:()=>we,DIFF_ENGINE_VERSION:()=>ft,DIFF_LINE_FACETS:()=>Bn,DIFF_LINE_PAGE_MAX:()=>Ct,DIFF_REGION_CELL_BOUND:()=>yt,DISPATCH_DEGRADATION_REASONS:()=>Qt,DOCUMENT_CAPTURE_OUTCOMES:()=>Vn,DOCUMENT_CHANGE_FEED_PAGE_MAX:()=>bt,DOCUMENT_CHANGE_FEED_PAGE_SIZE:()=>na,DOCUMENT_FACETS:()=>Z,DOCUMENT_KINDS:()=>Ze,DOCUMENT_KIND_LABELS:()=>Uo,DOCUMENT_STATE_CAUSES:()=>Fn,DOCUMENT_STATE_LOCK_TIMEOUT_MS:()=>ra,DOCUMENT_STATE_RUN_OUTCOMES:()=>Pn,DiffLineFacetSchema:()=>ia,DiffLinePageLimitSchema:()=>At,DiffLinePageSchema:()=>ha,DiffLineSchema:()=>mr,DiffSegmentSchema:()=>pr,DocumentCaptureAnswerSchema:()=>Na,DocumentCaptureOutcomeSchema:()=>Jn,DocumentChangeFeedEntrySchema:()=>Ir,DocumentChangeFeedLimitSchema:()=>ya,DocumentChangeFeedPageSchema:()=>Ta,DocumentChangeFeedRowSchema:()=>xr,DocumentComparisonSchema:()=>Ea,DocumentFacetSchema:()=>Rt,DocumentFacetValuesSchema:()=>ca,DocumentHistorySchema:()=>Aa,DocumentKindSchema:()=>it,DocumentRunEntrySchema:()=>br,DocumentStateCauseSchema:()=>It,DocumentStateEntrySchema:()=>Cr,DocumentStateRunOutcomeSchema:()=>Ln,DocumentStateSummarySchema:()=>Er,DocumentStructuredDataSchema:()=>Po,ENRICHMENT_STAGES:()=>Jt,EnrichmentClient:()=>We,EnrichmentClientError:()=>W,EnrichmentSyncStatusSchema:()=>$e,FACET_APPLICABLE_COUNTS:()=>rr,FACET_COUNT_FIELDS:()=>nr,FILTERABLE_CONFIDENTIALITY_LEVELS:()=>_o,FacetChangeCountsSchema:()=>or,FacetDiffSchema:()=>yr,FieldChangeSchema:()=>Me,FileUriSchema:()=>wo,GRAPH_INDEX_LIMITS:()=>xi,GraphSearchHitSchema:()=>ln,HISTOGRAM_MAX_OCCURRENCES:()=>ht,HunkIndexEntrySchema:()=>cr,INLINE_REFINE_CELL_BUDGET:()=>St,INLINE_REFINE_MAX_EDIT_DISTANCE:()=>gt,INLINE_REFINE_MAX_GRAPHEMES:()=>Fe,INLINE_REFINE_MIN_SIMILARITY:()=>Pe,INTEGRITY_CLASS_POLICY:()=>vr,INTEGRITY_COMMAND_CODES:()=>Ft,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX:()=>ye,IntegrityActiveRunSchema:()=>Vr,IntegrityAuditOverviewSchema:()=>Ja,IntegrityCancelFailureCodeSchema:()=>$r,IntegrityCellResyncRequestSchema:()=>ei,IntegrityCellResyncResultSchema:()=>ri,IntegrityCommandFailureCodeSchema:()=>Ke,IntegrityCommandFailureSchema:()=>ii,IntegrityCommandReplySchema:()=>li,IntegrityCommandSchema:()=>Nt,IntegrityDispositionSchema:()=>Pr,IntegrityFindingItemClassSchema:()=>wt,IntegrityFindingPageSchema:()=>Qa,IntegrityFindingSchema:()=>Jr,IntegrityFindingsQuerySchema:()=>Za,IntegrityItemClassSchema:()=>Ot,IntegrityPhaseSchema:()=>Hr,IntegrityPlacementObservedSchema:()=>qa,IntegrityQuantitySchema:()=>Br,IntegrityRepairActionSchema:()=>Lr,IntegrityRepairOutcomeSchema:()=>Kr,IntegrityRepairSkipReasonSchema:()=>Gr,IntegrityRunHeaderSchema:()=>He,IntegrityRunModeSchema:()=>Mr,IntegrityRunStatusSchema:()=>Ur,IntegrityScopeRoleSchema:()=>wr,IntegrityStartFailureCodeSchema:()=>Yr,IntegrityStoreSchema:()=>ze,IntegrityUnitSchema:()=>Fr,IntegrityVerdictSchema:()=>zr,JsonPatchOperationSchema:()=>sr,JsonValueSchema:()=>j,KeyedItemChangeSchema:()=>ir,KeyedItemSchema:()=>pt,LEDGER_STEP_KEYS:()=>et,LINE_ENDINGS:()=>jn,LOCAL_DEGRADATION_REASONS:()=>Xt,LabelFacetItemSchema:()=>Xn,LedgerStepKeySchema:()=>yn,LineEndingSchema:()=>aa,MIME_KIND_RULES:()=>fn,MODE_TIERS:()=>pe,MetadataFacetSchema:()=>qn,ModelProviderSchema:()=>Yt,NOTHING_TO_READ_TOKENS:()=>_n,NothingToReadTokenSchema:()=>Dn,PIPELINE_FAILURE_STATUSES:()=>tt,PIPELINE_FLOWS:()=>hn,PIPELINE_PHASES:()=>Ho,PIPELINE_STEPS:()=>nt,PIPELINE_STEP_KEYS:()=>Ae,PipelineFailureStatusSchema:()=>st,PipelineRunRecordSchema:()=>ct,PipelineRunStatusSchema:()=>Te,PipelineRunSummarySchema:()=>dt,PipelineStepKeySchema:()=>De,PipelineStepMetricSchema:()=>ta,PipelineStepRecordSchema:()=>Tn,PipelineStepStatusSchema:()=>In,PipelineTriggerSchema:()=>xn,QUARANTINED_CONFIDENTIALITY_LEVEL:()=>oe,REMOTE_DEGRADATION_REASONS:()=>Wt,RESTRICTED_MARK_SUBJECTS:()=>Gn,RUN_TERMINAL_STEP_ERROR_CODES:()=>Cn,RUN_TERMINAL_STEP_KEY:()=>_e,RUN_TERMINAL_STEP_OUTCOMES:()=>gn,ReadableConfidentialityLevelSchema:()=>xt,RecentPipelineRunEntrySchema:()=>Ia,RestrictedChangeMarkSchema:()=>Sr,RestrictedFailureMarkSchema:()=>ba,RestrictedIngestMarkSchema:()=>Ca,RestrictedMarkSubjectSchema:()=>oa,RestrictedRunMarkSchema:()=>_t,RestrictedStateMarkSchema:()=>gr,RunTerminalStepDetailSchema:()=>En,RunTerminalStepErrorCodeSchema:()=>Rn,RunTerminalStepOutcomeSchema:()=>Sn,SEARCH_DEGRADATION_REASONS:()=>Oo,SEARCH_MODES:()=>Ye,SEARCH_PARAM_LIMITS:()=>Ao,STALE_RUN_ERROR_CODE:()=>bn,STRUCTURED_DATA_ARRAY_CELL_BOUND:()=>Et,SYSTEM_PARAMETER_RANGES:()=>he,SearchHitSchema:()=>sn,SearchMetadataSchema:()=>on,SearchModeSchema:()=>rn,SearchRequestSchema:()=>qe,SearchResponseSchema:()=>Xe,StageProvenanceSchema:()=>An,TenantIdSchema:()=>Zt,TextDiffIndexSchema:()=>pa,TextFacetSchema:()=>Qn,TextStatsSchema:()=>lr,TranscriptSegmentSchema:()=>tn,assertBoundedSystemParameter:()=>Pa,assertSystemParameterInRange:()=>Fa,canonicalJson:()=>U,classifyDocumentKind:()=>zo,codePointSlicer:()=>qr,compareAssetKeys:()=>Le,compareCodeUnits:()=>B,compareFacets:()=>ve,comparePhases:()=>Bo,compareStates:()=>go,decodeChangeFeedCursor:()=>_r,diffChunkBodies:()=>so,diffLinePage:()=>lo,encodeChangeFeedCursor:()=>Ar,enrichmentStage:()=>Ii,flowFor:()=>Ko,flowStepGates:()=>Go,formatSkipReason:()=>$o,generateUuidV7:()=>Ai,integrityCommandFailureCodeOf:()=>si,isEnrichmentStageKey:()=>Ri,isStrictlyEarlier:()=>Y,isValidUuidV7:()=>So,modeFusesRankings:()=>ko,modeNeedsRemoteTiers:()=>Do,modeScoreIsSimilarity:()=>To,narrowModeToAllowedTiers:()=>No,orderedSteps:()=>jo,parseSkipReason:()=>lt,readableEntrySchema:()=>fe,stripWhitespace:()=>Xr,summarizeTransition:()=>yo,summaryFacetDiff:()=>Ee,textDiffIndex:()=>Ce,textFacetDiff:()=>Se,uuidv7ToDate:()=>_i});module.exports=xo(Di);var U=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(U).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${U(t[r])}`).join(",")}}`};var W=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}},ue=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 l=new AbortController,s=setTimeout(()=>l.abort(),this.timeoutMs),c;try{c=await this.fetchFn(o,{method:"POST",headers:i,body:JSON.stringify(r),signal:l.signal})}catch(u){let y=u instanceof Error?u.message:String(u);throw new W(`Network request failed for POST ${o}: ${y}`,0,"")}finally{clearTimeout(s)}if(!c.ok){let u=await c.text().catch(()=>""),y;try{y=JSON.parse(u)}catch{}throw new W(`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 W(`Failed to parse response JSON from ${o}: ${y}`,c.status,h)}}};var m=require("zod");var Je=require("zod"),Yt=Je.z.enum(["google_cloud","google_vision","yomitoku_local","faster_whisper_local","google_speech","ollama_local","openai","anthropic","azure_openai","bedrock","custom_openai_compatible"]),Q=Je.z.enum(["PUBLIC","INTERNAL","DEPARTMENT","CONFIDENTIAL","RESTRICTED"]),oe="RESTRICTED";var Ao={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}},$t=Q.options.filter(e=>e!==oe);if($t.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 _o=$t,Ye=["KEYWORD","SPARSE","DENSE","HYBRID","GRAPH_TRAVERSE"],pe={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 Do(e){let t=pe[e];return t.dense||t.sparse||t.graph}function To(e){let t=pe[e];return t.dense&&!t.sparse}function No(e,t){let n=pe[e],r=(n.dense||n.sparse)&&t.vector,o=n.graph&&t.graph;return r||o?r?o?{mode:e,discardGraph:!1}:n.dense&&n.sparse?{mode:e,discardGraph:!0}:{mode:n.dense?"DENSE":"SPARSE",discardGraph:!1}:{mode:"GRAPH_TRAVERSE",discardGraph:!1}:null}function ko(e){let t=pe[e];return[t.dense,t.sparse,t.graph,t.lexical].filter(Boolean).length>1}var qt=["vector","graph"],Xt=["empty_query","caller_token_unavailable","time_window_unsupported"],Wt=["vector_tier_not_configured","graph_tier_not_configured","no_active_vector_collection","vector_collections_missing"],Qt=["remote_tiers_unavailable","remote_tiers_timed_out","remote_tiers_refused_caller","remote_tiers_rejected_request","remote_tiers_failed","remote_tiers_not_executed","vector_search_disabled","graph_search_disabled"],Oo=[...Xt,...Wt,...Qt,...qt.map(e=>`circuit_breaker_open:${e}`)];var Zt=m.z.string().trim().min(1,"tenant_id must be a non-empty string"),wo=m.z.string().trim().min(1,"file_uri must be a non-empty string"),$e=m.z.enum(["PENDING","EXTRACTING","ENRICHING","PROJECTING","SYNCED","FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"]),Fo=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()}),en=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()}),tn=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()}),nn=m.z.object({label:m.z.string(),value:m.z.number(),currency:m.z.string()}),Po=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(nn).optional(),media_type:m.z.enum(["video","audio"]).optional(),duration_sec:m.z.number().nonnegative().optional(),chapters:m.z.array(en).optional(),transcript_segments:m.z.array(tn).optional()}),Lo=m.z.enum(["CLOSED","OPEN","HALF_OPEN"]),rn=m.z.enum(Ye),on=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()}),an=m.z.enum(["CONTRACT_LEGAL","EMAIL_THREAD","DAILY_REPORT","FINANCIAL_REPORT","TECHNICAL_SPEC","MASTER_DATA","MEDIA_ASSET","GENERAL_DOCUMENT"]),vo=m.z.enum(["hierarchical","conversation","section","fixed_size","table_aware","semantic","none","multimodal"]),sn=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()}),ln=m.z.object({metadata_id:m.z.number().int().positive(),relation:m.z.string(),target_name:m.z.string()}),qe=m.z.object({query:m.z.string().trim().min(1,"query must not be empty"),tenant_id:Zt,domain_key:an.optional(),limit:m.z.number().int().positive().optional(),department_id:m.z.number().int().positive().optional(),search_mode:rn.optional(),strategy_id:m.z.number().int().positive().optional()}).strict(),Xe=m.z.object({hits:m.z.array(sn),graph_hits:m.z.array(ln),tiers:m.z.record(m.z.string(),m.z.boolean()),metadata:on});var We=class extends ue{async search(t){let n=qe.parse(t),r=await this.request("/ai/search/hybrid",n.tenant_id,n);return Xe.parse(r)}};var a=require("zod");var Re=require("zod"),ae=Re.z.string().uuid().transform(e=>e.toLowerCase()),w=Re.z.string().datetime({offset:!0}),Ie=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!Object.hasOwn(e,"__proto__"),d=(e,t,n)=>{e.addIssue({code:Re.z.ZodIssueCode.custom,path:[...t],message:n})},Mo=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:Z|([+-])(\d{2}):?(\d{2}))$/,cn=e=>{let t=w.safeParse(e).success?Mo.exec(e):null;if(t===null)return null;let[,n,r,o,i,l,s,c,h,u,y]=t,E=new Date(0);E.setUTCFullYear(Number(n),Number(r)-1,Number(o)),E.setUTCHours(Number(i),Number(l),s===void 0?0:Number(s),0);let _=h===void 0?0:(h==="+"?1:-1)*(Number(u)*3600+Number(y)*60);return{epochSeconds:E.getTime()/1e3-_,fraction:c===void 0?"":c}},Y=(e,t)=>{let n=cn(e),r=cn(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")};var S=require("zod");var Ze=["email","pdf","office","image","media","text","google_native","other"],Uo={email:"\u30E1\u30FC\u30EB",pdf:"PDF",office:"Office \u6587\u66F8",image:"\u753B\u50CF",media:"\u97F3\u58F0\u30FB\u52D5\u753B",text:"\u30C6\u30AD\u30B9\u30C8",google_native:"Google \u30CD\u30A4\u30C6\u30A3\u30D6",other:"\u305D\u306E\u4ED6"},fn=[["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/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/*","text"],["application/json","text"],["application/xml","text"]];function zo(e){let t=(e.split(";")[0]??"").trim().toLowerCase();for(let[n,r]of fn)if(n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n)return r;return"other"}var Ae=["delete_child_assets","extract_text","analyze_media","extract_assets","ocr_children","ocr_document","resolve_body","enrich_document","project_to_indexes"],_e="record_document_state",et=[...Ae,_e],Ho=["EXTRACTING","ENRICHING","PROJECTING"],tt=["FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"],Qe=e=>({featureFlagKey:e,whenClosed:"skip",failureStatus:null}),dn=(e,t)=>({featureFlagKey:e,whenClosed:"fail",failureStatus:t}),nt={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},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:[Qe("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\u3084\u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u3092\u5B50\u30A2\u30BB\u30C3\u30C8\u3068\u3057\u3066\u5207\u308A\u51FA\u3057\u3001\u6587\u66F8\u306E\u96A3\u306B\u4FDD\u7BA1\u3057\u3066\u767B\u9332\u3059\u308B\u3002",endpoint:"/ai/assets/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[Qe("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\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:[Qe("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:[dn("ENABLE_VECTOR_INDEXING","FAILED_VECTOR"),dn("ENABLE_GRAPH_INDEXING","FAILED_GRAPH")],capability:null,fanOut:null}},un={whenClosed:"fail",failureStatus:"FAILED_EXTRACT"},xe=[{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:"ocr_document",dependsOn:["extract_text"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],pn=[{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"}],hn={email:{kind:"email",steps:xe},pdf:{kind:"pdf",steps:xe},office:{kind:"office",steps:xe},google_native:{kind:"google_native",steps:xe},image:{kind:"image",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"ocr_document",dependsOn:["delete_child_assets"],gatePolicy:un},{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:un},{step:"resolve_body",dependsOn:["analyze_media"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"existing"}]},text:{kind:"text",steps:pn},other:{kind:"other",steps:pn}};function Ko(e){return hn[e]}function Go(e){let{gates:t}=nt[e.step],{gatePolicy:n}=e;return n===void 0?t:t.map(r=>({featureFlagKey:r.featureFlagKey,whenClosed:n.whenClosed,failureStatus:n.failureStatus}))}function jo(e){let t=new Map(e.steps.map(i=>[i.step,i]));for(let i of e.steps){if(i.gatePolicy!==void 0&&nt[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 l of i.dependsOn)if(!t.has(l))throw new Error(`Flow ${e.kind}: step ${i.step} depends on ${l}, which the flow does not contain.`)}let n=[...e.steps],r=new Set,o=[];for(;n.length>0;){let i=n.findIndex(s=>s.dependsOn.every(c=>r.has(c)));if(i===-1)throw new Error(`Flow ${e.kind}: the steps ${n.map(s=>s.step).join(", ")} depend on each other in a cycle.`);let[l]=n.splice(i,1);r.add(l.step),o.push(l)}return o}var mn={EXTRACTING:0,ENRICHING:1,PROJECTING:2};function Bo(e,t){return mn[e]-mn[t]}var it=S.z.enum(Ze),De=S.z.enum(Ae),yn=S.z.enum(et),st=S.z.enum(tt),gn=["RECORDED","UNCHANGED","ALREADY_RECORDED"],Sn=S.z.enum(gn),En=S.z.object({outcome:Sn}).strict(),Cn=["history_no_current_row","history_lock_timeout","history_write_failed"],bn="stale_run",Rn=S.z.enum(Cn),Te=S.z.enum(["RUNNING","SUCCEEDED","FAILED"]),In=S.z.enum(["RUNNING","SUCCEEDED","SKIPPED","FAILED"]),xn=S.z.enum(["ingest","retry","resync"]),Ne=S.z.enum(["text_layer","ocr","transcript"]),G=S.z.number().int().nonnegative().nullable(),An=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:G,input_chars:G,output_chars:G,pages_read:G,pages_total:G,chunk_count:G,points_upserted:G,collection:S.z.string().nullable(),embedding_model:S.z.string().nullable(),strategy_id:S.z.number().int().positive().nullable(),graph_nodes:G,body_source:Ne.nullable(),detail:S.z.custom(Ie,"A report's detail holds no own __proto__ member.").pipe(S.z.record(S.z.string(),S.z.unknown()))}).strict(),_n=["no_pages","no_pages_rendered"],Dn=S.z.enum(_n),rt="gate_closed:",ot="source_skipped:",at="nothing_to_read:",Vo=["no_children","superseded","recording_disabled","recording_misconfigured"],Jo=e=>Vo.includes(e),Yo=/^[A-Z][A-Z0-9_]*$/;function lt(e){if(Jo(e))return{kind:e};if(e.startsWith(rt)){let t=e.slice(rt.length);return Yo.test(t)?{kind:"gate_closed",featureFlagKey:t}:null}if(e.startsWith(ot)){let t=De.safeParse(e.slice(ot.length));return t.success?{kind:"source_skipped",stepKey:t.data}:null}if(e.startsWith(at)){let t=Dn.safeParse(e.slice(at.length));return t.success?{kind:"nothing_to_read",token:t.data}:null}return null}function $o(e){let t=qo(e);if(lt(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 qo(e){switch(e.kind){case"gate_closed":return`${rt}${e.featureFlagKey}`;case"no_children":case"superseded":case"recording_disabled":case"recording_misconfigured":return e.kind;case"source_skipped":return`${ot}${e.stepKey}`;case"nothing_to_read":return`${at}${e.token}`;default:{let t=e;throw new RangeError(`Unknown skip reason kind: ${JSON.stringify(t)}`)}}}var Xo=S.z.object({id:S.z.number().int().positive(),runId:S.z.number().int().positive(),sequence:S.z.number().int().nonnegative(),stepKey:yn,targetMetadataId:S.z.number().int().positive(),status:In,skipReason:S.z.string().nullable(),provenance:An.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:w,finishedAt:w.nullable(),durationMs:G}).strict();function Wo(e,t){switch(e.stepKey===_e&&Zo(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 Qo=["superseded","recording_disabled","recording_misconfigured"];function Zo(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){En.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&&!Rn.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=lt(e.skipReason);(n===null||!Qo.includes(n.kind))&&d(t,["skipReason"],"A skipped terminal step names one of the terminal skip reasons.")}}var Tn=Xo.superRefine(Wo),Nn=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:xn,documentKind:it,flowKey:S.z.string().min(1),status:Te,retryScheduled:S.z.boolean(),failedStepKey:De.nullable(),errorMessage:S.z.string().nullable(),requestedBy:S.z.string().min(1),startedAt:w,finishedAt:w.nullable(),steps:S.z.array(Tn)}).strict();function kn(e,t){e.retryScheduled&&e.status!=="FAILED"&&d(t,["retryScheduled"],"Only a FAILED run can have a retry scheduled.")}var ct=Nn.superRefine(kn),dt=Nn.omit({steps:!0}).superRefine(kn);function ea(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 ta=S.z.object({documentKind:it,stepKey:De,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:G,durationP95Ms:G,lastStartedAt:w.nullable()}).strict().superRefine(ea);var ft=1,we=3,ht=64,yt=1e6,Fe=4096,Pe=.3,gt=1024,St=67108864,Et=16777216,Ct=500,bt=50,na=50,ra=1e4,wn=1,Z=["classification","metadata","labels","tags","structured_data","text","summary","chunks","assets"],Rt=a.z.enum(Z),Fn=["RUN","PRE_WRITE","MANUAL","BACKFILL"],It=a.z.enum(Fn),Pn=["SUCCEEDED","FAILED"],Ln=a.z.enum(Pn),vn=["ADDED","REMOVED","MODIFIED","MOVED"],Mn=a.z.enum(vn),Un=["clause","breadcrumbs"],zn=a.z.enum(Un),Hn=["EXACT","WHITESPACE_NORMALIZED","UNVERIFIED"],Kn=a.z.enum(Hn),Gn=["run","ingest","failure","state","change"],oa=a.z.enum(Gn),jn=["LF","CRLF","CR","MIXED","NONE"],aa=a.z.enum(jn),Bn=["text","summary","chunks"],ia=a.z.enum(Bn),Vn=["RECORDED","UNCHANGED"],Jn=a.z.enum(Vn),Yn=a.z.lazy(()=>a.z.custom(Ie,"A JSON object here holds no own __proto__ member.").pipe(a.z.record(a.z.string(),j))),j=a.z.lazy(()=>a.z.union([a.z.string(),a.z.number().finite(),a.z.boolean(),a.z.null(),a.z.array(j),Yn])),xt=Q.exclude([oe]),M=a.z.number().int().positive(),I=a.z.number().int().nonnegative(),Oe=a.z.string().regex(/^[0-9a-f]{64}$/,"A SHA-256 is 64 lowercase hexadecimal digits."),B=(e,t)=>e<t?-1:e>t?1:0,Le=(e,t)=>B(e.assetType,t.assetType)||e.assetIndex-t.assetIndex,ie=(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)},$n=a.z.object({confidentialityLevel:Q,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable(),createdBy:a.z.string()}).strict(),qn=a.z.object({fileName:a.z.string(),filePath:a.z.string(),fileId:a.z.string().nullable(),revision:M,revisionId:a.z.string().nullable(),fileSize:I,mimeType:a.z.string(),fileHash:a.z.string().nullable(),mtime:w}).strict(),Xn=a.z.object({labelKey:a.z.string().min(1),assignedBy:a.z.string(),confidenceScore:a.z.number().finite()}).strict(),Wn=a.z.object({assetType:a.z.string().min(1),assetIndex:I,mimeType:a.z.string(),fileSize:I,textSha256:Oe.nullable()}).strict(),Qn=a.z.object({body:a.z.string().nullable(),mime:a.z.string().nullable(),source:Ne.nullable(),isTruncated:a.z.boolean(),pageOffsets:j}).strict(),Zn=a.z.object({index:I,hash:Oe,whitespaceFreeHash:Oe,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(),er=a.z.object({ordinal:I,contentHash:Oe,charLength:I}).strict();function sa(e,t){ie(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 tr=a.z.object({version:a.z.literal(wn),children:a.z.array(Zn).min(1),parents:a.z.array(er)}).strict().superRefine(sa);function la(e,t){ie(e.labels,(n,r)=>B(n.labelKey,r.labelKey),t,["labels"],"Labels are ordered by labelKey with no key repeated."),ie(e.tags??[],B,t,["tags"],"Tags are ordered with no tag repeated."),ie(e.assets,Le,t,["assets"],"Assets are ordered by (assetType, assetIndex) with no key repeated.")}var ca=a.z.object({classification:$n,metadata:qn,labels:a.z.array(Xn),tags:a.z.array(a.z.string()).nullable(),structured_data:j,text:Qn,summary:a.z.string().nullable(),chunks:tr.nullable(),assets:a.z.array(Wn)}).strict().superRefine(la),nr=["addedCount","removedCount","modifiedCount","movedCount","unchangedCount","charsAdded","charsRemoved"],rr={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 da(e,t){let n=rr[e.facet];for(let r of nr)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 or=a.z.object({facet:Rt,addedCount:I.nullable(),removedCount:I.nullable(),modifiedCount:I.nullable(),movedCount:I.nullable(),unchangedCount:I.nullable(),charsAdded:I.nullable(),charsRemoved:I.nullable()}).strict().superRefine(da),On=new Map(Z.map((e,t)=>[e,t])),ve=(e,t)=>On.get(e)-On.get(t),ar=a.z.array(or).min(1).superRefine((e,t)=>ie(e,(n,r)=>ve(n.facet,r.facet),t,[],"A change lists each changed facet once, in display order.")),Me=a.z.object({field:a.z.string().min(1),before:j,after:j}).strict(),pt=a.z.object({key:a.z.string().min(1),value:Yn}).strict(),ir=a.z.object({key:a.z.string().min(1),fields:a.z.array(Me).min(1)}).strict(),ut=a.z.string().refine(e=>e===""||e.startsWith("/"),"A JSON Pointer is empty or starts with '/'."),sr=a.z.discriminatedUnion("op",[a.z.object({op:a.z.literal("add"),path:ut,value:j}).strict(),a.z.object({op:a.z.literal("remove"),path:ut,previous:j}).strict(),a.z.object({op:a.z.literal("replace"),path:ut,value:j,previous:j}).strict()]),lr=a.z.object({linesAdded:I,linesRemoved:I,linesUnchanged:I,charsAdded:I,charsRemoved:I,similarity:a.z.number().min(0).max(1).nullable()}).strict();function ua(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 cr=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(ua),dr=(e,t)=>{e.forEach((n,r)=>{n.hunk!==r&&d(t,["hunks",r,"hunk"],"Hunks are numbered from 0 in order.")})},ur={attributes:a.z.array(Me),stats:lr,hunks:a.z.array(cr)},pa=a.z.object(ur).strict().superRefine((e,t)=>dr(e.hunks,t)),pr=a.z.object({kind:a.z.enum(["equal","removed","added"]),text:a.z.string().min(1)}).strict(),ma={context:["equal"],removed:["equal","removed"],added:["equal","added"]};function fa(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)=>{ma[e.kind].includes(n.kind)||d(t,["segments",r,"kind"],`A ${e.kind} line has no ${n.kind} segment.`)})}var mr=a.z.object({kind:a.z.enum(["context","removed","added"]),oldNumber:M.nullable(),newNumber:M.nullable(),page:a.z.number().int().nullable(),segments:a.z.array(pr)}).strict().superRefine(fa),ha=a.z.object({lines:a.z.array(mr).max(Ct),next:I.nullable()}).strict().superRefine((e,t)=>{e.next!==null&&e.lines.length===0&&d(t,["next"],"An empty page has no next page.")}),At=a.z.number().int().min(1).max(Ct),ya=a.z.number().int().min(1).max(bt),mt=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:Kn}).strict();function ga(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 fr=a.z.object({entry:I,kind:Mn,pairing:zn.nullable(),old:mt.nullable(),new:mt.nullable()}).strict().superRefine(ga),hr=a.z.object({added:I,removed:I,modified:I,moved:I,unchanged:I}).strict();function Sa(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 yr=a.z.union([a.z.object({facet:Rt,change:a.z.literal("UNCHANGED")}).strict(),a.z.object({facet:a.z.enum(["classification","metadata"]),change:a.z.literal("CHANGED"),fields:a.z.array(Me).min(1)}).strict(),a.z.object({facet:a.z.enum(["labels","assets"]),change:a.z.literal("CHANGED"),added:a.z.array(pt),removed:a.z.array(pt),modified:a.z.array(ir),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(sr).min(1)}).strict(),a.z.object({facet:a.z.enum(["text","summary"]),change:a.z.literal("CHANGED"),...ur}).strict().superRefine((e,t)=>dr(e.hunks,t)),a.z.object({facet:a.z.literal("chunks"),change:a.z.literal("CHANGED"),stats:hr,entries:a.z.array(fr),textUnchangedChunkingChanged:a.z.boolean()}).strict().superRefine(Sa)]),Ea=a.z.object({diffEngineVersion:M,facets:a.z.array(yr)}).strict().superRefine((e,t)=>{(e.facets.length!==Z.length||e.facets.some((n,r)=>n.facet!==Z[r]))&&d(t,["facets"],"A comparison carries every facet once, in display order.")}),fe=e=>a.z.object({kind:a.z.literal("readable"),item:e}).strict(),_t=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("run"),startedAt:w,finishedAt:w.nullable(),status:Te}).strict(),Ca=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("ingest"),createdAt:w,updatedAt:w,syncStatus:$e.nullable()}).strict(),ba=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("failure"),failedAt:w.nullable(),syncStatus:st}).strict(),gr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("state"),settledAt:w}).strict(),Sr=a.z.object({kind:a.z.literal("restricted"),subject:a.z.literal("change"),settledAt:w}).strict();function Ra(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 Er=a.z.object({stateId:M,revision:M,cause:It,runId:M.nullable(),runOutcome:Ln.nullable(),settledAt:w,actor:a.z.string().min(1),classification:a.z.object({confidentialityLevel:xt,departmentId:a.z.number().int().nullable(),folderPath:a.z.string().nullable()}).strict(),modelOnlyChange:a.z.boolean(),previousStateId:M.nullable(),changes:ar.nullable(),diffEngineVersion:M.nullable()}).strict().superRefine(Ra),Cr=a.z.discriminatedUnion("kind",[fe(Er),gr]),br=a.z.discriminatedUnion("kind",[fe(ct),_t]),Ia=a.z.discriminatedUnion("kind",[fe(dt),_t]),Rr=(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.")},ke=e=>e.kind==="readable"?e.item.settledAt:e.settledAt;function xa(e,t){ie(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."),Rr(e.states.map(ke),t,["states"])}var Aa=a.z.object({document:a.z.object({metadataId:M,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:M,confidentialityLevel:xt}).strict(),revisions:a.z.array(a.z.object({metadataId:M,revision:M,revisionId:a.z.string().nullable(),isCurrent:a.z.boolean()}).strict()),states:a.z.array(Cr),runs:a.z.array(br)}).strict().superRefine(xa),Ir=a.z.object({stateId:M,previousStateId:M,metadataId:M,fileName:a.z.string().min(1),fileUri:a.z.string().min(1),revision:M,previousRevision:M,cause:It,actor:a.z.string().min(1),settledAt:w,changes:ar}).strict().superRefine((e,t)=>{e.previousStateId===e.stateId&&d(t,["previousStateId"],"A state does not precede itself.")}),xr=a.z.discriminatedUnion("kind",[fe(Ir),Sr]),Dt=a.z.object({settledAt:w,id:M.max(Number.MAX_SAFE_INTEGER)}).strict(),me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function _a(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+=me[o>>18&63]+me[o>>12&63],r>1&&(t+=me[o>>6&63]),r>2&&(t+=me[o&63])}return t}function Da(e){if(e.length%4===1)return null;let t=[],n=0,r=0;for(let o of e){let i=me.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 Ar(e){let{settledAt:t,id:n}=Dt.parse(e);return _a(new TextEncoder().encode(U({id:n,settledAt:t})))}function _r(e){let t=Da(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=Dt.safeParse(n);return r.success&&Ar(r.data)===e?r.data:null}var Ta=a.z.object({rows:a.z.array(xr).max(bt),next:a.z.string().nullable()}).strict().superRefine((e,t)=>{Rr(e.rows.map(ke),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,ke(r))||Y(ke(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.")}),Na=a.z.object({outcome:Jn}).strict();var p=require("zod");var Dr=[{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 Tr={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}};var wa=e=>{for(let t of Object.values(e))Object.freeze(t);return Object.freeze(e)},he=wa(Tr),Nr=e=>Object.hasOwn(he,e),kr=(e,t)=>{let{min:n,max:r}=he[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`)},Fa=(e,t)=>{Nr(e)&&kr(e,t)},Pa=(e,t)=>{if(!Nr(e))throw new TypeError(`The range table bounds no parameter named ${JSON.stringify(e)}.`);kr(e,t)};var ze=p.z.enum(["QDRANT","NEO4J"]),wr=p.z.enum(["PRODUCTION","VARIANT","LABEL"]),Ot=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"]),wt=Ot.exclude(["EXPECTED","LIVE","HISTORY"]),Fr=p.z.enum(["POINT","NODE","CHUNK","DOCUMENT"]),Pr=p.z.enum(["EXPECTED","HEALTHY","RETAINED","INFORMATIONAL","DISCREPANCY"]),Lr=p.z.enum(["NONE","PURGE","FLAG","REPROJECT"]),k=(e,t)=>Object.freeze({disposition:e,repairAction:t}),vr=Object.freeze({EXPECTED:k("EXPECTED","NONE"),LIVE:k("HEALTHY","NONE"),HISTORY:k("RETAINED","NONE"),TOMBSTONE:k("RETAINED","NONE"),AWAITING_SUCCESSOR:k("RETAINED","NONE"),IN_FLIGHT:k("INFORMATIONAL","NONE"),UNPLACED:k("INFORMATIONAL","NONE"),UNRECORDED:k("INFORMATIONAL","NONE"),UNREFERENCED:k("INFORMATIONAL","NONE"),CHANGED_AFTER_START:k("INFORMATIONAL","NONE"),PIPELINE_FAILED:k("INFORMATIONAL","NONE"),PROJECTION_REFUSED:k("INFORMATIONAL","NONE"),ORPHAN:k("DISCREPANCY","PURGE"),TOMBSTONE_EXPIRED:k("DISCREPANCY","PURGE"),UNPROPAGATED_DELETE:k("DISCREPANCY","FLAG"),STALE_REVISION:k("DISCREPANCY","PURGE"),MISPLACED:k("DISCREPANCY","PURGE"),OUT_OF_TIER:k("DISCREPANCY","PURGE"),UNMARKED_SUPERSEDED:k("DISCREPANCY","FLAG"),FLAG_DRIFT:k("DISCREPANCY","REPROJECT"),VARIANT_FLAG_DRIFT:k("DISCREPANCY","NONE"),DETACHED:k("DISCREPANCY","PURGE"),UNKEYED:k("DISCREPANCY","PURGE"),MISSING:k("DISCREPANCY","REPROJECT"),COUNT_MISMATCH:k("DISCREPANCY","REPROJECT"),UNPROJECTED:k("DISCREPANCY","REPROJECT"),UNKEYED_ENTITY:k("DISCREPANCY","NONE")}),Mr=p.z.enum(["SCAN","REPAIR"]),Ur=p.z.enum(["RUNNING","COMPLETED","FAILED","CANCELLED","ABANDONED"]),zr=p.z.enum(["CONSISTENT","INCONSISTENT","UNDETERMINED"]),Hr=p.z.enum(["QDRANT","NEO4J","DOCUMENTS"]),Kr=p.z.enum(["APPLIED","SKIPPED","FAILED"]),Gr=p.z.enum(["RECLASSIFIED","IN_FLIGHT","DESTINATION_PENDING","BASIS_EXHAUSTED","PROJECTION_REFUSED","PIPELINE_FAILED","UNRECORDED","OUTSIDE"]),ye=100,H=p.z.number().int().nonnegative(),Ue=p.z.number().int().min(300).max(599),Tt=["repairedCount","repairFailedCount","repairSkippedCount"],jr=p.z.string().regex(/^[0-9a-f]{64}$/,"A store fingerprint is 64 lowercase hexadecimal digits."),Or=he.INTEGRITY_TOMBSTONE_RETENTION_DAYS,La=p.z.object({runUid:ae,mode:Mr,status:Ur,requestedBy:p.z.string().min(1),executor:p.z.string().min(1),basisRunUid:ae.nullable(),storeFingerprint:jr,tombstoneRetentionDays:p.z.number().int().min(Or.min).max(Or.max),startedAt:w,finishedAt:w.nullable(),verdict:zr.nullable(),errorClass:p.z.string().min(1).nullable(),reprojectDocuments:H.nullable(),reprojectRebuildDocuments:H.nullable()}).strict(),va=(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.")},He=La.superRefine(va),Ma=p.z.object({store:ze,scopeKey:p.z.string().min(1),scopeRole:wr,itemClass:Ot,unit:Fr,disposition:Pr,repairAction:Lr,itemCount:H.nullable(),unmeasuredReason:p.z.string().min(1).nullable(),measuredAt:w.nullable(),repairedCount:H.nullable(),repairFailedCount:H.nullable(),repairSkippedCount:H.nullable()}).strict(),Ua=(e,t)=>{let n=vr[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:l}=e;if(o===null||i===null||l===null){if(Tt.some(s=>e[s]!==null))for(let s of Tt)e[s]===null&&d(t,[s],"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+l>e.itemCount&&d(t,["itemCount"],"The repaired, failed and skipped counts together do not exceed the measured count.")},Br=Ma.superRefine(Ua),za=p.z.object({run:He,phase:Hr.nullable(),phaseScope:p.z.string().min(1).nullable(),phaseDone:H.nullable(),phaseTotal:H.nullable(),heartbeatAt:w,isStale:p.z.boolean(),cancelRequestedAt:w.nullable()}).strict(),Ha=(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."),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.")},Vr=za.superRefine(Ha),Ka=p.z.object({run:He,quantities:p.z.array(Br),previousStoreFingerprint:jr.nullable()}).strict(),Ga=(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 l of Tt)o[l]!==null&&d(t,["quantities",r,l],"A SCAN run repairs nothing, so its quantities carry no repair counts.")}},ja=["FAILED","CANCELLED","ABANDONED"],Ba=p.z.object({run:He,repairAppliedItems:H.nullable(),hasNewerRepair:p.z.boolean()}).strict(),Va=(e,t)=>{ja.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.")},Ja=p.z.object({readAt:w,lastCompleted:Ka.superRefine(Ga).nullable(),active:Vr.nullable(),newerUnsuccessful:Ba.superRefine(Va).nullable()}).strict(),Ya=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:Kr.nullable(),repairErrorClass:p.z.string().min(1).nullable(),repairSkipReason:Gr.nullable()}).strict(),$a=(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.")},Jr=Ya.superRefine($a),qa=p.z.object({sotDomain:p.z.string().nullable()}).passthrough(),Xa=p.z.object({rows:p.z.array(Jr),nextAfter:p.z.number().int().min(1).nullable(),recordedCount:H,totalCount:H.nullable()}).strict(),Wa=(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.")},Qa=Xa.superRefine(Wa),Za=p.z.object({runUid:ae,store:ze,scopeKey:p.z.string().min(1),itemClass:wt,after:p.z.number().int().min(1).optional(),limit:p.z.number().int().min(1).max(ye)}).strict(),ei=p.z.object({runUid:ae,store:ze,scopeKey:p.z.string().min(1),itemClass:wt.extract(["UNRECORDED"]),after:p.z.number().int().min(1).optional()}).strict(),ti=p.z.object({requeued:H,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(),ni=(e,t)=>{let n=e.requeued+e.skipped.length;n>ye&&d(t,["requeued"],`One chunk settles at most ${ye} documents.`),e.nextAfter!==null!=(n===ye)&&d(t,["nextAfter"],"A chunk continues exactly when it read the limit.");let r=new Set;for(let[o,i]of e.skipped.entries())r.has(i.metadataId)&&d(t,["skipped",o,"metadataId"],"A chunk keeps a document back once."),r.add(i.metadataId)},ri=ti.superRefine(ni),Ke=p.z.enum(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Nt=p.z.enum(["start","cancel"]),Yr=Ke.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","FORBIDDEN","UPSTREAM_FAILED"]),$r=Ke.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),kt={start:Yr,cancel:$r},oi=p.z.object({code:Ke.exclude(["UPSTREAM_FAILED"]),status:Ue,errorCode:p.z.number().int().nullable()}).strict(),Ft=Object.freeze(p.z.array(oi).parse(Dr).map(e=>Object.freeze(e))),ai=(e,t)=>{e.code==="UPSTREAM_FAILED"||e.code==="FORBIDDEN"&&e.status===null||Ft.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.`)},ii=p.z.discriminatedUnion("command",[p.z.object({command:Nt.extract(["start"]),code:kt.start,status:Ue.nullable()}).strict(),p.z.object({command:Nt.extract(["cancel"]),code:kt.cancel,status:Ue.nullable()}).strict()]).superRefine(ai),si=(e,t,n)=>{let r=kt[e],o=Ft.find(i=>i.status===t&&(i.errorCode===null||i.errorCode===n)&&r.safeParse(i.code).success);return o===void 0?"UPSTREAM_FAILED":o.code},li=p.z.discriminatedUnion("ok",[p.z.object({ok:p.z.literal(!0),runUid:ae}).strict(),p.z.object({ok:p.z.literal(!1),status:Ue,errorCode:p.z.number().int().nullable()}).strict()]);function qr(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 Xr=e=>e.replace(/\s/gu,"");function ee(e,t){let n=new Map,r=i=>{let l=new Int32Array(i.length);return i.forEach((s,c)=>{let h=n.get(s);h===void 0&&(h=n.size,n.set(s,h)),l[c]=h}),l};return{old:r(e),new:r(t),alphabetSize:n.size}}function Ge(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 Wr(e,t,n,r,o,i,l){let s=0;for(;n+s<r&&o+s<i&&e[n+s]===t[o+s];)s++;Ge(l,n,o,s);let c=0;for(;r-c>n+s&&i-c>o+s&&e[r-1-c]===t[i-1-c];)c++;return{oldLow:n+s,oldHigh:r-c,newLow:o+s,newHigh:i-c,suffix:c}}function ci(e,t,n){let{oldLow:r,oldHigh:o,newLow:i,newHigh:l}=n,s=o-r,c=l-i,h=Math.ceil((s+c)/2),u=h,y=2*h+2,E=new Int32Array(y).fill(-1),_=new Int32Array(y).fill(-1);E[u+1]=0,_[u+1]=0;let C=s-c,N=C%2!==0,O=0,g=0,T=0,f=0;for(let R=0;R<h;R++){for(let D=-R+O;D<=R-g;D+=2){let x=u+D,A=D===-R||D!==R&&E[x-1]<E[x+1]?E[x+1]:E[x-1]+1,P=A-D;for(;A<s&&P<c&&e[r+A]===t[i+P];)A++,P++;if(E[x]=A,A>s)g+=2;else if(P>c)O+=2;else if(N){let v=u+C-D;if(v>=0&&v<y&&_[v]!==-1&&A>=s-_[v])return{kind:"split",oldSplit:r+A,newSplit:i+P}}}for(let D=-R+T;D<=R-f;D+=2){let x=u+D,A=D===-R||D!==R&&_[x-1]<_[x+1]?_[x+1]:_[x-1]+1,P=A-D;for(;A<s&&P<c&&e[o-1-A]===t[l-1-P];)A++,P++;if(_[x]=A,A>s)f+=2;else if(P>c)T+=2;else if(!N){let v=u+C-D;if(v>=0&&v<y&&E[v]!==-1){let b=E[v];if(b>=s-A)return{kind:"split",oldSplit:r+b,newSplit:i+u+b-v}}}}}return{kind:"disjoint"}}function te(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"){Ge(n,o.oldStart,o.newStart,o.length);continue}let i=Wr(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 l=ci(e,t,i);l.kind==="split"&&(r.push({kind:"region",oldLow:l.oldSplit,oldHigh:i.oldHigh,newLow:l.newSplit,newHigh:i.newHigh}),r.push({kind:"region",oldLow:i.oldLow,oldHigh:l.oldSplit,newLow:i.newLow,newHigh:l.newSplit}))}return n}function Qr(e,t,n){let r=Math.ceil(t.length/32),o=new Array(n);t.forEach((s,c)=>{let h=o[s];h===void 0&&(h=new Uint32Array(r),o[s]=h),h[c>>>5]=(h[c>>>5]|1<<(c&31))>>>0});let i=new Uint32Array(r).fill(4294967295);for(let s of e){let c=o[s];if(c===void 0)continue;let h=0;for(let u=0;u<r;u++){let y=i[u],E=(y&c[u])>>>0,_=y+E+h;h=_>4294967295?1:0,i[u]=(_>>>0|y&~c[u])>>>0}}let l=0;for(let s=0;s<t.length;s++)l+=i[s>>>5]>>>(s&31)&1;return t.length-l}function di(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 Zr(e,t){let{old:n,new:r,alphabetSize:o}=e,i=new Int32Array(o),l=new Int32Array(o),s=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"){Ge(h,y.oldStart,y.newStart,y.length);continue}let E=Wr(n,r,y.oldLow,y.oldHigh,y.newLow,y.newHigh,h),_={kind:"run",oldStart:E.oldHigh,newStart:E.newHigh,length:E.suffix},{oldLow:C,oldHigh:N,newLow:O,newHigh:g}=E;if(C===N||O===g){u.push(_);continue}for(let x=N-1;x>=C;x--){let A=n[x];i[A]++,c[x]=s[A],s[A]=x}let T={best:null},f=x=>{(T.best===null||di(x,T.best,C+N))&&(T.best=x)},R=new Map;for(let x=O;x<g;x++){let A=r[x],P=i[A];if(!(P===0||P>t.maxOccurrences||T.best!==null&&P>T.best.occurrences))for(let v=s[A];v!==-1;v=c[v]){let b=R.get(x-v);if(b!==void 0&&x>=b.newStart&&x<b.newEnd){P<b.occurrences&&(b.occurrences=P,f({occurrences:P,oldStart:b.oldStart,newStart:b.newStart,length:b.newEnd-b.newStart}));continue}let L=v,F=x;for(;L>C&&F>O&&n[L-1]===r[F-1];)L--,F--;let z=v-L+1;for(;L+z<N&&F+z<g&&n[L+z]===r[F+z];)z++;R.set(x-v,{oldStart:L,newStart:F,newEnd:F+z,occurrences:P}),f({occurrences:P,oldStart:L,newStart:F,length:z})}}let D=T.best;D!==null?(u.push(_),u.push({kind:"region",oldLow:D.oldStart+D.length,oldHigh:N,newLow:D.newStart+D.length,newHigh:g}),u.push({kind:"run",oldStart:D.oldStart,newStart:D.newStart,length:D.length}),u.push({kind:"region",oldLow:C,oldHigh:D.oldStart,newLow:O,newHigh:D.newStart})):(ui(n,r,E,i,l,t.cellBound,h),u.push(_));for(let x=C;x<N;x++){let A=n[x];i[A]=0,s[A]=-1}}return h}function ui(e,t,n,r,o,i,l){let{oldLow:s,oldHigh:c,newLow:h,newHigh:u}=n;if((c-s)*(u-h)>i)return;for(let C=h;C<u;C++)o[t[C]]++;let y=[];for(let C=s;C<c;C++)o[e[C]]>0&&y.push(C);let E=[];for(let C=h;C<u;C++)r[t[C]]>0&&E.push(C),o[t[C]]=0;let _=te(Int32Array.from(y,C=>e[C]),Int32Array.from(E,C=>t[C]));for(let C of _)for(let N=0;N<C.length;N++)Ge(l,y[C.oldStart+N],E[C.newStart+N],1)}function eo(e,t,n){let r=[],o=0,i=0;for(let l of[...n,{oldStart:e,newStart:t,length:0}])(l.oldStart>o||l.newStart>i)&&r.push({oldStart:o,oldEnd:l.oldStart,newStart:i,newEnd:l.newStart}),o=l.oldStart+l.length,i=l.newStart+l.length;return r}function Pt(e,t,n,r){let o=new Map;for(let l of t){let s=r(l);s!==null&&o.set(s,[...o.get(s)??[],l])}let i=[];for(let l of e){let s=n(l),c=s===null?void 0:o.get(s)?.shift();c!==void 0&&i.push([l,c])}return i}function to(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 V=e=>e.flatMap((t,n)=>t===null?[n]:[]);function Lt(e,t){let n=e?.children??[],r=t?.children??[],o=ee(n.map(f=>f.hash),r.map(f=>f.hash)),i=n.map(()=>null),l=r.map(()=>null),s=[],c=n.map(()=>0),h=r.map(()=>0);for(let f of te(o.old,o.new))for(let R=0;R<f.length;R++)i[f.oldStart+R]=f.newStart+R,l[f.newStart+R]=f.oldStart+R;let u=0;n.forEach((f,R)=>{c[R]=u,u+=i[R]===null?0:1}),u=0,r.forEach((f,R)=>{h[R]=u,l[R]!==null&&(s.push(R),u++)});let y=[],E=(f,R,D)=>{for(let[x,A]of f)i[x]=A,l[A]=x,y.push({entry:{kind:R,pairing:D,oldPosition:x,newPosition:A},order:[A,1,A]})},_=f=>n[f],C=f=>r[f];E(Pt(V(i),V(l),f=>_(f).hash,f=>C(f).hash),"MOVED",null);let N=to(V(i),n),O=to(V(l),r),g=f=>f.clause!==null&&N.get(f.clause)===1&&O.get(f.clause)===1?f.clause:null;E(Pt(V(i),V(l),f=>g(_(f)),f=>g(C(f))),"MODIFIED","clause"),E(Pt(V(i),V(l),f=>JSON.stringify([c[f],_(f).breadcrumbs]),f=>JSON.stringify([h[f],C(f).breadcrumbs])),"MODIFIED","breadcrumbs");for(let f of V(i)){let R=c[f],D=R===0?0:s[R-1]+1;y.push({entry:{kind:"REMOVED",pairing:null,oldPosition:f,newPosition:null},order:[D,0,f]})}for(let f of V(l))y.push({entry:{kind:"ADDED",pairing:null,oldPosition:null,newPosition:f},order:[f,1,f]});y.sort((f,R)=>f.order[0]-R.order[0]||f.order[1]-R.order[1]||f.order[2]-R.order[2]);let T=f=>y.filter(({entry:R})=>R.kind===f).length;return{entries:y.map(({entry:f})=>f),stats:{added:T("ADDED"),removed:T("REMOVED"),modified:T("MODIFIED"),moved:T("MOVED"),unchanged:s.length}}}var je=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),se=(e,t)=>`${e}/${String(t).replace(/~/g,"~0").replace(/\//g,"~1")}`;function vt(e,t,n,r,o){U(t)!==U(n)&&(je(t)&&je(n)?pi(e,t,n,r,o):Array.isArray(t)&&Array.isArray(n)?mi(e,t,n,r,o):r.push({op:"replace",path:e,value:n,previous:t}))}function pi(e,t,n,r,o){let i=[...new Set([...Object.keys(t),...Object.keys(n)])].sort(B);for(let l of i){let s=se(e,l);Object.hasOwn(n,l)?Object.hasOwn(t,l)?vt(s,t[l],n[l],r,o):r.push({op:"add",path:s,value:n[l]}):r.push({op:"remove",path:s,previous:t[l]})}}function mi(e,t,n,r,o){let i=ee(t.map(U),n.map(U)),l=0;for(;l<t.length&&l<n.length&&i.old[l]===i.new[l];)l++;let s=0;for(;s<t.length-l&&s<n.length-l&&i.old[t.length-1-s]===i.new[n.length-1-s];)s++;let c=(t.length-l-s)*(n.length-l-s);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[...te(i.old,i.new),{oldStart:t.length,newStart:n.length,length:0}]){let _=t.slice(u,E.oldStart),C=n.slice(y,E.newStart),N=Math.min(_.length,C.length);for(let O=0;O<N;O++){let g=_[O],T=C[O];je(g)&&je(T)||Array.isArray(g)&&Array.isArray(T)?vt(se(e,h),g,T,r,o):(r.push({op:"remove",path:se(e,h),previous:g}),r.push({op:"add",path:se(e,h),value:T})),h++}for(let O of _.slice(N))r.push({op:"remove",path:se(e,h),previous:O});for(let O of C.slice(N))r.push({op:"add",path:se(e,h),value:O}),h++;h+=E.length,u=E.oldStart+E.length,y=E.newStart+E.length}}function Mt(e,t){let n=[];return vt("",e,t,n,{remaining:Et}),n}function no(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 Ut(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 ro(e){let t=[],n=[],r={LF:0,CRLF:0,CR:0},o=0,i=0,l=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(l);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,l=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(l));let s=r.LF+r.CRLF+r.CR,c=["LF","CRLF","CR"].filter(u=>r[u]>0),h=s===0?"NONE":c.length===1?c[0]:"MIXED";return{lines:t,starts:n,lineEnding:h,finalNewline:s>0&&o===e.length}}var oo=null;function ao(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>767)return!1;return!0}function Kt(e){return ao(e)?e.split(""):(oo??=new Intl.Segmenter("und",{granularity:"grapheme"}),Array.from(oo.segment(e),t=>t.segment))}function zt(e){return ao(e)?e.length:Kt(e).length}function fi(e,t,n){let r=e.length+t.length;if(n.exhausted||e.length>Fe||t.length>Fe||r===0)return null;let o=ee(e,t),i=Qr(o.old,o.new,o.alphabetSize);if(2*i/r<Pe||r-2*i>gt)return null;let l=r*(r-2*i);if(l>n.remaining)return n.exhausted=!0,null;n.remaining-=l;let s=te(o.old,o.new),c=[],h=0,u=0;for(let g of[...s,{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,T)=>{let f=y[y.length-1],R=f!==void 0&&!f.equal,D=g.equal&&g.oldEnd-g.oldStart<=1&&R&&T+1<c.length;if(R&&(D||!g.equal)){f.oldEnd=g.oldEnd,f.newEnd=g.newEnd;return}y.push({...g})});let E=0,_=0,C=0,N=[],O=[];for(let g of y){let T=e.slice(g.oldStart,g.oldEnd).join(""),f=t.slice(g.newStart,g.newEnd).join("");if(g.equal){E+=g.oldEnd-g.oldStart,N.push({kind:"equal",text:T}),O.push({kind:"equal",text:f});continue}_+=g.oldEnd-g.oldStart,C+=g.newEnd-g.newStart,T!==""&&N.push({kind:"removed",text:T}),f!==""&&O.push({kind:"added",text:f})}return 2*E/r<Pe?null:{oldSegments:N,newSegments:O,removed:_,added:C}}var io={old:[],new:[]};function ge(e){return e.filter(([,t,n])=>U(t)!==U(n)).map(([t,n,r])=>({field:t,before:n,after:r}))}var Ht=(e,t)=>t===""?[]:[{kind:e,text:t}];function hi(e,t,n){let r=[],o=(s,c)=>({kind:"context",oldNumber:s+1,newNumber:c+1,page:Ut(n.pages.new,n.newText.starts[c]),segments:Ht("equal",n.newText.lines[c])}),i=t.oldStart,l=t.newStart;for(let s of e){for(;i<s.oldStart;i++,l++)r.push(o(i,l));for(let c=s.oldStart;c<s.oldEnd;c++){let h=n.oldText.lines[c];r.push({kind:"removed",oldNumber:c+1,newNumber:null,page:Ut(n.pages.old,n.oldText.starts[c]),segments:n.removedSegments.get(c)??Ht("removed",h)})}for(let c=s.newStart;c<s.newEnd;c++){let h=n.newText.lines[c];r.push({kind:"added",oldNumber:null,newNumber:c+1,page:Ut(n.pages.new,n.newText.starts[c]),segments:n.addedSegments.get(c)??Ht("added",h)})}i=s.oldEnd,l=s.newEnd}for(;i<t.oldEnd;i++,l++)r.push(o(i,l));return r}function Gt(e,t,n,r){let o=ro(e??""),i=ro(t??""),l=ge([["present",e!==null,t!==null],["lineEnding",o.lineEnding,i.lineEnding],["finalNewline",o.finalNewline,i.finalNewline]]),s=Zr(ee(o.lines,i.lines),{maxOccurrences:ht,cellBound:yt}),c=eo(o.lines.length,i.lines.length,s),h=new Map,u=new Map,y={remaining:St,exhausted:!1},E=0,_=0,C=0,N=0,O=0,g=0;for(let b of c){C+=b.oldEnd-b.oldStart,N+=b.newEnd-b.newStart;let L=Math.min(b.oldEnd-b.oldStart,b.newEnd-b.newStart);for(let F=0;b.oldStart+F<b.oldEnd||b.newStart+F<b.newEnd;F++){let z=b.oldStart+F,K=b.newStart+F;if(F>=L){let ce=z<b.oldEnd?zt(o.lines[z]):0,re=K<b.newEnd?zt(i.lines[K]):0;O+=ce,g+=re,E+=ce,_+=re;continue}let J=Kt(o.lines[z]),q=Kt(i.lines[K]);O+=J.length,g+=q.length;let X=fi(J,q,y);if(X!==null){h.set(z,X.oldSegments),u.set(K,X.newSegments),E+=X.removed,_+=X.added;continue}E+=J.length,_+=q.length}}let T=0;for(let b of s)for(let L=b.oldStart;L<b.oldStart+b.length;L++)T+=zt(o.lines[L]);let f=T+O,R=T+g,D={linesAdded:N,linesRemoved:C,linesUnchanged:o.lines.length-C,charsAdded:_,charsRemoved:E,similarity:f+R===0?null:2*(f-E)/(f+R)},x=r==="whole"?Math.max(o.lines.length,i.lines.length):r,A=[];for(let b of c){let L=A[A.length-1],F=L?.[L.length-1];L!==void 0&&F!==void 0&&b.oldStart-F.oldEnd<=2*x?L.push(b):A.push([b])}let P={oldText:o,newText:i,pages:n,removedSegments:h,addedSegments:u},v=A.map((b,L)=>{let F=b[0],z=b[b.length-1],K=Math.max(0,F.oldStart-x),J=F.newStart-(F.oldStart-K),q=Math.min(o.lines.length,z.oldEnd+x),X=z.newEnd+(q-z.oldEnd),ce=hi(b,{oldStart:K,oldEnd:q,newStart:J},P);return{hunk:L,oldStart:q>K?K+1:K,oldLines:q-K,newStart:X>J?J+1:J,newLines:X-J,firstPage:ce[0].page,linesAdded:b.reduce((re,de)=>re+de.newEnd-de.newStart,0),linesRemoved:b.reduce((re,de)=>re+de.oldEnd-de.oldStart,0),lines:ce}});return{attributes:l,stats:D,hunks:v}}function Se(e,t){let n=Gt(e.body,t.body,{old:no(e.pageOffsets),new:no(t.pageOffsets)},we),r=ge([["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 Ee(e,t){return Gt(e,t,io,we)}function so(e,t){return Gt(e,t,io,"whole")}function Ce(e){return{attributes:[...e.attributes],stats:e.stats,hunks:e.hunks.map(({lines:t,...n})=>n)}}function lo(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(!At.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 Be(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 co(e,t,n,r){let o=0,i=0;for(;o<e.length||i<t.length;){let l=e[o],s=t[i],c=l===void 0?1:s===void 0?-1:n(l,s);r(c<=0?l:null,c>=0?s:null),o+=c<=0?1:0,i+=c>=0?1:0}}function jt(e,t){let n=[],r=[],o=0;return co(Be(e??[],B,String),Be(t??[],B,String),B,(i,l)=>{i!==null&&l!==null?o++:i!==null?r.push(i):n.push(l)}),{added:n,removed:r,unchangedCount:o}}function uo(e,t,n){let r=[],o=[],i=[],l=0;return co(Be(e,n.compare,n.keyOf),Be(t,n.compare,n.keyOf),n.compare,(s,c)=>{if(s===null){r.push({key:n.keyOf(c),value:{...c}});return}if(c===null){o.push({key:n.keyOf(s),value:{...s}});return}let h=new Map(n.fieldsOf(c)),u=ge(n.fieldsOf(s).map(([y,E])=>[y,E,h.get(y)]));u.length===0?l++:i.push({key:n.keyOf(s),fields:u})}),{added:r,removed:o,modified:i,unchangedCount:l}}var yi={compare:(e,t)=>B(e.labelKey,t.labelKey),keyOf:e=>e.labelKey,fieldsOf:e=>[["assignedBy",e.assignedBy],["confidenceScore",e.confidenceScore]]},gi={compare:Le,keyOf:e=>`${e.assetType}:${e.assetIndex}`,fieldsOf:e=>[["mimeType",e.mimeType],["fileSize",e.fileSize],["textSha256",e.textSha256]]},Bt=(e,t)=>uo(e,t,yi),Vt=(e,t)=>uo(e,t,gi);function be(e,t,n){return ge(n.map(r=>[r,e[r],t[r]]))}var fo=["confidentialityLevel","departmentId","folderPath","createdBy"],ho=["fileName","filePath","fileId","revision","revisionId","fileSize","mimeType","fileHash","mtime"],ne=(e,t)=>({facet:e,addedCount:null,removedCount:null,modifiedCount:null,movedCount:null,unchangedCount:null,charsAdded:null,charsRemoved:null,...t}),po=(e,t)=>ne(e,{addedCount:t.stats.linesAdded,removedCount:t.stats.linesRemoved,unchangedCount:t.stats.linesUnchanged,charsAdded:t.stats.charsAdded,charsRemoved:t.stats.charsRemoved});function Si(e){switch(e.facet){case"classification":return ne("classification",{modifiedCount:be(e.from,e.to,fo).length});case"metadata":return ne("metadata",{modifiedCount:be(e.from,e.to,ho).length});case"labels":case"assets":{let t=e.facet==="labels"?Bt(e.from,e.to):Vt(e.from,e.to);return ne(e.facet,{addedCount:t.added.length,removedCount:t.removed.length,modifiedCount:t.modified.length,unchangedCount:t.unchangedCount})}case"tags":{let t=jt(e.from,e.to);return ne("tags",{addedCount:t.added.length,removedCount:t.removed.length,unchangedCount:t.unchangedCount})}case"structured_data":{let t=Mt(e.from,e.to),n=r=>t.filter(o=>o.op===r).length;return ne("structured_data",{addedCount:n("add"),removedCount:n("remove"),modifiedCount:n("replace")})}case"text":return po("text",Se(e.from,e.to));case"summary":return po("summary",Ee(e.from,e.to));case"chunks":{let{stats:t}=Lt(e.from,e.to);return ne("chunks",{addedCount:t.added,removedCount:t.removed,modifiedCount:t.modified,movedCount:t.moved,unchangedCount:t.unchanged})}}}function yo(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),U(n.from)===U(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)=>ve(n.facet,r.facet)).map(Si)}var Ei=(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 mo(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 Ci(e,t,n){let r=t.facets,o=n.facets;if(U(r[e])===U(o[e]))return{facet:e,change:"UNCHANGED"};switch(e){case"classification":return{facet:e,change:"CHANGED",fields:be(r.classification,o.classification,fo)};case"metadata":return{facet:e,change:"CHANGED",fields:be(r.metadata,o.metadata,ho)};case"labels":case"assets":{let i=e==="labels"?Bt(r.labels,o.labels):Vt(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=jt(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:Mt(r.structured_data,o.structured_data)};case"text":return{facet:e,change:"CHANGED",...Ce(Se(r.text,o.text))};case"summary":return{facet:e,change:"CHANGED",...Ce(Ee(r.summary,o.summary))};case"chunks":{let i=Lt(r.chunks,o.chunks),l=r.chunks?.children??[],s=o.chunks?.children??[],c=(h,u,y)=>y===null?null:Ei(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(l,t.chunkFidelities,h.oldPosition),new:c(s,n.chunkFidelities,h.newPosition)})),textUnchangedChunkingChanged:r.text.body===o.text.body}}}}function go(e,t){return mo(e,"from"),mo(t,"to"),{diffEngineVersion:ft,facets:Z.map(n=>Ci(n,e,t))}}var Jt=[{key:"enable_summary_generation",featureFlagKey:null,label:"\u8981\u7D04\u751F\u6210"},{key:"enable_structured_extraction",featureFlagKey:null,label:"\u69CB\u9020\u5316\u62BD\u51FA"},{key:"enable_asset_extraction",featureFlagKey:"ENABLE_ASSET_EXTRACTION",label:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA"},{key:"enable_vector_indexing",featureFlagKey:"ENABLE_VECTOR_INDEXING",label:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15"},{key:"enable_graph_indexing",featureFlagKey:"ENABLE_GRAPH_INDEXING",label:"\u30B0\u30E9\u30D5\u6295\u5F71"}],bi=new Set(Jt.map(e=>e.key));function Ri(e){return bi.has(e)}function Ii(e){let t=Jt.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 xi={pageSize:{min:1,max:200,default:50},topologyLabels:{min:1,max:24,default:24}};var le=-1,$=0;function So(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 Ai(){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===le){if($++,$>4095){for(;Date.now()<=le;);n=Date.now(),le=n,$=(t[6]<<4|t[7]&15)&1023}}else n>le?(le=n,$=(t[6]<<4|t[7]&15)&1023):(n=le,$++,$>4095&&($=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|$>>>8&15,t[7]=$&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 _i(e){if(!So(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,CHUNK_BODY_FIDELITIES,CHUNK_CHANGE_KINDS,CHUNK_MANIFEST_VERSION,CHUNK_PAIRINGS,CIRCUIT_BREAKER_SERVICES,CanonicalDomainKeySchema,ChangeFeedCursorSchema,ChapterSegmentSchema,ChunkBodyFidelitySchema,ChunkChangeKindSchema,ChunkChangeSchema,ChunkManifestChildSchema,ChunkManifestParentSchema,ChunkManifestSchema,ChunkPairingSchema,ChunkRefSchema,ChunkStatsSchema,ChunkingStrategySchema,CircuitBreakerStatusSchema,ClassificationFacetSchema,ConfidentialityLevelSchema,DIFF_CONTEXT_LINES,DIFF_ENGINE_VERSION,DIFF_LINE_FACETS,DIFF_LINE_PAGE_MAX,DIFF_REGION_CELL_BOUND,DISPATCH_DEGRADATION_REASONS,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,FILTERABLE_CONFIDENTIALITY_LEVELS,FacetChangeCountsSchema,FacetDiffSchema,FieldChangeSchema,FileUriSchema,GRAPH_INDEX_LIMITS,GraphSearchHitSchema,HISTOGRAM_MAX_OCCURRENCES,HunkIndexEntrySchema,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,LOCAL_DEGRADATION_REASONS,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,PipelineFailureStatusSchema,PipelineRunRecordSchema,PipelineRunStatusSchema,PipelineRunSummarySchema,PipelineStepKeySchema,PipelineStepMetricSchema,PipelineStepRecordSchema,PipelineStepStatusSchema,PipelineTriggerSchema,QUARANTINED_CONFIDENTIALITY_LEVEL,REMOTE_DEGRADATION_REASONS,RESTRICTED_MARK_SUBJECTS,RUN_TERMINAL_STEP_ERROR_CODES,RUN_TERMINAL_STEP_KEY,RUN_TERMINAL_STEP_OUTCOMES,ReadableConfidentialityLevelSchema,RecentPipelineRunEntrySchema,RestrictedChangeMarkSchema,RestrictedFailureMarkSchema,RestrictedIngestMarkSchema,RestrictedMarkSubjectSchema,RestrictedRunMarkSchema,RestrictedStateMarkSchema,RunTerminalStepDetailSchema,RunTerminalStepErrorCodeSchema,RunTerminalStepOutcomeSchema,SEARCH_DEGRADATION_REASONS,SEARCH_MODES,SEARCH_PARAM_LIMITS,STALE_RUN_ERROR_CODE,STRUCTURED_DATA_ARRAY_CELL_BOUND,SYSTEM_PARAMETER_RANGES,SearchHitSchema,SearchMetadataSchema,SearchModeSchema,SearchRequestSchema,SearchResponseSchema,StageProvenanceSchema,TenantIdSchema,TextDiffIndexSchema,TextFacetSchema,TextStatsSchema,TranscriptSegmentSchema,assertBoundedSystemParameter,assertSystemParameterInRange,canonicalJson,classifyDocumentKind,codePointSlicer,compareAssetKeys,compareCodeUnits,compareFacets,comparePhases,compareStates,decodeChangeFeedCursor,diffChunkBodies,diffLinePage,encodeChangeFeedCursor,enrichmentStage,flowFor,flowStepGates,formatSkipReason,generateUuidV7,integrityCommandFailureCodeOf,isEnrichmentStageKey,isStrictlyEarlier,isValidUuidV7,modeFusesRankings,modeNeedsRemoteTiers,modeScoreIsSimilarity,narrowModeToAllowedTiers,orderedSteps,parseSkipReason,readableEntrySchema,stripWhitespace,summarizeTransition,summaryFacetDiff,textDiffIndex,textFacetDiff,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:()=>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});
|