import{t as e}from"./chunk.BnKUq5qt.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.mcaptchaGlue=r():n.mcaptchaGlue=r()})(self,(()=>{return e={260:function(e){e.exports=(()=>{var e={};return{166:function(e,t){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function r(){this.constructor=e}n(e,t),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,`__esModule`,{value:!0}),t.ConfigurationError=void 0;var i=function(e){function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.message=`Provide either widget link or site key to display mCaptcha widget`,t}return r(t,e),t}(Error);t.ConfigurationError=i,t.default=function(){function e(e,t){var n=this;if(this.handle=function(e){console.log(`message received from ${e.origin} with data: ${e.data.token}`),new URL(e.origin).host==n.widgetLink.host?n.updateState(e.data.token):console.error(`expected message from ${n.widgetLink.host} but received message from ${e.origin}. Aborting.`)},this.updateState=t,e.widgetLink&&e.siteKey)throw new i;if(e.widgetLink)this.widgetLink=e.widgetLink;else{if(!e.siteKey)throw new i;e.siteKey.instanceUrl?(this.widgetLink=e.siteKey.instanceUrl,this.widgetLink.pathname=`/widget/`,this.widgetLink.search=`?sitekey=${e.siteKey.key}`):this.widgetLink=new URL(`https://demo.mcaptcha.org/widget/?sitekey=${e.siteKey.key}`)}}return e.prototype.listen=function(){window.addEventListener(`message`,this.handle)},e.prototype.destroy=function(){window.removeEventListener(`message`,this.handle)},e}()}}[166](0,e),e})()},942:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ID=t.INPUT_LABEL_ID=t.INPUT_NAME=void 0,t.INPUT_NAME=`mcaptcha__token`,t.INPUT_LABEL_ID=`mcaptcha__token-label`,t.ID=`mcaptcha__widget-container`},166:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.ConfigurationError=void 0;var i=n(260);Object.defineProperty(t,`ConfigurationError`,{enumerable:!0,get:function(){return i.ConfigurationError}});var a=r(n(695));(0,n(695).run)(),t.default=a.default},695:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.run=void 0;var i=r(n(260)),a=n(942),o=function(e){var t=this;this.setToken=function(e){return t.inputElement.value=e},this.receiver=new i.default(e,this.setToken),this.receiver.listen();var n=document.getElementById(a.ID);if(n==null)throw Error(`Element ${a.ID}'s parent element is undefined`);var r=document.getElementById(a.INPUT_LABEL_ID);r!==null&&(r.style.display=`none`),this.inputElement=document.getElementById(a.INPUT_NAME),this.inputElement.id=a.INPUT_NAME,this.inputElement.name=a.INPUT_NAME,this.inputElement.hidden=!0,this.inputElement.required=!0,this.inputElement.style.display=`none`,n.appendChild(this.inputElement);var o=`mcaptcha-widget__iframe`,s=document.createElement(`iframe`);s.title=`mCaptcha`,s.src=this.receiver.widgetLink.toString(),s.ariaRoleDescription=`presentation`,s.name=o,s.id=o,s.scrolling=`no`;try{s.sandbox=`allow-same-origin allow-scripts allow-popups`}catch{try{s.sandbox.add(`allow-same-origin`),s.sandbox.add(`allow-scripts`),s.sandbox.add(`allow-popups`)}catch{s.setAttribute(`sandbox`,`allow-same-origin allow-scripts allow-popups`)}}s.width=`100%`,s.height=`100%`,s.frameBorder=`0`,n.appendChild(s)};t.run=function(){var e=document.getElementById(a.INPUT_LABEL_ID);if(e===null||!e.dataset.mcaptcha_url)throw Error(`Couldn't find "mcaptcha_url" dataset in elmement (ID=${a.INPUT_LABEL_ID})`);new o({widgetLink:new URL(e.dataset.mcaptcha_url)})},t.default=o}},t={},function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}(166);var e,t}))}));export default t();
//# sourceMappingURL=dist.Bn0Y0Luv.js.map