import { l as ChannelTurnAdmission, t as AccessFacts } from "./types-qx0VTuTq.js";
import { n as DmGroupAccessDecision, r as DmGroupAccessReasonCode } from "./dm-policy-shared-BgMuswxr.js";
import { $ as ResolvedRouteGateFacts, A as ChannelIngressChannelId, B as IngressGatePhase, D as AccessGraphGate, E as AccessGraph, F as ChannelIngressPolicyInput, G as InternalMatchMaterial, H as InternalChannelIngressAdapter, I as ChannelIngressState, J as RedactedChannelIngressEvent, K as InternalNormalizedEntry, L as ChannelIngressStateInput$1, M as ChannelIngressEventInput, N as ChannelIngressIdentifierKind, O as AccessGroupMembershipFact, P as ChannelIngressNormalizedEntry, Q as ResolvedIngressAllowlist, R as IngressGateEffect, T as decideChannelIngress, U as InternalChannelIngressNormalizeResult, V as IngressReasonCode, W as InternalChannelIngressSubject, X as RedactedIngressEntryDiagnostic, Y as RedactedIngressAllowlistFacts, Z as RedactedIngressMatch, et as RouteGateFacts, j as ChannelIngressDecision, k as ChannelIngressAdmission, nt as RouteSenderAllowlistSource, q as MatchableIdentifier, rt as RouteSenderPolicy, tt as RouteGateState, z as IngressGateKind } from "./index-8XyowQOM.js";

