if(typeof addCsrfToForms=="undefined"){function addCsrfToForms(){let metaCsrf=document.querySelector('meta[name="csrf-token"]');if(metaCsrf){let token=metaCsrf.getAttribute("content");document.querySelectorAll("form").forEach(form=>{let method=(form.getAttribute("method")||"get").toLowerCase();if(method==="get")return;let action=form.getAttribute("action");if(action){try{let url=new URL(action,window.location.href);if(url.origin!==window.location.origin)return}catch(e){}}if(form.querySelector('input[name="_token"]'))return;let input=document.createElement("input");input.type="hidden";input.name="_token";input.value=token;form.appendChild(input)})}}}(function(){let metaCsrf=document.querySelector('meta[name="csrf-token"]');if(metaCsrf){let token=metaCsrf.getAttribute("content");$(document).ready(function(){addCsrfToForms();$.ajaxSetup({headers:{"X-CSRF-TOKEN":token},statusCode:{419:function(xhr){if(window.swal){swal("Page Expired","Please refresh the page and try again.","warning")}else{alert("Page Expired. Please refresh the page and try again.")}}}})});$.ajaxSetup({headers:{"X-CSRF-TOKEN":token},statusCode:{419:function(xhr){if(window.swal){swal("Page Expired","Please refresh the page and try again.","warning")}else{alert("Page Expired. Please refresh the page and try again.")}}}});setTimeout(()=>{$.ajaxSetup({headers:{"X-CSRF-TOKEN":token},statusCode:{419:function(xhr){if(window.swal){swal("Page Expired","Please refresh the page and try again.","warning")}else{alert("Page Expired. Please refresh the page and try again.")}}}})},2e3);$(document).on("ajaxComplete",function(){addCsrfToForms()})}})();