import{as as a,at as r,U as n,au as c}from"./main-DHoZdmBw.js";import{u}from"./login-cg-p-qv7.js";const d={methods:{async logout({reason:o,successUrl:s}={}){const i=s||this.$fischer.pages.logoutSuccess().url,e=o?`${i}?reason=${o}`:i;try{this.$cookies.remove(u),this.$fischer.setAssistedService(),a.call(this),r(),await n.post("/webapi/shop/userapi/Logout",{}),await c(this.$fischer,this.$cookies,"custom",{},"logout",o?{reason:o}:void 0),await this.logoutFromSSO(e)}catch(t){console.error(t),this.error=!0}},logoutFromSSO(o){const s=new URL(o,window.location.origin);return window.location=`https://api.fischer.group/authorizationserver/logout.do?redirect_uri=${encodeURIComponent(s)}`,new Promise(()=>{})},async logoutIfTokenInvalid(o){((o==null?void 0:o.message)==="GraphQL error: Invalid token"||this.$fischer.user.isIdTokenValid())&&await this.logout({reason:"InvalidToken"})}}};export{d as _};