UNPKG

@getontime/cli

Version:

Time keeping for live events

2 lines 2.97 kB
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f14ad0099eab1969fdd065b56af5fdd3cf530de6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`81e163a4-3e9d-4b86-a598-5883fcb63dce`,e._sentryDebugIdIdentifier=`sentry-dbid-81e163a4-3e9d-4b86-a598-5883fcb63dce`)}catch{}})();import{a as e,n as t}from"./jsx-runtime-BNC90REB.js";import{Jt as n,a as r,bt as i,gt as a,ht as o,n as s}from"./exports-BUXB5LA6.js";import{c,l}from"./index-qU8RbaVt.js";function u(e={}){let t=c.document,n=t?.head||t?.body;if(!n)return;let i=a(),s=o()?.getDsn();if(!s)return;let u={...e,user:{...i.getUser(),...e.user},eventId:e.eventId||r()},d=c.document.createElement(`script`);d.async=!0,d.crossOrigin=`anonymous`,d.src=l(s,u);let{onLoad:f,onClose:p}=u;if(f&&(d.onload=f),p){let e=t=>{if(t.data===`__sentry_reportdialog_closed__`)try{p()}finally{c.removeEventListener(`message`,e)}};c.addEventListener(`message`,e)}n.appendChild(d)}var d=e(t());function f(e){let t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function p(e,t){let n=new WeakSet;function r(e,t){if(!n.has(e)){if(e.cause)return n.add(e),r(e.cause,t);e.cause=t}}r(e,t)}function m(e,{componentStack:t},r){if(f(d.version)&&n(e)&&t){let n=Error(e.message);n.name=`React ErrorBoundary ${e.name}`,n.stack=t,p(e,n)}return s(e,r)}var h={componentStack:null,error:null,eventId:null},g=class extends d.Component{constructor(e){super(e),this.state=h,this._openFallbackReportDialog=!0;let t=o();t&&e.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=t.on(`afterSendEvent`,t=>{!t.type&&this._lastEventId&&t.event_id===this._lastEventId&&u({...e.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(e,t){let{componentStack:n}=t,{beforeCapture:r,onError:a,showDialog:o,dialogOptions:s}=this.props;i(i=>{r&&r(i,e,n);let c=m(e,t,{mechanism:{handled:this.props.handled==null?!!this.props.fallback:this.props.handled,type:`auto.function.react.error_boundary`}});a&&a(e,n,c),o&&(this._lastEventId=c,this._openFallbackReportDialog&&u({...s,eventId:c})),this.setState({error:e,componentStack:n,eventId:c})})}componentDidMount(){let{onMount:e}=this.props;e&&e()}componentWillUnmount(){let{error:e,componentStack:t,eventId:n}=this.state,{onUnmount:r}=this.props;r&&(this.state===h?r(null,null,null):r(e,t,n)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){let{onReset:e}=this.props,{error:t,componentStack:n,eventId:r}=this.state;e&&e(t,n,r),this.setState(h)}render(){let{fallback:e,children:t}=this.props,n=this.state;if(n.componentStack===null)return typeof t==`function`?t():t;let r=typeof e==`function`?d.createElement(e,{error:n.error,componentStack:n.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:n.eventId}):e;return d.isValidElement(r)?r:null}};export{g as t}; //# sourceMappingURL=errorboundary-BKENFA_Y.js.map