"use strict";var y=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var x=Object.getPrototypeOf;var P=Object.prototype.hasOwnProperty;var f=(t,e)=>r(t,"name",{value:e,configurable:true});var S=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:true})};var h=(t,e,o,s)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let n of T(e))if(!P.call(t,n)&&n!==o)r(t,n,{get:()=>e[n],enumerable:!(s=p(e,n))||s.enumerable})}return t};var v=(t,e,o)=>(o=t!=null?y(x(t)):{},h(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:true}):o,t));var N=t=>h(r({},"__esModule",{value:true}),t);var I=(t,e,o,s)=>{var n=s>1?void 0:s?p(e,o):e;for(var m=t.length-1,u;m>=0;m--)if(u=t[m])n=(s?u(e,o,n):u(n))||n;if(s&&n)r(e,o,n);return n};var H={};S(H,{default:()=>E});module.exports=N(H);var a=require("react/jsx-runtime");var g=require("mobx-react");var c=v(require("ms"));var M=require("react");var l=require("react-intl");var w=v(require("../../ui/button"));var R=require("../../ui/headline");const i=(0,l.defineMessages)({headline:{id:"service.crashHandler.headline",defaultMessage:"Oh no!"},text:{id:"service.crashHandler.text",defaultMessage:"{name} has caused an error."},action:{id:"service.crashHandler.action",defaultMessage:"Reload {name}"},autoReload:{id:"service.crashHandler.autoReload",defaultMessage:"Trying to automatically restore {name} in {seconds} seconds"}});let d=class extends M.Component{countdownInterval;countdownIntervalTimeout=(0,c.default)("1s");constructor(e){super(e);this.state={countdown:(0,c.default)("10s")}}componentDidMount(){const{reload:e}=this.props;this.countdownInterval=setInterval(()=>{this.setState(o=>({countdown:o.countdown-this.countdownIntervalTimeout}));if(this.state.countdown<=0){e();clearInterval(this.countdownInterval)}},this.countdownIntervalTimeout)}render(){const{name:e,reload:o,intl:s}=this.props;return(0,a.jsxs)("div",{className:"services__info-layer",children:[(0,a.jsx)(R.H1,{children:s.formatMessage(i.headline)}),(0,a.jsx)("p",{children:s.formatMessage(i.text,{name:e})}),(0,a.jsx)(w.default,{label:s.formatMessage(i.action,{name:e}),buttonType:"inverted",onClick:()=>o()}),(0,a.jsx)("p",{className:"footnote",children:s.formatMessage(i.autoReload,{name:e,seconds:this.state.countdown/(0,c.default)("1s")})})]})}};f(d,"WebviewCrashHandler");d=I([g.observer],d);var E=(0,l.injectIntl)(d);
