(window.webpackJsonp=window.webpackJsonp||[]).push([[40],{196:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return r});var a=n(23);const s="externalAuthSetToken",o="externalAuthRevokeToken";if(!window.externalApp&&!window.webkit)throw new Error("External auth requires either externalApp or webkit defined on Window object.");class r extends a.a{constructor(e){super(),this.data={hassUrl:e,access_token:"",expires:0}}async refreshAccessToken(){const e=new Promise((e,t)=>{window[s]=((n,a)=>n?e(a):t(a))});await 0;const t={callback:s};window.externalApp?window.externalApp.getExternalAuth(t):window.webkit.messageHandlers.getExternalAuth.postMessage(t);const n=await e;this.data.access_token=n.access_token,this.data.expires=1e3*n.expires_in+Date.now()}async revoke(){const e=new Promise((e,t)=>{window[o]=((n,a)=>n?e(a):t(a))});await 0;const t={callback:o};window.externalApp?window.externalApp.revokeExternalAuth(t):window.webkit.messageHandlers.revokeExternalAuth.postMessage(t),await e}}}}]);
//# sourceMappingURL=243cdf84d79abec26036.chunk.js.map