import*as i18n from"../i18n/i18n.js";import{Issue,IssueCategory,resolveLazyDescription}from"./Issue.js";const UIStrings={coopAndCoep:"COOP and COEP",samesiteAndSameorigin:"Same-Site and Same-Origin"},str_=i18n.i18n.registerUIStrings("sdk/CrossOriginEmbedderPolicyIssue.js",UIStrings),i18nLazyString=i18n.i18n.getLazilyComputedLocalizedString.bind(void 0,str_);export function isCrossOriginEmbedderPolicyIssue(e){switch(e){case Protocol.Audits.BlockedByResponseReason.CoepFrameResourceNeedsCoepHeader:case Protocol.Audits.BlockedByResponseReason.CoopSandboxedIFrameCannotNavigateToCoopPage:case Protocol.Audits.BlockedByResponseReason.CorpNotSameOrigin:case Protocol.Audits.BlockedByResponseReason.CorpNotSameOriginAfterDefaultedToSameOriginByCoep:case Protocol.Audits.BlockedByResponseReason.CorpNotSameSite:return!0}return!1}export class CrossOriginEmbedderPolicyIssue extends Issue{constructor(e,i){super(`CrossOriginEmbedderPolicyIssue::${e.reason}`,i),this._details=e}primaryKey(){return`${this.code()}-(${this._details.request.requestId})`}getBlockedByResponseDetails(){return[this._details]}requests(){return[this._details.request]}getCategory(){return IssueCategory.CrossOriginEmbedderPolicy}getDescription(){return resolveLazyDescription(issueDescriptions.get(this.code()))}}const issueDescriptions=new Map([["CrossOriginEmbedderPolicyIssue::CorpNotSameOriginAfterDefaultedToSameOriginByCoep",{file:"issues/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md",substitutions:void 0,links:[{link:"https://web.dev/coop-coep/",linkTitle:i18nLazyString(UIStrings.coopAndCoep)},{link:"https://web.dev/same-site-same-origin/",linkTitle:i18nLazyString(UIStrings.samesiteAndSameorigin)}]}],["CrossOriginEmbedderPolicyIssue::CoepFrameResourceNeedsCoepHeader",{file:"issues/descriptions/CoepFrameResourceNeedsCoepHeader.md",substitutions:void 0,links:[{link:"https://web.dev/coop-coep/",linkTitle:i18nLazyString(UIStrings.coopAndCoep)}]}],["CrossOriginEmbedderPolicyIssue::CoopSandboxedIframeCannotNavigateToCoopPage",{file:"issues/descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md",substitutions:void 0,links:[{link:"https://web.dev/coop-coep/",linkTitle:i18nLazyString(UIStrings.coopAndCoep)}]}],["CrossOriginEmbedderPolicyIssue::CorpNotSameSite",{file:"issues/descriptions/CoepCorpNotSameSite.md",substitutions:void 0,links:[{link:"https://web.dev/coop-coep/",linkTitle:i18nLazyString(UIStrings.coopAndCoep)},{link:"https://web.dev/same-site-same-origin/",linkTitle:i18nLazyString(UIStrings.samesiteAndSameorigin)}]}],["CrossOriginEmbedderPolicyIssue::CorpNotSameOrigin",{file:"issues/descriptions/CoepCorpNotSameOrigin.md",substitutions:void 0,links:[{link:"https://web.dev/coop-coep/",linkTitle:i18nLazyString(UIStrings.coopAndCoep)},{link:"https://web.dev/same-site-same-origin/",linkTitle:i18nLazyString(UIStrings.samesiteAndSameorigin)}]}]]);