@hcaptcha/loader
Version:
This is a JavaScript library to easily configure the loading of the hCaptcha JS client SDK with built-in error handling.
3 lines (2 loc) • 20.7 kB
JavaScript
var hCaptchaLoaderPkg=(function(){var L=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ue=function(e,n){for(var t in n)L(e,t,{get:n[t],enumerable:!0})},se=function(e,n,t,r){if(n&&typeof n=="object"||typeof n=="function")for(var a=oe(n),o=0,u=a.length,s;o<u;o++)s=a[o],!ie.call(e,s)&&s!==t&&L(e,s,{get:function(c){return n[c]}.bind(null,s),enumerable:!(r=ae(n,s))||r.enumerable});return e};var ce=function(e){return se(L({},"__esModule",{value:!0}),e)};var Ve={};ue(Ve,{hCaptchaLoader:function(){return Je}});function D(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function le(e){if(Array.isArray(e))return e}function fe(e){if(Array.isArray(e))return D(e)}function J(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function W(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,n,t){return n&&W(e.prototype,n),t&&W(e,t),e}function X(e,n){return n!=null&&typeof Symbol!="undefined"&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n}function de(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function he(e,n){var t=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var r=[],a=!0,o=!1,u,s;try{for(t=t.call(e);!(a=(u=t.next()).done)&&(r.push(u.value),!(n&&r.length===n));a=!0);}catch(c){o=!0,s=c}finally{try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}return r}}function ve(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function me(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,n){return le(e)||he(e,n)||K(e,n)||ve()}function F(e){return fe(e)||de(e)||K(e)||me()}function j(e){return e&&typeof Symbol!="undefined"&&e.constructor===Symbol?"symbol":typeof e}function K(e,n){if(e){if(typeof e=="string")return D(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,n)}}function C(e,n){var t,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(i){return function(l){return c([i,l])}}function c(i){if(t)throw new TypeError("Generator is already executing.");for(;u&&(u=0,i[0]&&(o=0)),o;)try{if(t=1,r&&(a=i[0]&2?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[i[0]&2,a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(a=o.trys,!(a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=n.call(e,o)}catch(l){i=[6,l],r=0}finally{t=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}var pe=Object.defineProperty,ye=Object.defineProperties,ge=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,N=function(e,n,t){return n in e?pe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t},y=function(e,n){for(var t in n||(n={}))Q.call(n,t)&&N(e,t,n[t]);var r=!0,a=!1,o=void 0;if(M)try{for(var u=M(n)[Symbol.iterator](),s;!(r=(s=u.next()).done);r=!0){var t=s.value;Y.call(n,t)&&N(e,t,n[t])}}catch(c){a=!0,o=c}finally{try{!r&&u.return!=null&&u.return()}finally{if(a)throw o}}return e},Z=function(e,n){return ye(e,ge(n))},be=function(e,n){var t={};for(var r in e)Q.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);var a=!0,o=!1,u=void 0;if(e!=null&&M)try{for(var s=M(e)[Symbol.iterator](),c;!(a=(c=s.next()).done);a=!0){var r=c.value;n.indexOf(r)<0&&Y.call(e,r)&&(t[r]=e[r])}}catch(i){o=!0,u=i}finally{try{!a&&s.return!=null&&s.return()}finally{if(o)throw u}}return t},f=function(e,n,t){return N(e,(typeof n=="undefined"?"undefined":j(n))!="symbol"?n+"":n,t),t},A=function(e,n,t){return new Promise(function(r,a){var o=function(c){try{s(t.next(c))}catch(i){a(i)}},u=function(c){try{s(t.throw(c))}catch(i){a(i)}},s=function(c){return c.done?r(c.value):Promise.resolve(c.value).then(o,u)};s((t=t.apply(e,n)).next())})},we="hCaptcha-script",I="hCaptchaOnLoad",z="script-error",O="@hCaptcha/loader";function xe(e){return Object.entries(e).filter(function(n){var t=q(n,2),r=t[1];return r||r===!1}).map(function(n){var t=q(n,2),r=t[0],a=t[1];return"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(String(a)))}).join("&")}function ee(e){var n=e&&e.ownerDocument||document,t=n.defaultView||n.parentWindow||window;return{document:n,window:t}}function ne(e){return e||document.head}function ke(e){var n;e.setTag("source",O),e.setTag("url",document.URL),e.setContext("os",{UA:navigator.userAgent}),e.setContext("browser",y({},Oe())),e.setContext("device",Z(y({},Ee()),{screen_width_pixels:screen.width,screen_height_pixels:screen.height,language:navigator.language,orientation:((n=screen.orientation)==null?void 0:n.type)||"Unknown",processor_count:navigator.hardwareConcurrency,platform:navigator.platform}))}function Oe(){var e,n,t,r,a,o,u=navigator.userAgent,s,c;return u.indexOf("Firefox")!==-1?(s="Firefox",c=(e=u.match(/Firefox\/([\d.]+)/))==null?void 0:e[1]):u.indexOf("Edg")!==-1?(s="Microsoft Edge",c=(n=u.match(/Edg\/([\d.]+)/))==null?void 0:n[1]):u.indexOf("Chrome")!==-1&&u.indexOf("Safari")!==-1?(s="Chrome",c=(t=u.match(/Chrome\/([\d.]+)/))==null?void 0:t[1]):u.indexOf("Safari")!==-1&&u.indexOf("Chrome")===-1?(s="Safari",c=(r=u.match(/Version\/([\d.]+)/))==null?void 0:r[1]):u.indexOf("Opera")!==-1||u.indexOf("OPR")!==-1?(s="Opera",c=(a=u.match(/(Opera|OPR)\/([\d.]+)/))==null?void 0:a[2]):u.indexOf("MSIE")!==-1||u.indexOf("Trident")!==-1?(s="Internet Explorer",c=(o=u.match(/(MSIE |rv:)([\d.]+)/))==null?void 0:o[2]):(s="Unknown",c="Unknown"),{name:s,version:c}}function _e(e){return new Promise(function(n){return setTimeout(n,e)})}function Ee(){var e=navigator.userAgent,n;e.indexOf("Win")!==-1?n="Windows":e.indexOf("Mac")!==-1?n="Mac":e.indexOf("Linux")!==-1?n="Linux":e.indexOf("Android")!==-1?n="Android":e.indexOf("like Mac")!==-1||e.indexOf("iPhone")!==-1||e.indexOf("iPad")!==-1?n="iOS":n="Unknown";var t;return/Mobile|iPhone|iPod|Android/i.test(e)?t="Mobile":/Tablet|iPad/i.test(e)?t="Tablet":t="Desktop",{model:n,family:n,device:t}}var Se=function(){"use strict";function e(n){J(this,e),f(this,"_parent"),f(this,"breadcrumbs",[]),f(this,"context",{}),f(this,"extra",{}),f(this,"tags",{}),f(this,"request"),f(this,"user"),this._parent=n}return V(e,[{key:"parent",get:function(){return this._parent}},{key:"child",value:function(){return new e(this)}},{key:"setRequest",value:function(t){return this.request=t,this}},{key:"removeRequest",value:function(){return this.request=void 0,this}},{key:"addBreadcrumb",value:function(t){return j(t.timestamp)>"u"&&(t.timestamp=new Date().toISOString()),this.breadcrumbs.push(t),this}},{key:"setExtra",value:function(t,r){return this.extra[t]=r,this}},{key:"removeExtra",value:function(t){return delete this.extra[t],this}},{key:"setContext",value:function(t,r){return j(r.type)>"u"&&(r.type=t),this.context[t]=r,this}},{key:"removeContext",value:function(t){return delete this.context[t],this}},{key:"setTags",value:function(t){return this.tags=y(y({},this.tags),t),this}},{key:"setTag",value:function(t,r){return this.tags[t]=r,this}},{key:"removeTag",value:function(t){return delete this.tags[t],this}},{key:"setUser",value:function(t){return this.user=t,this}},{key:"removeUser",value:function(){return this.user=void 0,this}},{key:"toBody",value:function(){for(var t=[],r=this;r;)t.push(r),r=r.parent;return t.reverse().reduce(function(a,o){var u;return a.breadcrumbs=F((u=a.breadcrumbs)!=null?u:[]).concat(F(o.breadcrumbs)),a.extra=y(y({},a.extra),o.extra),a.contexts=y(y({},a.contexts),o.context),a.tags=y(y({},a.tags),o.tags),o.user&&(a.user=o.user),o.request&&(a.request=o.request),a},{breadcrumbs:[],extra:{},contexts:{},tags:{},request:void 0,user:void 0})}},{key:"clear",value:function(){this.breadcrumbs=[],this.context={},this.tags={},this.user=void 0}}]),e}(),je=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,Ae=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Re=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/,T="?",G="An unknown error occurred",Te="0.0.4";function Pe(e){for(var n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e}function d(e){return(e+256).toString(16).substring(1)}function Ie(){var e=Pe(new Array(16));return e[6]=e[6]&15|64,e[8]=e[8]&63|128,d(e[0])+d(e[1])+d(e[2])+d(e[3])+"-"+d(e[4])+d(e[5])+"-"+d(e[6])+d(e[7])+"-"+d(e[8])+d(e[9])+"-"+d(e[10])+d(e[11])+d(e[12])+d(e[13])+d(e[14])+d(e[15])}var qe=[[je,"chrome"],[Ae,"winjs"],[Ce,"gecko"]];function Me(e){var n,t,r,a;if(!e.stack)return null;for(var o=[],u=(r=(t=(n=e.stack).split)==null?void 0:t.call(n,"\n"))!=null?r:[],s=0;s<u.length;++s){var c=null,i=null,l=null,g=!0,p=!1,b=void 0;try{for(var x=qe[Symbol.iterator](),h;!(g=(h=x.next()).done);g=!0){var w=q(h.value,2),E=w[0],S=w[1];if(i=E.exec(u[s]),i){l=S;break}}}catch(k){p=!0,b=k}finally{try{!g&&x.return!=null&&x.return()}finally{if(p)throw b}}if(!(!i||!l)){if(l==="chrome")c={filename:(a=i[2])!=null&&a.startsWith("address at ")?i[2].substring(11):i[2],function:i[1]||T,lineno:i[3]?+i[3]:null,colno:i[4]?+i[4]:null};else if(l==="winjs")c={filename:i[2],function:i[1]||T,lineno:+i[3],colno:i[4]?+i[4]:null};else if(l==="gecko")s===0&&!i[5]&&e.columnNumber!==void 0&&o.length>0&&(o[0].column=e.columnNumber+1),c={filename:i[3],function:i[1]||T,lineno:i[4]?+i[4]:null,colno:i[5]?+i[5]:null};else continue;!c.function&&c.lineno&&(c.function=T),o.push(c)}}return o.length?o.reverse():null}function Ue(e){var n=Me(e);return{type:e.name,value:e.message,stacktrace:{frames:n!=null?n:[]}}}function Be(e){var n=Re.exec(e),t=n?n.slice(1):[];if(t.length!==6)throw new Error("Invalid DSN");var r=t[5].split("/"),a=r.slice(0,-1).join("/");return t[0]+"://"+t[3]+(t[4]?":"+t[4]:"")+(a?"/"+a:"")+"/api/"+r.pop()+"/envelope/?sentry_version=7&sentry_key="+t[1]+(t[2]?"&sentry_secret="+t[2]:"")}function Le(e,n,t){var r,a,o=y({event_id:Ie().replaceAll("-",""),platform:"javascript",sdk:{name:"@hcaptcha/sentry",version:Te},environment:n,release:t,timestamp:Date.now()/1e3},e.scope.toBody());if(e.type==="exception"){o.message=(a=(r=e.error)==null?void 0:r.message)!=null?a:"Unknown error",o.fingerprint=[o.message];for(var u=[],s=e.error,c=0;c<5&&s&&(u.push(Ue(s)),!(!s.cause||!X(s.cause,Error)));c++)s=s.cause;o.exception={values:u.reverse()}}return e.type==="message"&&(o.message=e.message,o.level=e.level),o}function De(e){if(X(e,Error))return e;if(typeof e=="string")return new Error(e);if((typeof e=="undefined"?"undefined":j(e))=="object"&&e!==null&&!Array.isArray(e)){var n=e,t=n.message,r=be(n,["message"]),a=new Error(typeof t=="string"?t:G);return Object.assign(a,r)}var o=new Error(G);return Object.assign(o,{cause:e})}function Fe(e,n,t){return A(this,null,function(){var r,a,o,u,s,c,i;return C(this,function(l){switch(l.label){case 0:return l.trys.push([0,5,,6]),(typeof fetch=="undefined"?"undefined":j(fetch))<"u"&&(typeof AbortSignal=="undefined"?"undefined":j(AbortSignal))<"u"?(t&&(u=new AbortController,o=u.signal,setTimeout(function(){return u.abort()},t)),[4,fetch(e,Z(y({},n),{signal:o}))]):[3,3];case 1:return s=l.sent(),[4,s.text()];case 2:return c=l.sent(),[2,{status:s.status,body:c}];case 3:return[4,new Promise(function(g,p){var b,x,h=new XMLHttpRequest,w=!0,E=!1,S=void 0;if(h.open((b=n==null?void 0:n.method)!=null?b:"GET",e),h.onload=function(){return g({status:h.status,body:h.responseText})},h.onerror=function(){return p(new Error("XHR Network Error"))},n==null?void 0:n.headers)try{for(var k=Object.entries(n.headers)[Symbol.iterator](),v;!(w=(v=k.next()).done);w=!0){var R=q(v.value,2),_=R[0],U=R[1];h.setRequestHeader(_,U)}}catch(re){E=!0,S=re}finally{try{!w&&k.return!=null&&k.return()}finally{if(E)throw S}}if(t){var B=setTimeout(function(){h.abort(),p(new Error("Request timed out"))},t);h.onloadend=function(){clearTimeout(B)}}h.send((x=n==null?void 0:n.body)==null?void 0:x.toString())})];case 4:return[2,l.sent()];case 5:return i=l.sent(),[2,{status:0,body:(a=(r=i==null?void 0:i.toString)==null?void 0:r.call(i))!=null?a:"Unknown error"}];case 6:return[2]}})})}var m,$=(m=function(){"use strict";function e(n){J(this,e),f(this,"apiURL"),f(this,"dsn"),f(this,"environment"),f(this,"release"),f(this,"sampleRate"),f(this,"debug"),f(this,"_scope"),f(this,"shouldBuffer",!1),f(this,"bufferlimit",20),f(this,"buffer",[]);var t,r,a,o,u;this.environment=n.environment,this.release=n.release,this.sampleRate=(t=n.sampleRate)!=null?t:1,this.debug=(r=n.debug)!=null?r:!1,this._scope=(a=n.scope)!=null?a:new Se,this.apiURL=Be(n.dsn),this.dsn=n.dsn,this.shouldBuffer=(o=n.buffer)!=null?o:!1,this.bufferlimit=(u=n.bufferLimit)!=null?u:20}return V(e,[{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];var o;this.debug&&(o=console).log.apply(o,F(r))}},{key:"scope",get:function(){return this._scope}},{key:"withScope",value:function(t){var r=this._scope.child();t(r)}},{key:"captureException",value:function(t,r){this.captureEvent({type:"exception",level:"error",error:De(t),scope:r!=null?r:this._scope})}},{key:"captureMessage",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"info",a=arguments.length>2?arguments[2]:void 0;this.captureEvent({type:"message",level:r,message:t,scope:a!=null?a:this._scope})}},{key:"captureEvent",value:function(t){if(Math.random()>=this.sampleRate){this.log("Dropped event due to sample rate");return}if(this.shouldBuffer){if(this.buffer.length>=this.bufferlimit)return;this.buffer.push(t)}else this.sendEvent(t)}},{key:"sendEvent",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5e3;return A(this,null,function(){var a,o,u,s,c,i;return C(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),this.log("Sending sentry event",t),a=Le(t,this.environment,this.release),o={event_id:a.event_id,dsn:this.dsn},u={type:"event"},s=JSON.stringify(o)+"\n"+JSON.stringify(u)+"\n"+JSON.stringify(a),[4,Fe(this.apiURL,{method:"POST",headers:{"Content-Type":"application/x-sentry-envelope"},body:s},r)];case 1:return c=l.sent(),this.log("Sentry response",c.status),c.status!==200&&(console.log(c.body),console.error("Failed to send event to Sentry",c)),[3,3];case 2:return i=l.sent(),console.error("Failed to send event",i),[3,3];case 3:return[2]}})})}},{key:"flush",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5e3;return A(this,null,function(){var r,a,o;return C(this,function(u){switch(u.label){case 0:r=this,u.label=1;case 1:return u.trys.push([1,3,,4]),this.log("Flushing sentry events",this.buffer.length),a=this.buffer.splice(0,this.buffer.length).map(function(s){return r.sendEvent(s,t)}),[4,Promise.all(a)];case 2:return u.sent(),this.log("Flushed all events"),[3,4];case 3:return o=u.sent(),console.error("Failed to flush events",o),[3,4];case 4:return[2]}})})}}],[{key:"init",value:function(t){m._instance||(m._instance=new m(t))}},{key:"instance",get:function(){if(!m._instance)throw new Error("Sentry has not been initialized");return m._instance}},{key:"scope",get:function(){return m.instance.scope}},{key:"withScope",value:function(t){m.instance.withScope(t)}},{key:"captureException",value:function(t,r){m.instance.captureException(t,r)}},{key:"captureMessage",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"info",a=arguments.length>2?arguments[2]:void 0;m.instance.captureMessage(t,r,a)}},{key:"flush",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5e3;return m.instance.flush(t)}},{key:"reset",value:function(){m._instance=void 0}}]),e}(),f(m,"_instance"),m),Ne="https://d233059272824702afc8c43834c4912d@sentry.hcaptcha.com/6",$e="2.3.0",We="production";function ze(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(!e)return H();$.init({dsn:Ne,release:$e,environment:We});var n=$.scope;return ke(n),H(n)}function H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return{addBreadcrumb:function(n){e&&e.addBreadcrumb(n)},captureRequest:function(n){e&&e.setRequest(n)},captureException:function(n){e&&$.captureException(n,e)}}}function Ge(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.scriptLocation,t=e.query,r=e.loadAsync,a=r===void 0?!0:r,o=e.crossOrigin,u=o===void 0?"anonymous":o,s=e.apihost,c=s===void 0?"https://js.hcaptcha.com":s,i=e.cleanup,l=i===void 0?!1:i,g=e.secureApi,p=g===void 0?!1:g,b=e.scriptSource,x=b===void 0?"":b,h=arguments.length>1?arguments[1]:void 0,w=ne(n),E=ee(w);return new Promise(function(S,k){var v=E.document.createElement("script");v.id=we,x?v.src="".concat(x,"?onload=").concat(I):p?v.src="".concat(c,"/1/secure-api.js?onload=").concat(I):v.src="".concat(c,"/1/api.js?onload=").concat(I),v.crossOrigin=u,v.async=a;var R=function(_,U){try{!p&&l&&w.removeChild(v),U(_)}catch(B){k(B)}};v.onload=function(_){return R(_,S)},v.onerror=function(_){h&&h(v.src),R(_,k)},v.src+=t!==""?"&".concat(t):"",w.appendChild(v)})}var P=[];function He(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{cleanup:!1},t=arguments.length>1?arguments[1]:void 0;try{t.addBreadcrumb({category:O,message:"hCaptcha loader params",data:n});var r=ne(n.scriptLocation),a=ee(r),o=P.find(function(s){var c=s.scope;return c===a.window});if(o)return t.addBreadcrumb({category:O,message:"hCaptcha already loaded"}),o.promise;var u=new Promise(function(s,c){return A(e,null,function(){var i,l,g;return C(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),a.window[I]=function(){t.addBreadcrumb({category:O,message:"hCaptcha script called onload function"}),s(a.window.hcaptcha)},i=xe({custom:n.custom,render:n.render,sentry:n.sentry,assethost:n.assethost,imghost:n.imghost,reportapi:n.reportapi,endpoint:n.endpoint,host:n.host,recaptchacompat:n.recaptchacompat,hl:n.hl,uj:n.uj}),[4,Ge(y({query:i},n),function(b){t.captureRequest({url:b,method:"GET"})})];case 1:return p.sent(),t.addBreadcrumb({category:O,message:"hCaptcha loaded",data:o}),[3,3];case 2:return l=p.sent(),t.addBreadcrumb({category:O,message:"hCaptcha failed to load"}),g=P.findIndex(function(b){return b.scope===a.window}),g!==-1&&P.splice(g,1),c(new Error(z)),[3,3];case 3:return[2]}})})});return P.push({promise:u,scope:a.window}),u}catch(s){return t.captureException(s),Promise.reject(new Error(z))}}function te(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return A(this,null,function(){var r,a,o,u,s,c,i;return C(this,function(l){switch(l.label){case 0:o=(r=e.maxRetries)!=null?r:2,u=(a=e.retryDelay)!=null?a:1e3,s=t<o?"Retry loading hCaptcha Api":"Exceeded maximum retries",l.label=1;case 1:return l.trys.push([1,3,,7]),[4,He(e,n)];case 2:return[2,l.sent()];case 3:return c=l.sent(),n.addBreadcrumb({category:O,message:s}),t>=o?(i=(n.captureException(c),Promise.reject(c)),[3,6]):[3,4];case 4:return n.addBreadcrumb({category:O,message:"Waiting ".concat(u,"ms before retry attempt ").concat(t+1)}),[4,_e(u)];case 5:i=(l.sent(),t+=1,te(e,n,t)),l.label=6;case 6:return[2,i];case 7:return[2]}})})}function Je(){return A(this,arguments,function(){var e,n,t=arguments;return C(this,function(r){switch(r.label){case 0:return e=t.length>0&&t[0]!==void 0?t[0]:{},n=ze(e.sentry),[4,te(e,n)];case 1:return[2,r.sent()]}})})}return ce(Ve);})();
window.hCaptchaLoader = hCaptchaLoaderPkg.hCaptchaLoader;