(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else{e.htmx=t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var t=["get","post","put","delete","patch"];function a(e){if(e==="null"||e==="false"||e===""){return null}else if(e.lastIndexOf("ms")===e.length-2){return parseFloat(e.substr(0,e.length-2))}else if(e.lastIndexOf("s")===e.length-1){return parseFloat(e.substr(0,e.length-1))*1e3}else{return parseFloat(e)}}function u(e,t){return e.getAttribute&&e.getAttribute(t)}function w(e,t){return u(e,t)||u(e,"data-"+t)}function o(e){return e.parentElement}function E(){return document}function l(e,t){if(t(e)){return e}else if(o(e)){return l(o(e),t)}else{return null}}function O(e,t){var r=null;l(e,function(e){return r=w(e,t)});return r}function s(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function r(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function n(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=E().createDocumentFragment()}return i}function f(e){var t=r(e);switch(t){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return n("
",1);case"col":return n("",2);case"tr":return n("",2);case"td":case"th":return n("",3);default:return n(e,0)}}function i(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function c(e){return i(e,"Function")}function v(e){return i(e,"Object")}function L(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function h(e){var t=[];if(e){for(var r=0;r=0}function m(e){return E().body.contains(e)}function g(e){return e.split(/\s+/)}function p(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function e(e){return eval(e)}function x(t){var e=htmx.on("load.htmx",function(e){t(e.detail.elt)});return e}function y(){htmx.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function b(e,t){if(t){return e.querySelector(t)}else{return E().body.querySelector(e)}}function S(e,t){if(t){return e.querySelectorAll(t)}else{return E().body.querySelectorAll(e)}}function T(e,t){if(t){setTimeout(function(){T(e)},t)}else{e.parentElement.removeChild(e)}}function q(e,t,r){if(r){setTimeout(function(){q(e,t)},r)}else{e.classList.add(t)}}function N(e,t,r){if(r){setTimeout(function(){N(e,t)},r)}else{e.classList.remove(t)}}function H(e,t){e.classList.toggle(t)}function X(e,t){C(e.parentElement.children,function(e){N(e,t)});q(e,t)}function A(e,t){do{if(e==null||s(e,t))return e}while(e=e&&o(e))}function D(e,t,r){if(c(t)){return{target:E().body,event:e,listener:t}}else{return{target:e,event:t,listener:r}}}function R(t,r,n){$e(function(){var e=D(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=c(r);return e?r:n}function k(t,r,n){$e(function(){var e=D(t,r,n);e.target.removeEventListener(e.event,e.listener)});return c(r)?r:n}function M(e){var t=l(e,function(e){return w(e,"hx-target")!==null});if(t){var r=w(t,"hx-target");if(r==="this"){return t}else if(r.indexOf("closest ")===0){return A(e,r.substr(8))}else{return E().querySelector(r)}}else{var n=L(e);if(n.boosted){return E().body}else{return e}}}function I(t,r){C(t.attributes,function(e){if(!r.hasAttribute(e.name)){t.removeAttribute(e.name)}});C(r.attributes,function(e){t.setAttribute(e.name,e.value)})}function F(e,n){C(h(e.children),function(e){if(w(e,"hx-swap-oob")==="true"){var t=E().getElementById(e.id);if(t){var r=E().createDocumentFragment();r.appendChild(e);j(t,r,n)}else{e.parentNode.removeChild(e);be(E().body,"oobErrorNoTarget.htmx",{content:e})}}})}function P(n,e,i){C(e.querySelectorAll("[id]"),function(e){var t=n.querySelector(e.tagName+"[id="+e.id+"]");if(t){var r=e.cloneNode();I(e,t);i.tasks.push(function(){I(e,r)})}})}function J(e,t,r,n){P(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE){we(i,"load.htmx",{});pe(i)}}}function j(e,t,r){if(e.tagName==="BODY"){return V(e,t)}else{var n=e.previousSibling;J(o(e),e,t,r);if(n==null){var i=o(e).firstChild}else{var i=n.nextSibling}while(i&&i!=e){r.elts.push(i);i=i.nextSibling}o(e).removeChild(e)}}function U(e,t,r){return J(e,e.firstChild,t,r)}function B(e,t,r){return J(o(e),e,t,r)}function W(e,t,r){return J(e,null,t,r)}function z(e,t,r){return J(o(e),e.nextSibling,t,r)}function V(e,t,r){var n=e.firstChild;J(e,n,t,r);if(n){while(n.nextSibling){e.removeChild(n.nextSibling)}e.removeChild(n)}}function G(e,t){var r=O(e,"hx-select");if(r){var n=E().createDocumentFragment();C(t.querySelectorAll(r),function(e){n.appendChild(e)});t=n}return t}function Y(e,t,r,n,i){switch(e){case"outerHTML":j(r,n,i);return;case"afterbegin":U(r,n,i);return;case"beforebegin":B(r,n,i);return;case"beforeend":W(r,n,i);return;case"afterend":z(r,n,i);return;default:var o=Ze(t);for(var a=0;ahtmx.config.historyCacheSize){i.shift()}localStorage.setItem("htmx-history-cache",JSON.stringify(i))}function Ce(e){var t=JSON.parse(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){we(E().body,"historyCacheMissLoad.htmx",i);var e=f(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Oe();var r=Ve(t);V(t,e,r);Ne(r.tasks);Ee=n}else{be(E().body,"historyCacheMissLoadError.htmx",i)}};e.send()}function Xe(e){Te(Ee);e=e||location.pathname+location.search;we(E().body,"historyRestore.htmx",{path:e});var t=Ce(e);if(t){var r=f(t.content);var n=Oe();var i=Ve(n);V(n,r,i);Ne(i.tasks);document.title=t.title;window.scrollTo(0,t.scroll);Ee=e}else{He(e)}}function Ae(e){return O(e,"hx-push-url")==="true"||e.tagName==="A"&&L(e).boosted}function De(e){ke(e,"add")}function Re(e){ke(e,"remove")}function ke(e,t){var r=O(e,"hx-indicator");if(r){var n=E().querySelectorAll(r)}else{n=[e]}C(n,function(e){e.classList[t].call(e.classList,"htmx-request")})}function Me(e,t){for(var r=0;r0){r["swapStyle"]=n[0];for(var i=1;i=200&&this.status<400){if(this.status===286){Z(a)}if(this.status!==204){if(!we(a,"beforeSwap.htmx",S))return;var i=this.response;C(Ze(a),function(e){i=e.transformResponse(i,f,a)});if(n){Te()}var o=We(a);l.classList.add("htmx-swapping");var e=function(){try{var e=Ve(l);_(o.swapStyle,l,a,i,e);l.classList.remove("htmx-swapping");C(e.elts,function(e){if(e.classList){e.classList.add("htmx-settling")}});we(a,"afterSwap.htmx",S);if(p){location.hash=p}var t=function(){C(e.tasks,function(e){e.call()});C(e.elts,function(e){if(e.classList){e.classList.remove("htmx-settling")}});if(n){qe(r||u)}we(a,"afterSettle.htmx",S)};if(o.settleDelay>0){setTimeout(t,o.settleDelay)}else{t()}}catch(e){be(a,"swapError.htmx",S);throw e}};if(o.swapDelay>0){setTimeout(e,o.swapDelay)}else{e()}}}else{be(a,"responseError.htmx",S)}}catch(e){S["exception"]=e;be(a,"onLoadError.htmx",S);throw e}finally{Re(a);we(a,"afterRequest.htmx",S);we(a,"afterOnLoad.htmx",S);s()}};f.onerror=function(){Re(a);be(a,"afterRequest.htmx",S);be(a,"sendError.htmx",S);s()};if(!we(a,"beforeRequest.htmx",S))return s();De(a);f.send(e==="get"?null:ze(f,a,h))}var Ye={};function _e(){return{onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Ke(e,t){Ye[e]=p(_e(),t)}function Qe(e){delete Ye[e]}function Ze(e,r){if(e==null){return r}if(r==null){r=[]}var t=w(e,"hx-ext");if(t){C(t.split(","),function(e){e=e.replace(/ /g,"");var t=Ye[e];if(t&&r.indexOf(t)<0){r.push(t)}})}return Ze(o(e),r)}function $e(e){if(E().readyState!=="loading"){e()}else{E().addEventListener("DOMContentLoaded",e)}}(function(){var e=et();if(e===null||e.includeIndicatorStyles!==false){E().head.insertAdjacentHTML("beforeend","")}})();function et(){var e=E().querySelector('meta[name="htmx-config"]');if(e){return JSON.parse(e.content)}else{return null}}function tt(){var e=et();if(e){htmx.config=p(htmx.config,e)}}$e(function(){tt();var e=E().body;pe(e);we(e,"load.htmx",{});window.onpopstate=function(){Xe()}});return{onLoad:x,process:pe,on:R,off:k,trigger:we,find:b,findAll:S,closest:A,remove:T,addClass:q,removeClass:N,toggleClass:H,takeClass:X,defineExtension:Ke,removeExtension:Qe,logAll:y,logger:null,config:{historyEnabled:true,historyCacheSize:10,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:100,includeIndicatorStyles:true},parseInterval:a,_:e}}()});