import{t as e}from"../dist-CVBVvrr6.js";function t(){e(`click`,`a[data-confirm]`,n),e(`click`,`a[data-method]:not([data-confirm])`,r),e(`click`,`:not(form) button[data-confirm]:not([form])`,n)}function n(e){let t=e.currentTarget;if(!(t instanceof HTMLAnchorElement)&&!(t instanceof HTMLButtonElement))return;let n=t.dataset.confirm;if(!n||!window.confirm(n)){e.preventDefault();return}t.dataset.method&&r(e)}function r(e){var t;let n=e.currentTarget;if(!(n instanceof HTMLAnchorElement))return;let r=(t=n.dataset.method)==null?void 0:t.toLowerCase();if(!r)return;e.preventDefault();let o=document.createElement(`form`);o.method=`post`,o.action=n.href;let s=document.createElement(`input`);s.type=`hidden`,s.name=`_method`,s.value=r,o.appendChild(s);let c=i();if(c&&!a(n.href)){let e=document.createElement(`input`);e.type=`hidden`,e.name=c.param,e.value=c.token,o.appendChild(e)}o.style.display=`none`,document.body.appendChild(o),o.requestSubmit()}function i(){let e=document.querySelector(`meta[name="csrf-param"]`),t=document.querySelector(`meta[name="csrf-token"]`);return e&&t?{param:e.content,token:t.content}:null}function a(e){let t=document.createElement(`a`);return t.href=e,t.protocol!==window.location.protocol||t.host!==window.location.host}function o(){t()}o();
//# sourceMappingURL=common-CnYEo6pK.js.map