//#region src/plugin-sdk/channel-ingress.d.ts
type ChannelIngressSubjectIdentifier = InternalMatchMaterial;
type ChannelIngressSubject = InternalChannelIngressSubject;
type ChannelIngressAdapterEntry = InternalNormalizedEntry;
type ChannelIngressAdapterNormalizeResult = InternalChannelIngressNormalizeResult;
type ChannelIngressAdapter = InternalChannelIngressAdapter;
type ChannelIngressStateInput = ChannelIngressStateInput$1;
declare const CHANNEL_INGRESS_PLUGIN_ID: unique symbol;
type ChannelIngressPluginId = string & {
  readonly [CHANNEL_INGRESS_PLUGIN_ID]: true;
};
type ChannelIngressGateSelector = {
  phase: IngressGatePhase;
  kind: IngressGateKind;
};
type ChannelIngressDecisionBundle = {
  dm: ChannelIngressDecision;
  group: ChannelIngressDecision;
  dmCommand: ChannelIngressDecision;
  groupCommand: ChannelIngressDecision;
};
type ChannelIngressSideEffectResult = {
  kind: "none";
} | {
  kind: "pairing-reply-sent";
} | {
  kind: "pairing-reply-failed";
  errorCode?: string;
} | {
  kind: "command-reply-sent";
} | {
  kind: "command-reply-failed";
  errorCode?: string;
} | {
  kind: "pending-history-recorded";
} | {
  kind: "local-event-handled";
};
type RedactedIngressDiagnostics = {
  decisiveGateId?: string;
  reasonCode: IngressReasonCode;
};
declare const CHANNEL_INGRESS_GATE_SELECTORS: {
  readonly command: {
    readonly phase: "command";
    readonly kind: "command";
  };
  readonly activation: {
    readonly phase: "activation";
    readonly kind: "mention";
  };
  readonly dmSender: {
    readonly phase: "sender";
    readonly kind: "dmSender";
  };
  readonly groupSender: {
    readonly phase: "sender";
    readonly kind: "groupSender";
  };
  readonly event: {
    readonly phase: "event";
    readonly kind: "event";
  };
};
type ChannelIngressSubjectIdentifierInput = {
  value: string;
  opaqueId?: string;
  kind?: ChannelIngressIdentifierKind;
  dangerous?: boolean;
  sensitivity?: "normal" | "pii";
};
type CreateChannelIngressStringAdapterParams = {
  kind?: ChannelIngressIdentifierKind;
  normalizeEntry?: (value: string) => string | null | undefined;
  normalizeSubject?: (value: string) => string | null | undefined;
  isWildcardEntry?: (value: string) => boolean;
  resolveEntryId?: (params: {
    entry: string;
    index: number;
  }) => string;
  dangerous?: boolean | ((entry: string) => boolean);
  sensitivity?: "normal" | "pii";
};
type CreateChannelIngressMultiIdentifierAdapterParams = {
  normalizeEntry: (entry: string, index: number) => readonly ChannelIngressAdapterEntry[];
  getEntryMatchKey?: (entry: ChannelIngressAdapterEntry) => string | null | undefined;
  getSubjectMatchKeys?: (identifier: ChannelIngressSubjectIdentifier) => readonly (string | null | undefined)[];
  isWildcardEntry?: (entry: ChannelIngressAdapterEntry) => boolean;
};
type ChannelIngressDmGroupAccessProjection = {
  decision: DmGroupAccessDecision;
  reasonCode: DmGroupAccessReasonCode;
  reason: string;
};
type ChannelIngressSenderGroupAccessProjection = {
  allowed: boolean;
  groupPolicy: ChannelIngressPolicyInput["groupPolicy"];
  providerMissingFallbackApplied: boolean;
  reason: "allowed" | "disabled" | "empty_allowlist" | "sender_not_allowlisted";
};
/** @deprecated Use `resolveChannelMessageIngress` from `nodmix/plugin-sdk/channel-ingress-runtime`. */
type ResolveChannelIngressAccessParams = ChannelIngressStateInput & {
  policy: ChannelIngressPolicyInput;
  effectiveAllowFrom?: readonly string[];
  effectiveGroupAllowFrom?: readonly string[];
};
/** @deprecated Use `resolveChannelMessageIngress` from `nodmix/plugin-sdk/channel-ingress-runtime`. */
type ResolvedChannelIngressAccess = {
  state: ChannelIngressState;
  ingress: ChannelIngressDecision;
  isGroup: boolean;
  senderReasonCode: IngressReasonCode;
  access: ChannelIngressDmGroupAccessProjection & {
    effectiveAllowFrom: string[];
    effectiveGroupAllowFrom: string[];
  };
  commandAuthorized: boolean;
  shouldBlockControlCommand: boolean;
};
declare function findChannelIngressGate(decision: ChannelIngressDecision, selector: ChannelIngressGateSelector): AccessGraphGate | undefined;
declare function findChannelIngressSenderGate(decision: ChannelIngressDecision, params: {
  isGroup: boolean;
}): AccessGraphGate | undefined;
declare function findChannelIngressCommandGate(decision: ChannelIngressDecision): AccessGraphGate | undefined;
declare function decideChannelIngressBundle(params: {
  directState: ChannelIngressState;
  groupState: ChannelIngressState;
  basePolicy: ChannelIngressPolicyInput;
  commandPolicy: ChannelIngressPolicyInput;
}): ChannelIngressDecisionBundle;
declare function projectIngressAccessFacts(decision: ChannelIngressDecision): AccessFacts;
declare function mapChannelIngressDecisionToTurnAdmission(decision: ChannelIngressDecision, sideEffect: ChannelIngressSideEffectResult): ChannelTurnAdmission;
declare function createChannelIngressPluginId(id: string): ChannelIngressPluginId;
declare function createChannelIngressSubject(input: ChannelIngressSubjectIdentifierInput | {
  identifiers: readonly ChannelIngressSubjectIdentifierInput[];
}): ChannelIngressSubject;
declare function createChannelIngressStringAdapter(params?: CreateChannelIngressStringAdapterParams): ChannelIngressAdapter;
declare function createChannelIngressMultiIdentifierAdapter(params: CreateChannelIngressMultiIdentifierAdapterParams): ChannelIngressAdapter;
declare function assertNeverChannelIngressReason(reasonCode: never): never;
/** @deprecated Use `senderAccess.reasonCode` from `resolveChannelMessageIngress(...)` or typed gate selectors. */
declare function findChannelIngressSenderReasonCode(decision: ChannelIngressDecision, params: {
  isGroup: boolean;
}): IngressReasonCode;
/** @deprecated Use `senderAccess.reasonCode` from `resolveChannelMessageIngress(...)`. */
declare function mapChannelIngressReasonCodeToDmGroupAccessReason(params: {
  reasonCode: IngressReasonCode;
  isGroup: boolean;
}): DmGroupAccessReasonCode;
/** @deprecated Use `senderAccess.reason` from `resolveChannelMessageIngress(...)`. */
declare function formatChannelIngressPolicyReason(params: {
  reasonCode: DmGroupAccessReasonCode;
  dmPolicy: string;
  groupPolicy: string;
}): string;
/** @deprecated Use `senderAccess.groupAccess` from `resolveChannelMessageIngress(...)`. */
declare function projectChannelIngressSenderGroupAccess(params: {
  reasonCode: IngressReasonCode;
  decisionAllowed: boolean;
  groupPolicy: ChannelIngressPolicyInput["groupPolicy"];
  providerMissingFallbackApplied?: boolean;
}): ChannelIngressSenderGroupAccessProjection;
/** @deprecated Use `senderAccess` from `resolveChannelMessageIngress(...)`. */
declare function projectChannelIngressDmGroupAccess(params: {
  ingress: ChannelIngressDecision;
  isGroup: boolean;
  dmPolicy: string;
  groupPolicy: string;
}): ChannelIngressDmGroupAccessProjection;
declare function resolveChannelIngressState(input: ChannelIngressStateInput): Promise<ChannelIngressState>;
/** @deprecated Use `resolveChannelMessageIngress` from `nodmix/plugin-sdk/channel-ingress-runtime`. */
declare function resolveChannelIngressAccess(params: ResolveChannelIngressAccessParams): Promise<ResolvedChannelIngressAccess>;
//#endregion
export { type AccessGraph, type AccessGraphGate, type AccessGroupMembershipFact, CHANNEL_INGRESS_GATE_SELECTORS, ChannelIngressAdapter, ChannelIngressAdapterEntry, ChannelIngressAdapterNormalizeResult, type ChannelIngressAdmission, type ChannelIngressChannelId, type ChannelIngressDecision, ChannelIngressDecisionBundle, ChannelIngressDmGroupAccessProjection, type ChannelIngressEventInput, ChannelIngressGateSelector, type ChannelIngressIdentifierKind, type ChannelIngressNormalizedEntry, ChannelIngressPluginId, type ChannelIngressPolicyInput, ChannelIngressSenderGroupAccessProjection, ChannelIngressSideEffectResult, type ChannelIngressState, ChannelIngressStateInput, ChannelIngressSubject, ChannelIngressSubjectIdentifier, ChannelIngressSubjectIdentifierInput, CreateChannelIngressMultiIdentifierAdapterParams, CreateChannelIngressStringAdapterParams, type IngressGateEffect, type IngressGateKind, type IngressGatePhase, type IngressReasonCode, type MatchableIdentifier, type RedactedChannelIngressEvent, type RedactedIngressAllowlistFacts, RedactedIngressDiagnostics, type RedactedIngressEntryDiagnostic, type RedactedIngressMatch, ResolveChannelIngressAccessParams, ResolvedChannelIngressAccess, type ResolvedIngressAllowlist, type ResolvedRouteGateFacts, type RouteGateFacts, type RouteGateState, type RouteSenderAllowlistSource, type RouteSenderPolicy, assertNeverChannelIngressReason, createChannelIngressMultiIdentifierAdapter, createChannelIngressPluginId, createChannelIngressStringAdapter, createChannelIngressSubject, decideChannelIngress, decideChannelIngressBundle, findChannelIngressCommandGate, findChannelIngressGate, findChannelIngressSenderGate, findChannelIngressSenderReasonCode, formatChannelIngressPolicyReason, mapChannelIngressDecisionToTurnAdmission, mapChannelIngressReasonCodeToDmGroupAccessReason, projectChannelIngressDmGroupAccess, projectChannelIngressSenderGroupAccess, projectIngressAccessFacts, resolveChannelIngressAccess, resolveChannelIngressState };