function e(e){let t=e.configuredFallbackPolicy??`open`,n=e.missingProviderFallbackPolicy??`allowlist`;return{groupPolicy:e.providerConfigPresent?e.groupPolicy??e.defaultGroupPolicy??t:e.groupPolicy??n,providerMissingFallbackApplied:!e.providerConfigPresent&&e.groupPolicy===void 0}}function t(e){return e.channels?.defaults?.groupPolicy}const n={group:`group messages`,guild:`guild messages`,room:`room messages`,channel:`channel messages`,space:`space messages`};function r(t){return e({providerConfigPresent:t.providerConfigPresent,groupPolicy:t.groupPolicy,defaultGroupPolicy:t.defaultGroupPolicy,configuredFallbackPolicy:`open`,missingProviderFallbackPolicy:`allowlist`})}function i(t){return e({providerConfigPresent:t.providerConfigPresent,groupPolicy:t.groupPolicy,defaultGroupPolicy:t.defaultGroupPolicy,configuredFallbackPolicy:`allowlist`,missingProviderFallbackPolicy:`allowlist`})}const a=new Set;function o(e){if(!e.providerMissingFallbackApplied)return!1;let t=`${e.providerKey}:${e.accountId??`*`}`;if(a.has(t))return!1;a.add(t);let n=e.blockedLabel?.trim()||`group messages`;return e.log(`${e.providerKey}: channels.${e.providerKey} is missing; defaulting groupPolicy to "allowlist" (${n} blocked until explicitly configured).`),!0}function s(e){if(e.groupPolicy===`disabled`)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`disabled`};if(e.routeMatched&&e.routeEnabled===!1)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`route_disabled`};if(e.groupPolicy===`allowlist`){if(!e.routeAllowlistConfigured)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`empty_allowlist`};if(!e.routeMatched)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`route_not_allowlisted`}}return{allowed:!0,groupPolicy:e.groupPolicy,reason:`allowed`}}function c(e){if(e.groupPolicy===`disabled`)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`disabled`};if(e.groupPolicy===`allowlist`){if(e.requireMatchInput&&!e.hasMatchInput)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`missing_match_input`};if(!e.allowlistConfigured)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`empty_allowlist`};if(!e.allowlistMatched)return{allowed:!1,groupPolicy:e.groupPolicy,reason:`not_allowlisted`}}return{allowed:!0,groupPolicy:e.groupPolicy,reason:`allowed`}}export{t as a,i,c as n,r as o,n as r,o as s,s as t};
