htmx.org 2.0.7 → 4.0.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/htmx.esm.js +1979 -5172
- package/dist/htmx.esm.js.br +0 -0
- package/dist/htmx.esm.min.js +1 -0
- package/dist/htmx.esm.min.js.br +0 -0
- package/dist/htmx.js +1984 -5177
- package/dist/htmx.js.br +0 -0
- package/dist/htmx.min.js +1 -1
- package/dist/htmx.min.js.br +0 -0
- package/package.json +37 -83
- package/{editors → src/editors}/jetbrains/htmx.web-types.json +1 -1
- package/dist/ext/README.md +0 -9
- package/dist/ext/ajax-header.js +0 -11
- package/dist/ext/alpine-morph.js +0 -20
- package/dist/ext/class-tools.js +0 -97
- package/dist/ext/client-side-templates.js +0 -100
- package/dist/ext/debug.js +0 -15
- package/dist/ext/disable-element.js +0 -20
- package/dist/ext/event-header.js +0 -41
- package/dist/ext/head-support.js +0 -146
- package/dist/ext/include-vals.js +0 -28
- package/dist/ext/json-enc.js +0 -16
- package/dist/ext/loading-states.js +0 -189
- package/dist/ext/method-override.js +0 -15
- package/dist/ext/morphdom-swap.js +0 -21
- package/dist/ext/multi-swap.js +0 -50
- package/dist/ext/path-deps.js +0 -63
- package/dist/ext/path-params.js +0 -15
- package/dist/ext/preload.js +0 -151
- package/dist/ext/rails-method.js +0 -14
- package/dist/ext/remove-me.js +0 -31
- package/dist/ext/response-targets.js +0 -135
- package/dist/ext/restored.js +0 -19
- package/dist/ext/sse.js +0 -374
- package/dist/ext/ws.js +0 -481
- package/dist/htmx.amd.js +0 -5335
- package/dist/htmx.cjs.js +0 -5333
- package/dist/htmx.esm.d.ts +0 -213
- package/dist/htmx.min.js.gz +0 -0
package/dist/htmx.js.br
ADDED
|
Binary file
|
package/dist/htmx.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var htmx=function(){"use strict";const Q={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){const n=dn(e,t||"post");return n.values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null,disableInheritance:false,responseHandling:[{code:"204",swap:false},{code:"[23]..",swap:true},{code:"[45]..",swap:false,error:true}],allowNestedOobSwaps:true,historyRestoreAsHxRequest:true,reportValidityOfForms:false},parseInterval:null,location:location,_:null,version:"2.0.7"};Q.onLoad=V;Q.process=Mt;Q.on=xe;Q.off=be;Q.trigger=ae;Q.ajax=Ln;Q.find=f;Q.findAll=x;Q.closest=g;Q.remove=_;Q.addClass=K;Q.removeClass=G;Q.toggleClass=W;Q.takeClass=Z;Q.swap=ze;Q.defineExtension=_n;Q.removeExtension=zn;Q.logAll=j;Q.logNone=$;Q.parseInterval=d;Q._=e;const n={addTriggerHandler:St,bodyContains:se,canAccessLocalStorage:B,findThisElement:Se,filterValues:yn,swap:ze,hasAttribute:s,getAttributeValue:a,getClosestAttributeValue:ne,getClosestMatch:q,getExpressionVars:Tn,getHeaders:mn,getInputValues:dn,getInternalData:oe,getSwapSpecification:bn,getTriggerSpecs:st,getTarget:Ee,makeFragment:P,mergeObjects:le,makeSettleInfo:Sn,oobSwap:He,querySelectorExt:ue,settleImmediately:Yt,shouldCancel:ht,triggerEvent:ae,triggerErrorEvent:fe,withExtensions:Vt};const de=["get","post","put","delete","patch"];const T=de.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e instanceof Element&&e.getAttribute(t)}function s(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function a(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function te(){return document}function y(e,t){return e.getRootNode?e.getRootNode({composed:t}):te()}function q(e,t){while(e&&!t(e)){e=u(e)}return e||null}function o(e,t,n){const r=a(t,n);const o=a(t,"hx-disinherit");var i=a(t,"hx-inherit");if(e!==t){if(Q.config.disableInheritance){if(i&&(i==="*"||i.split(" ").indexOf(n)>=0)){return r}else{return null}}if(o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return"unset"}}return r}function ne(t,n){let r=null;q(t,function(e){return!!(r=o(t,ce(e),n))});if(r!=="unset"){return r}}function h(e,t){return e instanceof Element&&e.matches(t)}function A(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else{return""}}function L(e){const t=new DOMParser;return t.parseFromString(e,"text/html")}function N(e,t){while(t.childNodes.length>0){e.append(t.childNodes[0])}}function r(e){const t=te().createElement("script");ie(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}return t}function i(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function I(e){Array.from(e.querySelectorAll("script")).forEach(e=>{if(i(e)){const t=r(e);const n=e.parentNode;try{n.insertBefore(t,e)}catch(e){R(e)}finally{e.remove()}}})}function P(e){const t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,"");const n=A(t);let r;if(n==="html"){r=new DocumentFragment;const i=L(e);N(r,i.body);r.title=i.title}else if(n==="body"){r=new DocumentFragment;const i=L(t);N(r,i.body);r.title=i.title}else{const i=L('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content;r.title=i.title;var o=r.querySelector("title");if(o&&o.parentNode===r){o.remove();r.title=o.innerText}}if(r){if(Q.config.allowScriptTags){I(r)}else{r.querySelectorAll("script").forEach(e=>e.remove())}}return r}function re(e){if(e){e()}}function t(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function D(e){return typeof e==="function"}function k(e){return t(e,"Object")}function oe(e){const t="htmx-internal-data";let n=e[t];if(!n){n=e[t]={}}return n}function F(t){const n=[];if(t){for(let e=0;e<t.length;e++){n.push(t[e])}}return n}function ie(t,n){if(t){for(let e=0;e<t.length;e++){n(t[e])}}}function M(e){const t=e.getBoundingClientRect();const n=t.top;const r=t.bottom;return n<window.innerHeight&&r>=0}function se(e){return e.getRootNode({composed:true})===document}function X(e){return e.trim().split(/\s+/)}function le(e,t){for(const n in t){if(t.hasOwnProperty(n)){e[n]=t[n]}}return e}function v(e){try{return JSON.parse(e)}catch(e){R(e);return null}}function B(){const e="htmx:sessionStorageTest";try{sessionStorage.setItem(e,e);sessionStorage.removeItem(e);return true}catch(e){return false}}function U(e){const t=new URL(e,"http://x");if(t){e=t.pathname+t.search}if(e!="/"){e=e.replace(/\/+$/,"")}return e}function e(e){return On(te().body,function(){return eval(e)})}function V(t){const e=Q.on("htmx:load",function(e){t(e.detail.elt)});return e}function j(){Q.logger=function(e,t,n){if(console){console.log(t,e,n)}}}function $(){Q.logger=null}function f(e,t){if(typeof e!=="string"){return e.querySelector(t)}else{return f(te(),e)}}function x(e,t){if(typeof e!=="string"){return e.querySelectorAll(t)}else{return x(te(),e)}}function b(){return window}function _(e,t){e=w(e);if(t){b().setTimeout(function(){_(e);e=null},t)}else{u(e).removeChild(e)}}function ce(e){return e instanceof Element?e:null}function z(e){return e instanceof HTMLElement?e:null}function J(e){return typeof e==="string"?e:null}function p(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function K(e,t,n){e=ce(w(e));if(!e){return}if(n){b().setTimeout(function(){K(e,t);e=null},n)}else{e.classList&&e.classList.add(t)}}function G(e,t,n){let r=ce(w(e));if(!r){return}if(n){b().setTimeout(function(){G(r,t);r=null},n)}else{if(r.classList){r.classList.remove(t);if(r.classList.length===0){r.removeAttribute("class")}}}}function W(e,t){e=w(e);e.classList.toggle(t)}function Z(e,t){e=w(e);ie(e.parentElement.children,function(e){G(e,t)});K(ce(e),t)}function g(e,t){e=ce(w(e));if(e){return e.closest(t)}return null}function l(e,t){return e.substring(0,t.length)===t}function Y(e,t){return e.substring(e.length-t.length)===t}function pe(e){const t=e.trim();if(l(t,"<")&&Y(t,"/>")){return t.substring(1,t.length-2)}else{return t}}function m(t,r,n){if(r.indexOf("global ")===0){return m(t,r.slice(7),true)}t=w(t);const o=[];{let t=0;let n=0;for(let e=0;e<r.length;e++){const l=r[e];if(l===","&&t===0){o.push(r.substring(n,e));n=e+1;continue}if(l==="<"){t++}else if(l==="/"&&e<r.length-1&&r[e+1]===">"){t--}}if(n<r.length){o.push(r.substring(n))}}const i=[];const s=[];while(o.length>0){const r=pe(o.shift());let e;if(r.indexOf("closest ")===0){e=g(ce(t),pe(r.slice(8)))}else if(r.indexOf("find ")===0){e=f(p(t),pe(r.slice(5)))}else if(r==="next"||r==="nextElementSibling"){e=ce(t).nextElementSibling}else if(r.indexOf("next ")===0){e=ge(t,pe(r.slice(5)),!!n)}else if(r==="previous"||r==="previousElementSibling"){e=ce(t).previousElementSibling}else if(r.indexOf("previous ")===0){e=me(t,pe(r.slice(9)),!!n)}else if(r==="document"){e=document}else if(r==="window"){e=window}else if(r==="body"){e=document.body}else if(r==="root"){e=y(t,!!n)}else if(r==="host"){e=t.getRootNode().host}else{s.push(r)}if(e){i.push(e)}}if(s.length>0){const e=s.join(",");const c=p(y(t,!!n));i.push(...F(c.querySelectorAll(e)))}return i}var ge=function(t,e,n){const r=p(y(t,n)).querySelectorAll(e);for(let e=0;e<r.length;e++){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_PRECEDING){return o}}};var me=function(t,e,n){const r=p(y(t,n)).querySelectorAll(e);for(let e=r.length-1;e>=0;e--){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}};function ue(e,t){if(typeof e!=="string"){return m(e,t)[0]}else{return m(te().body,e)[0]}}function w(e,t){if(typeof e==="string"){return f(p(t)||document,e)}else{return e}}function ye(e,t,n,r){if(D(t)){return{target:te().body,event:J(e),listener:t,options:n}}else{return{target:w(e),event:J(t),listener:n,options:r}}}function xe(t,n,r,o){Gn(function(){const e=ye(t,n,r,o);e.target.addEventListener(e.event,e.listener,e.options)});const e=D(n);return e?n:r}function be(t,n,r){Gn(function(){const e=ye(t,n,r);e.target.removeEventListener(e.event,e.listener)});return D(n)?n:r}const ve=te().createElement("output");function we(t,n){const e=ne(t,n);if(e){if(e==="this"){return[Se(t,n)]}else{const r=m(t,e);const o=/(^|,)(\s*)inherit(\s*)($|,)/.test(e);if(o){const i=ce(q(t,function(e){return e!==t&&s(ce(e),n)}));if(i){r.push(...we(i,n))}}if(r.length===0){R('The selector "'+e+'" on '+n+" returned no matches!");return[ve]}else{return r}}}}function Se(e,t){return ce(q(e,function(e){return a(ce(e),t)!=null}))}function Ee(e){const t=ne(e,"hx-target");if(t){if(t==="this"){return Se(e,"hx-target")}else{return ue(e,t)}}else{const n=oe(e);if(n.boosted){return te().body}else{return e}}}function Ce(e){return Q.config.attributesToSettle.includes(e)}function Oe(t,n){ie(Array.from(t.attributes),function(e){if(!n.hasAttribute(e.name)&&Ce(e.name)){t.removeAttribute(e.name)}});ie(n.attributes,function(e){if(Ce(e.name)){t.setAttribute(e.name,e.value)}})}function Re(t,e){const n=Jn(e);for(let e=0;e<n.length;e++){const r=n[e];try{if(r.isInlineSwap(t)){return true}}catch(e){R(e)}}return t==="outerHTML"}function He(e,o,i,t){t=t||te();let n="#"+CSS.escape(ee(o,"id"));let s="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){s=e.substring(0,e.indexOf(":"));n=e.substring(e.indexOf(":")+1)}else{s=e}o.removeAttribute("hx-swap-oob");o.removeAttribute("data-hx-swap-oob");const r=m(t,n,false);if(r.length){ie(r,function(e){let t;const n=o.cloneNode(true);t=te().createDocumentFragment();t.appendChild(n);if(!Re(s,e)){t=p(n)}const r={shouldSwap:true,target:e,fragment:t};if(!ae(e,"htmx:oobBeforeSwap",r))return;e=r.target;if(r.shouldSwap){qe(t);$e(s,e,e,t,i);Te()}ie(i.elts,function(e){ae(e,"htmx:oobAfterSwap",r)})});o.parentNode.removeChild(o)}else{o.parentNode.removeChild(o);fe(te().body,"htmx:oobErrorNoTarget",{content:o})}return e}function Te(){const e=f("#--htmx-preserve-pantry--");if(e){for(const t of[...e.children]){const n=f("#"+t.id);n.parentNode.moveBefore(t,n);n.remove()}e.remove()}}function qe(e){ie(x(e,"[hx-preserve], [data-hx-preserve]"),function(e){const t=a(e,"id");const n=te().getElementById(t);if(n!=null){if(e.moveBefore){let e=f("#--htmx-preserve-pantry--");if(e==null){te().body.insertAdjacentHTML("afterend","<div id='--htmx-preserve-pantry--'></div>");e=f("#--htmx-preserve-pantry--")}e.moveBefore(n,null)}else{e.parentNode.replaceChild(n,e)}}})}function Ae(l,e,c){ie(e.querySelectorAll("[id]"),function(t){const n=ee(t,"id");if(n&&n.length>0){const r=n.replace("'","\\'");const o=t.tagName.replace(":","\\:");const e=p(l);const i=e&&e.querySelector(o+"[id='"+r+"']");if(i&&i!==e){const s=t.cloneNode();Oe(t,i);c.tasks.push(function(){Oe(t,s)})}}})}function Le(e){return function(){G(e,Q.config.addedClass);Mt(ce(e));Ne(p(e));ae(e,"htmx:load")}}function Ne(e){const t="[autofocus]";const n=z(h(e,t)?e:e.querySelector(t));if(n!=null){n.focus()}}function c(e,t,n,r){Ae(e,n,r);while(n.childNodes.length>0){const o=n.firstChild;K(ce(o),Q.config.addedClass);e.insertBefore(o,t);if(o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE){r.tasks.push(Le(o))}}}function Ie(e,t){let n=0;while(n<e.length){t=(t<<5)-t+e.charCodeAt(n++)|0}return t}function Pe(t){let n=0;for(let e=0;e<t.attributes.length;e++){const r=t.attributes[e];if(r.value){n=Ie(r.name,n);n=Ie(r.value,n)}}return n}function De(t){const n=oe(t);if(n.onHandlers){for(let e=0;e<n.onHandlers.length;e++){const r=n.onHandlers[e];be(t,r.event,r.listener)}delete n.onHandlers}}function ke(e){const t=oe(e);if(t.timeout){clearTimeout(t.timeout)}if(t.listenerInfos){ie(t.listenerInfos,function(e){if(e.on){be(e.on,e.trigger,e.listener)}})}De(e);ie(Object.keys(t),function(e){if(e!=="firstInitCompleted")delete t[e]})}function S(e){ae(e,"htmx:beforeCleanupElement");ke(e);ie(e.children,function(e){S(e)})}function Fe(t,e,n){if(t.tagName==="BODY"){return je(t,e,n)}let r;const o=t.previousSibling;const i=u(t);if(!i){return}c(i,t,e,n);if(o==null){r=i.firstChild}else{r=o.nextSibling}n.elts=n.elts.filter(function(e){return e!==t});while(r&&r!==t){if(r instanceof Element){n.elts.push(r)}r=r.nextSibling}S(t);t.remove()}function Me(e,t,n){return c(e,e.firstChild,t,n)}function Xe(e,t,n){return c(u(e),e,t,n)}function Be(e,t,n){return c(e,null,t,n)}function Ue(e,t,n){return c(u(e),e.nextSibling,t,n)}function Ve(e){S(e);const t=u(e);if(t){return t.removeChild(e)}}function je(e,t,n){const r=e.firstChild;c(e,r,t,n);if(r){while(r.nextSibling){S(r.nextSibling);e.removeChild(r.nextSibling)}S(r);e.removeChild(r)}}function $e(t,e,n,r,o){switch(t){case"none":return;case"outerHTML":Fe(n,r,o);return;case"afterbegin":Me(n,r,o);return;case"beforebegin":Xe(n,r,o);return;case"beforeend":Be(n,r,o);return;case"afterend":Ue(n,r,o);return;case"delete":Ve(n);return;default:var i=Jn(e);for(let e=0;e<i.length;e++){const s=i[e];try{const l=s.handleSwap(t,n,r,o);if(l){if(Array.isArray(l)){for(let e=0;e<l.length;e++){const c=l[e];if(c.nodeType!==Node.TEXT_NODE&&c.nodeType!==Node.COMMENT_NODE){o.tasks.push(Le(c))}}}return}}catch(e){R(e)}}if(t==="innerHTML"){je(n,r,o)}else{$e(Q.config.defaultSwapStyle,e,n,r,o)}}}function _e(e,n,r){var t=x(e,"[hx-swap-oob], [data-hx-swap-oob]");ie(t,function(e){if(Q.config.allowNestedOobSwaps||e.parentElement===null){const t=a(e,"hx-swap-oob");if(t!=null){He(t,e,n,r)}}else{e.removeAttribute("hx-swap-oob");e.removeAttribute("data-hx-swap-oob")}});return t.length>0}function ze(h,d,p,g){if(!g){g={}}let m=null;let n=null;let e=function(){re(g.beforeSwapCallback);h=w(h);const r=g.contextElement?y(g.contextElement,false):te();const e=document.activeElement;let t={};t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null};const o=Sn(h);if(p.swapStyle==="textContent"){h.textContent=d}else{let n=P(d);o.title=g.title||n.title;if(g.historyRequest){n=n.querySelector("[hx-history-elt],[data-hx-history-elt]")||n}if(g.selectOOB){const i=g.selectOOB.split(",");for(let t=0;t<i.length;t++){const s=i[t].split(":",2);let e=s[0].trim();if(e.indexOf("#")===0){e=e.substring(1)}const l=s[1]||"true";const c=n.querySelector("#"+e);if(c){He(l,c,o,r)}}}_e(n,o,r);ie(x(n,"template"),function(e){if(e.content&&_e(e.content,o,r)){e.remove()}});if(g.select){const u=te().createDocumentFragment();ie(n.querySelectorAll(g.select),function(e){u.appendChild(e)});n=u}qe(n);$e(p.swapStyle,g.contextElement,h,n,o);Te()}if(t.elt&&!se(t.elt)&&ee(t.elt,"id")){const f=document.getElementById(ee(t.elt,"id"));const a={preventScroll:p.focusScroll!==undefined?!p.focusScroll:!Q.config.defaultFocusScroll};if(f){if(t.start&&f.setSelectionRange){try{f.setSelectionRange(t.start,t.end)}catch(e){}}f.focus(a)}}h.classList.remove(Q.config.swappingClass);ie(o.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass)}ae(e,"htmx:afterSwap",g.eventInfo)});re(g.afterSwapCallback);if(!p.ignoreTitle){Bn(o.title)}const n=function(){ie(o.tasks,function(e){e.call()});ie(o.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass)}ae(e,"htmx:afterSettle",g.eventInfo)});if(g.anchor){const e=ce(w("#"+g.anchor));if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}En(o.elts,p);re(g.afterSettleCallback);re(m)};if(p.settleDelay>0){b().setTimeout(n,p.settleDelay)}else{n()}};let t=Q.config.globalViewTransitions;if(p.hasOwnProperty("transition")){t=p.transition}const r=g.contextElement||te();if(t&&ae(r,"htmx:beforeTransition",g.eventInfo)&&typeof Promise!=="undefined"&&document.startViewTransition){const o=new Promise(function(e,t){m=e;n=t});const i=e;e=function(){document.startViewTransition(function(){i();return o})}}try{if(p?.swapDelay&&p.swapDelay>0){b().setTimeout(e,p.swapDelay)}else{e()}}catch(e){fe(r,"htmx:swapError",g.eventInfo);re(n);throw e}}function Je(e,t,n){const r=e.getResponseHeader(t);if(r.indexOf("{")===0){const o=v(r);for(const i in o){if(o.hasOwnProperty(i)){let e=o[i];if(k(e)){n=e.target!==undefined?e.target:n}else{e={value:e}}ae(n,i,e)}}}else{const s=r.split(",");for(let e=0;e<s.length;e++){ae(n,s[e].trim(),[])}}}const Ke=/\s/;const E=/[\s,]/;const Ge=/[_$a-zA-Z]/;const We=/[_$a-zA-Z0-9]/;const Ze=['"',"'","/"];const C=/[^\s]/;const Ye=/[{(]/;const Qe=/[})]/;function et(e){const t=[];let n=0;while(n<e.length){if(Ge.exec(e.charAt(n))){var r=n;while(We.exec(e.charAt(n+1))){n++}t.push(e.substring(r,n+1))}else if(Ze.indexOf(e.charAt(n))!==-1){const o=e.charAt(n);var r=n;n++;while(n<e.length&&e.charAt(n)!==o){if(e.charAt(n)==="\\"){n++}n++}t.push(e.substring(r,n+1))}else{const i=e.charAt(n);t.push(i)}n++}return t}function tt(e,t,n){return Ge.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function nt(r,o,i){if(o[0]==="["){o.shift();let e=1;let t=" return (function("+i+"){ return (";let n=null;while(o.length>0){const s=o[0];if(s==="]"){e--;if(e===0){if(n===null){t=t+"true"}o.shift();t+=")})";try{const l=On(r,function(){return Function(t)()},function(){return true});l.source=t;return l}catch(e){fe(te().body,"htmx:syntax:error",{error:e,source:t});return null}}}else if(s==="["){e++}if(tt(s,n,i)){t+="(("+i+"."+s+") ? ("+i+"."+s+") : (window."+s+"))"}else{t=t+s}n=o.shift()}}}function O(e,t){let n="";while(e.length>0&&!t.test(e[0])){n+=e.shift()}return n}function rt(e){let t;if(e.length>0&&Ye.test(e[0])){e.shift();t=O(e,Qe).trim();e.shift()}else{t=O(e,E)}return t}const ot="input, textarea, select";function it(e,t,n){const r=[];const o=et(t);do{O(o,C);const l=o.length;const c=O(o,/[,\[\s]/);if(c!==""){if(c==="every"){const u={trigger:"every"};O(o,C);u.pollInterval=d(O(o,/[,\[\s]/));O(o,C);var i=nt(e,o,"event");if(i){u.eventFilter=i}r.push(u)}else{const f={trigger:c};var i=nt(e,o,"event");if(i){f.eventFilter=i}O(o,C);while(o.length>0&&o[0]!==","){const a=o.shift();if(a==="changed"){f.changed=true}else if(a==="once"){f.once=true}else if(a==="consume"){f.consume=true}else if(a==="delay"&&o[0]===":"){o.shift();f.delay=d(O(o,E))}else if(a==="from"&&o[0]===":"){o.shift();if(Ye.test(o[0])){var s=rt(o)}else{var s=O(o,E);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();const h=rt(o);if(h.length>0){s+=" "+h}}}f.from=s}else if(a==="target"&&o[0]===":"){o.shift();f.target=rt(o)}else if(a==="throttle"&&o[0]===":"){o.shift();f.throttle=d(O(o,E))}else if(a==="queue"&&o[0]===":"){o.shift();f.queue=O(o,E)}else if(a==="root"&&o[0]===":"){o.shift();f[a]=rt(o)}else if(a==="threshold"&&o[0]===":"){o.shift();f[a]=O(o,E)}else{fe(e,"htmx:syntax:error",{token:o.shift()})}O(o,C)}r.push(f)}}if(o.length===l){fe(e,"htmx:syntax:error",{token:o.shift()})}O(o,C)}while(o[0]===","&&o.shift());if(n){n[t]=r}return r}function st(e){const t=a(e,"hx-trigger");let n=[];if(t){const r=Q.config.triggerSpecsCache;n=r&&r[t]||it(e,t,r)}if(n.length>0){return n}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,ot)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function lt(e){oe(e).cancelled=true}function ct(e,t,n){const r=oe(e);r.timeout=b().setTimeout(function(){if(se(e)&&r.cancelled!==true){if(!pt(n,e,Bt("hx:poll:trigger",{triggerSpec:n,target:e}))){t(e)}ct(e,t,n)}},n.pollInterval)}function ut(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function ft(e){return g(e,Q.config.disableSelector)}function at(t,n,e){if(t instanceof HTMLAnchorElement&&ut(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"&&String(ee(t,"method")).toLowerCase()!=="dialog"){n.boosted=true;let r,o;if(t.tagName==="A"){r="get";o=ee(t,"href")}else{const i=ee(t,"method");r=i?i.toLowerCase():"get";o=ee(t,"action");if(o==null||o===""){o=location.href}if(r==="get"&&o.includes("?")){o=o.replace(/\?[^#]+/,"")}}e.forEach(function(e){gt(t,function(e,t){const n=ce(e);if(ft(n)){S(n);return}he(r,o,n,t)},n,e,true)})}}function ht(e,t){if(e.type==="submit"&&t.tagName==="FORM"){return true}else if(e.type==="click"){const n=t.closest('input[type="submit"], button');if(n&&n.form&&n.type==="submit"){return true}const r=t.closest("a");const o=/^#.+/;if(r&&r.href&&!o.test(r.getAttribute("href"))){return true}}return false}function dt(e,t){return oe(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function pt(e,t,n){const r=e.eventFilter;if(r){try{return r.call(t,n)!==true}catch(e){const o=r.source;fe(te().body,"htmx:eventFilter:error",{error:e,source:o});return true}}return false}function gt(l,c,e,u,f){const a=oe(l);let t;if(u.from){t=m(l,u.from)}else{t=[l]}if(u.changed){if(!("lastValue"in a)){a.lastValue=new WeakMap}t.forEach(function(e){if(!a.lastValue.has(u)){a.lastValue.set(u,new WeakMap)}a.lastValue.get(u).set(e,e.value)})}ie(t,function(i){const s=function(e){if(!se(l)){i.removeEventListener(u.trigger,s);return}if(dt(l,e)){return}if(f||ht(e,i)){e.preventDefault()}if(pt(u,l,e)){return}const t=oe(e);t.triggerSpec=u;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(l)<0){t.handledFor.push(l);if(u.consume){e.stopPropagation()}if(u.target&&e.target){if(!h(ce(e.target),u.target)){return}}if(u.once){if(a.triggeredOnce){return}else{a.triggeredOnce=true}}if(u.changed){const n=e.target;const r=n.value;const o=a.lastValue.get(u);if(o.has(n)&&o.get(n)===r){return}o.set(n,r)}if(a.delayed){clearTimeout(a.delayed)}if(a.throttle){return}if(u.throttle>0){if(!a.throttle){ae(l,"htmx:trigger");c(l,e);a.throttle=b().setTimeout(function(){a.throttle=null},u.throttle)}}else if(u.delay>0){a.delayed=b().setTimeout(function(){ae(l,"htmx:trigger");c(l,e)},u.delay)}else{ae(l,"htmx:trigger");c(l,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:u.trigger,listener:s,on:i});i.addEventListener(u.trigger,s)})}let mt=false;let yt=null;function xt(){if(!yt){yt=function(){mt=true};window.addEventListener("scroll",yt);window.addEventListener("resize",yt);setInterval(function(){if(mt){mt=false;ie(te().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){bt(e)})}},200)}}function bt(e){if(!s(e,"data-hx-revealed")&&M(e)){e.setAttribute("data-hx-revealed","true");const t=oe(e);if(t.initHash){ae(e,"revealed")}else{e.addEventListener("htmx:afterProcessNode",function(){ae(e,"revealed")},{once:true})}}}function vt(e,t,n,r){const o=function(){if(!n.loaded){n.loaded=true;ae(e,"htmx:trigger");t(e)}};if(r>0){b().setTimeout(o,r)}else{o()}}function wt(t,n,e){let i=false;ie(de,function(r){if(s(t,"hx-"+r)){const o=a(t,"hx-"+r);i=true;n.path=o;n.verb=r;e.forEach(function(e){St(t,e,n,function(e,t){const n=ce(e);if(ft(n)){S(n);return}he(r,o,n,t)})})}});return i}function St(r,e,t,n){if(e.trigger==="revealed"){xt();gt(r,n,t,e);bt(ce(r))}else if(e.trigger==="intersect"){const o={};if(e.root){o.root=ue(r,e.root)}if(e.threshold){o.threshold=parseFloat(e.threshold)}const i=new IntersectionObserver(function(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.isIntersecting){ae(r,"intersect");break}}},o);i.observe(ce(r));gt(ce(r),n,t,e)}else if(!t.firstInitCompleted&&e.trigger==="load"){if(!pt(e,r,Bt("load",{elt:r}))){vt(ce(r),n,t,e.delay)}}else if(e.pollInterval>0){t.polling=true;ct(ce(r),n,e)}else{gt(r,n,t,e)}}function Et(e){const t=ce(e);if(!t){return false}const n=t.attributes;for(let e=0;e<n.length;e++){const r=n[e].name;if(l(r,"hx-on:")||l(r,"data-hx-on:")||l(r,"hx-on-")||l(r,"data-hx-on-")){return true}}return false}const Ct=(new XPathEvaluator).createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or'+' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function Ot(e,t){if(Et(e)){t.push(ce(e))}const n=Ct.evaluate(e);let r=null;while(r=n.iterateNext())t.push(ce(r))}function Rt(e){const t=[];if(e instanceof DocumentFragment){for(const n of e.childNodes){Ot(n,t)}}else{Ot(e,t)}return t}function Ht(e){if(e.querySelectorAll){const n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]";const r=[];for(const i in jn){const s=jn[i];if(s.getSelectors){var t=s.getSelectors();if(t){r.push(t)}}}const o=e.querySelectorAll(T+n+", form, [type='submit'],"+" [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(e=>", "+e).join(""));return o}else{return[]}}function Tt(e){const t=At(e.target);const n=Nt(e);if(n){n.lastButtonClicked=t}}function qt(e){const t=Nt(e);if(t){t.lastButtonClicked=null}}function At(e){return g(ce(e),"button, input[type='submit']")}function Lt(e){return e.form||g(e,"form")}function Nt(e){const t=At(e.target);if(!t){return}const n=Lt(t);if(!n){return}return oe(n)}function It(e){e.addEventListener("click",Tt);e.addEventListener("focusin",Tt);e.addEventListener("focusout",qt)}function Pt(t,e,n){const r=oe(t);if(!Array.isArray(r.onHandlers)){r.onHandlers=[]}let o;const i=function(e){On(t,function(){if(ft(t)){return}if(!o){o=new Function("event",n)}o.call(t,e)})};t.addEventListener(e,i);r.onHandlers.push({event:e,listener:i})}function Dt(t){De(t);for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;const r=t.attributes[e].value;if(l(n,"hx-on")||l(n,"data-hx-on")){const o=n.indexOf("-on")+3;const i=n.slice(o,o+1);if(i==="-"||i===":"){let e=n.slice(o+1);if(l(e,":")){e="htmx"+e}else if(l(e,"-")){e="htmx:"+e.slice(1)}else if(l(e,"htmx-")){e="htmx:"+e.slice(5)}Pt(t,e,r)}}}}function kt(t){ae(t,"htmx:beforeProcessNode");const n=oe(t);const e=st(t);const r=wt(t,n,e);if(!r){if(ne(t,"hx-boost")==="true"){at(t,n,e)}else if(s(t,"hx-trigger")){e.forEach(function(e){St(t,e,n,function(){})})}}if(t.tagName==="FORM"||ee(t,"type")==="submit"&&s(t,"form")){It(t)}n.firstInitCompleted=true;ae(t,"htmx:afterProcessNode")}function Ft(e){if(!(e instanceof Element)){return false}const t=oe(e);const n=Pe(e);if(t.initHash!==n){ke(e);t.initHash=n;return true}return false}function Mt(e){e=w(e);if(ft(e)){S(e);return}const t=[];if(Ft(e)){t.push(e)}ie(Ht(e),function(e){if(ft(e)){S(e);return}if(Ft(e)){t.push(e)}});ie(Rt(e),Dt);ie(t,kt)}function Xt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Bt(e,t){return new CustomEvent(e,{bubbles:true,cancelable:true,composed:true,detail:t})}function fe(e,t,n){ae(e,t,le({error:t},n))}function Ut(e){return e==="htmx:afterProcessNode"}function Vt(e,t,n){ie(Jn(e,[],n),function(e){try{t(e)}catch(e){R(e)}})}function R(e){console.error(e)}function ae(e,t,n){e=w(e);if(n==null){n={}}n.elt=e;const r=Bt(t,n);if(Q.logger&&!Ut(t)){Q.logger(e,t,n)}if(n.error){R(n.error);ae(e,"htmx:error",{errorInfo:n})}let o=e.dispatchEvent(r);const i=Xt(t);if(o&&i!==t){const s=Bt(i,r.detail);o=o&&e.dispatchEvent(s)}Vt(ce(e),function(e){o=o&&(e.onEvent(t,r)!==false&&!r.defaultPrevented)});return o}let jt=location.pathname+location.search;function $t(e){jt=e;if(B()){sessionStorage.setItem("htmx-current-path-for-history",e)}}function _t(){const e=te().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||te().body}function zt(t,e){if(!B()){return}const n=Kt(e);const r=te().title;const o=window.scrollY;if(Q.config.historyCacheSize<=0){sessionStorage.removeItem("htmx-history-cache");return}t=U(t);const i=v(sessionStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<i.length;e++){if(i[e].url===t){i.splice(e,1);break}}const s={url:t,content:n,title:r,scroll:o};ae(te().body,"htmx:historyItemCreated",{item:s,cache:i});i.push(s);while(i.length>Q.config.historyCacheSize){i.shift()}while(i.length>0){try{sessionStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){fe(te().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Jt(t){if(!B()){return null}t=U(t);const n=v(sessionStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<n.length;e++){if(n[e].url===t){return n[e]}}return null}function Kt(e){const t=Q.config.requestClass;const n=e.cloneNode(true);ie(x(n,"."+t),function(e){G(e,t)});ie(x(n,"[data-disabled-by-htmx]"),function(e){e.removeAttribute("disabled")});return n.innerHTML}function Gt(){const e=_t();let t=jt;if(B()){t=sessionStorage.getItem("htmx-current-path-for-history")}t=t||location.pathname+location.search;const n=te().querySelector('[hx-history="false" i],[data-hx-history="false" i]');if(!n){ae(te().body,"htmx:beforeHistorySave",{path:t,historyElt:e});zt(t,e)}if(Q.config.historyEnabled)history.replaceState({htmx:true},te().title,location.href)}function Wt(e){if(Q.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(Y(e,"&")||Y(e,"?")){e=e.slice(0,-1)}}if(Q.config.historyEnabled){history.pushState({htmx:true},"",e)}$t(e)}function Zt(e){if(Q.config.historyEnabled)history.replaceState({htmx:true},"",e);$t(e)}function Yt(e){ie(e,function(e){e.call(undefined)})}function Qt(e){const t=new XMLHttpRequest;const n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0};const r={path:e,xhr:t,historyElt:_t(),swapSpec:n};t.open("GET",e,true);if(Q.config.historyRestoreAsHxRequest){t.setRequestHeader("HX-Request","true")}t.setRequestHeader("HX-History-Restore-Request","true");t.setRequestHeader("HX-Current-URL",location.href);t.onload=function(){if(this.status>=200&&this.status<400){r.response=this.response;ae(te().body,"htmx:historyCacheMissLoad",r);ze(r.historyElt,r.response,n,{contextElement:r.historyElt,historyRequest:true});$t(r.path);ae(te().body,"htmx:historyRestore",{path:e,cacheMiss:true,serverResponse:r.response})}else{fe(te().body,"htmx:historyCacheMissLoadError",r)}};if(ae(te().body,"htmx:historyCacheMiss",r)){t.send()}}function en(e){Gt();e=e||location.pathname+location.search;const t=Jt(e);if(t){const n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0,scroll:t.scroll};const r={path:e,item:t,historyElt:_t(),swapSpec:n};if(ae(te().body,"htmx:historyCacheHit",r)){ze(r.historyElt,t.content,n,{contextElement:r.historyElt,title:t.title});$t(r.path);ae(te().body,"htmx:historyRestore",r)}}else{if(Q.config.refreshOnHistoryMiss){Q.location.reload(true)}else{Qt(e)}}}function tn(e){let t=we(e,"hx-indicator");if(t==null){t=[e]}ie(t,function(e){const t=oe(e);t.requestCount=(t.requestCount||0)+1;e.classList.add.call(e.classList,Q.config.requestClass)});return t}function nn(e){let t=we(e,"hx-disabled-elt");if(t==null){t=[]}ie(t,function(e){const t=oe(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","");e.setAttribute("data-disabled-by-htmx","")});return t}function rn(e,t){ie(e.concat(t),function(e){const t=oe(e);t.requestCount=(t.requestCount||1)-1});ie(e,function(e){const t=oe(e);if(t.requestCount===0){e.classList.remove.call(e.classList,Q.config.requestClass)}});ie(t,function(e){const t=oe(e);if(t.requestCount===0){e.removeAttribute("disabled");e.removeAttribute("data-disabled-by-htmx")}})}function on(t,n){for(let e=0;e<t.length;e++){const r=t[e];if(r.isSameNode(n)){return true}}return false}function sn(e){const t=e;if(t.name===""||t.name==null||t.disabled||g(t,"fieldset[disabled]")){return false}if(t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"){return false}if(t.type==="checkbox"||t.type==="radio"){return t.checked}return true}function ln(t,e,n){if(t!=null&&e!=null){if(Array.isArray(e)){e.forEach(function(e){n.append(t,e)})}else{n.append(t,e)}}}function cn(t,n,r){if(t!=null&&n!=null){let e=r.getAll(t);if(Array.isArray(n)){e=e.filter(e=>n.indexOf(e)<0)}else{e=e.filter(e=>e!==n)}r.delete(t);ie(e,e=>r.append(t,e))}}function un(e){if(e instanceof HTMLSelectElement&&e.multiple){return F(e.querySelectorAll("option:checked")).map(function(e){return e.value})}if(e instanceof HTMLInputElement&&e.files){return F(e.files)}return e.value}function fn(t,n,r,e,o){if(e==null||on(t,e)){return}else{t.push(e)}if(sn(e)){const i=ee(e,"name");ln(i,un(e),n);if(o){an(e,r)}}if(e instanceof HTMLFormElement){ie(e.elements,function(e){if(t.indexOf(e)>=0){cn(e.name,un(e),n)}else{t.push(e)}if(o){an(e,r)}});new FormData(e).forEach(function(e,t){if(e instanceof File&&e.name===""){return}ln(t,e,n)})}}function an(e,t){const n=e;if(n.willValidate){ae(n,"htmx:validation:validate");if(!n.checkValidity()){if(ae(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})&&!t.length&&Q.config.reportValidityOfForms){n.reportValidity()}t.push({elt:n,message:n.validationMessage,validity:n.validity})}}}function hn(n,e){for(const t of e.keys()){n.delete(t)}e.forEach(function(e,t){n.append(t,e)});return n}function dn(e,t){const n=[];const r=new FormData;const o=new FormData;const i=[];const s=oe(e);if(s.lastButtonClicked&&!se(s.lastButtonClicked)){s.lastButtonClicked=null}let l=e instanceof HTMLFormElement&&e.noValidate!==true||a(e,"hx-validate")==="true";if(s.lastButtonClicked){l=l&&s.lastButtonClicked.formNoValidate!==true}if(t!=="get"){fn(n,o,i,Lt(e),l)}fn(n,r,i,e,l);if(s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&ee(e,"type")==="submit"){const u=s.lastButtonClicked||e;const f=ee(u,"name");ln(f,u.value,o)}const c=we(e,"hx-include");ie(c,function(e){fn(n,r,i,ce(e),l);if(!h(e,"form")){ie(p(e).querySelectorAll(ot),function(e){fn(n,r,i,e,l)})}});hn(r,o);return{errors:i,formData:r,values:kn(r)}}function pn(e,t,n){if(e!==""){e+="&"}if(String(n)==="[object Object]"){n=JSON.stringify(n)}const r=encodeURIComponent(n);e+=encodeURIComponent(t)+"="+r;return e}function gn(e){e=Pn(e);let n="";e.forEach(function(e,t){n=pn(n,t,e)});return n}function mn(e,t,n){const r={"HX-Request":"true","HX-Trigger":ee(e,"id"),"HX-Trigger-Name":ee(e,"name"),"HX-Target":a(t,"id"),"HX-Current-URL":location.href};Cn(e,"hx-headers",false,r);if(n!==undefined){r["HX-Prompt"]=n}if(oe(e).boosted){r["HX-Boosted"]="true"}return r}function yn(n,e){const t=ne(e,"hx-params");if(t){if(t==="none"){return new FormData}else if(t==="*"){return n}else if(t.indexOf("not ")===0){ie(t.slice(4).split(","),function(e){e=e.trim();n.delete(e)});return n}else{const r=new FormData;ie(t.split(","),function(t){t=t.trim();if(n.has(t)){n.getAll(t).forEach(function(e){r.append(t,e)})}});return r}}else{return n}}function xn(e){return!!ee(e,"href")&&ee(e,"href").indexOf("#")>=0}function bn(e,t){const n=t||ne(e,"hx-swap");const r={swapStyle:oe(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&oe(e).boosted&&!xn(e)){r.show="top"}if(n){const s=X(n);if(s.length>0){for(let e=0;e<s.length;e++){const l=s[e];if(l.indexOf("swap:")===0){r.swapDelay=d(l.slice(5))}else if(l.indexOf("settle:")===0){r.settleDelay=d(l.slice(7))}else if(l.indexOf("transition:")===0){r.transition=l.slice(11)==="true"}else if(l.indexOf("ignoreTitle:")===0){r.ignoreTitle=l.slice(12)==="true"}else if(l.indexOf("scroll:")===0){const c=l.slice(7);var o=c.split(":");const u=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=u;r.scrollTarget=i}else if(l.indexOf("show:")===0){const f=l.slice(5);var o=f.split(":");const a=o.pop();var i=o.length>0?o.join(":"):null;r.show=a;r.showTarget=i}else if(l.indexOf("focus-scroll:")===0){const h=l.slice("focus-scroll:".length);r.focusScroll=h=="true"}else if(e==0){r.swapStyle=l}else{R("Unknown modifier in hx-swap: "+l)}}}}return r}function vn(e){return ne(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function wn(t,n,r){let o=null;Vt(n,function(e){if(o==null){o=e.encodeParameters(t,r,n)}});if(o!=null){return o}else{if(vn(n)){return hn(new FormData,Pn(r))}else{return gn(r)}}}function Sn(e){return{tasks:[],elts:[e]}}function En(e,t){const n=e[0];const r=e[e.length-1];if(t.scroll){var o=null;if(t.scrollTarget){o=ce(ue(n,t.scrollTarget))}if(t.scroll==="top"&&(n||o)){o=o||n;o.scrollTop=0}if(t.scroll==="bottom"&&(r||o)){o=o||r;o.scrollTop=o.scrollHeight}if(typeof t.scroll==="number"){b().setTimeout(function(){window.scrollTo(0,t.scroll)},0)}}if(t.show){var o=null;if(t.showTarget){let e=t.showTarget;if(t.showTarget==="window"){e="body"}o=ce(ue(n,e))}if(t.show==="top"&&(n||o)){o=o||n;o.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior})}if(t.show==="bottom"&&(r||o)){o=o||r;o.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior})}}}function Cn(r,e,o,i,s){if(i==null){i={}}if(r==null){return i}const l=a(r,e);if(l){let e=l.trim();let t=o;if(e==="unset"){return null}if(e.indexOf("javascript:")===0){e=e.slice(11);t=true}else if(e.indexOf("js:")===0){e=e.slice(3);t=true}if(e.indexOf("{")!==0){e="{"+e+"}"}let n;if(t){n=On(r,function(){if(s){return Function("event","return ("+e+")").call(r,s)}else{return Function("return ("+e+")").call(r)}},{})}else{n=v(e)}for(const c in n){if(n.hasOwnProperty(c)){if(i[c]==null){i[c]=n[c]}}}}return Cn(ce(u(r)),e,o,i,s)}function On(e,t,n){if(Q.config.allowEval){return t()}else{fe(e,"htmx:evalDisallowedError");return n}}function Rn(e,t,n){return Cn(e,"hx-vars",true,n,t)}function Hn(e,t,n){return Cn(e,"hx-vals",false,n,t)}function Tn(e,t){return le(Rn(e,t),Hn(e,t))}function qn(t,n,r){if(r!==null){try{t.setRequestHeader(n,r)}catch(e){t.setRequestHeader(n,encodeURIComponent(r));t.setRequestHeader(n+"-URI-AutoEncoded","true")}}}function An(t){if(t.responseURL){try{const e=new URL(t.responseURL);return e.pathname+e.search}catch(e){fe(te().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function H(e,t){return t.test(e.getAllResponseHeaders())}function Ln(t,n,r){t=t.toLowerCase();if(r){if(r instanceof Element||typeof r==="string"){return he(t,n,null,null,{targetOverride:w(r)||ve,returnPromise:true})}else{let e=w(r.target);if(r.target&&!e||r.source&&!e&&!w(r.source)){e=ve}return he(t,n,w(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:e,swapOverride:r.swap,select:r.select,returnPromise:true})}}else{return he(t,n,null,null,{returnPromise:true})}}function Nn(e){const t=[];while(e){t.push(e);e=e.parentElement}return t}function In(e,t,n){const r=new URL(t,location.protocol!=="about:"?location.href:window.origin);const o=location.protocol!=="about:"?location.origin:window.origin;const i=o===r.origin;if(Q.config.selfRequestsOnly){if(!i){return false}}return ae(e,"htmx:validateUrl",le({url:r,sameHost:i},n))}function Pn(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e){if(e.hasOwnProperty(n)){if(e[n]&&typeof e[n].forEach==="function"){e[n].forEach(function(e){t.append(n,e)})}else if(typeof e[n]==="object"&&!(e[n]instanceof Blob)){t.append(n,JSON.stringify(e[n]))}else{t.append(n,e[n])}}}return t}function Dn(r,o,e){return new Proxy(e,{get:function(t,e){if(typeof e==="number")return t[e];if(e==="length")return t.length;if(e==="push"){return function(e){t.push(e);r.append(o,e)}}if(typeof t[e]==="function"){return function(){t[e].apply(t,arguments);r.delete(o);t.forEach(function(e){r.append(o,e)})}}if(t[e]&&t[e].length===1){return t[e][0]}else{return t[e]}},set:function(e,t,n){e[t]=n;r.delete(o);e.forEach(function(e){r.append(o,e)});return true}})}function kn(o){return new Proxy(o,{get:function(e,t){if(typeof t==="symbol"){const r=Reflect.get(e,t);if(typeof r==="function"){return function(){return r.apply(o,arguments)}}else{return r}}if(t==="toJSON"){return()=>Object.fromEntries(o)}if(t in e){if(typeof e[t]==="function"){return function(){return o[t].apply(o,arguments)}}}const n=o.getAll(t);if(n.length===0){return undefined}else if(n.length===1){return n[0]}else{return Dn(e,t,n)}},set:function(t,n,e){if(typeof n!=="string"){return false}t.delete(n);if(e&&typeof e.forEach==="function"){e.forEach(function(e){t.append(n,e)})}else if(typeof e==="object"&&!(e instanceof Blob)){t.append(n,JSON.stringify(e))}else{t.append(n,e)}return true},deleteProperty:function(e,t){if(typeof t==="string"){e.delete(t)}return true},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function he(t,n,r,o,i,k){let s=null;let l=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var e=new Promise(function(e,t){s=e;l=t})}if(r==null){r=te().body}const F=i.handler||Vn;const M=i.select||null;if(!se(r)){re(s);return e}const c=i.targetOverride||ce(Ee(r));if(c==null||c==ve){fe(r,"htmx:targetError",{target:ne(r,"hx-target")});re(l);return e}let u=oe(r);const f=u.lastButtonClicked;if(f){const A=ee(f,"formaction");if(A!=null){n=A}const L=ee(f,"formmethod");if(L!=null){if(de.includes(L.toLowerCase())){t=L}else{re(s);return e}}}const a=ne(r,"hx-confirm");if(k===undefined){const K=function(e){return he(t,n,r,o,i,!!e)};const G={target:c,elt:r,path:n,verb:t,triggeringEvent:o,etc:i,issueRequest:K,question:a};if(ae(r,"htmx:confirm",G)===false){re(s);return e}}let h=r;let d=ne(r,"hx-sync");let p=null;let X=false;if(d){const N=d.split(":");const I=N[0].trim();if(I==="this"){h=Se(r,"hx-sync")}else{h=ce(ue(r,I))}d=(N[1]||"drop").trim();u=oe(h);if(d==="drop"&&u.xhr&&u.abortable!==true){re(s);return e}else if(d==="abort"){if(u.xhr){re(s);return e}else{X=true}}else if(d==="replace"){ae(h,"htmx:abort")}else if(d.indexOf("queue")===0){const W=d.split(" ");p=(W[1]||"last").trim()}}if(u.xhr){if(u.abortable){ae(h,"htmx:abort")}else{if(p==null){if(o){const P=oe(o);if(P&&P.triggerSpec&&P.triggerSpec.queue){p=P.triggerSpec.queue}}if(p==null){p="last"}}if(u.queuedRequests==null){u.queuedRequests=[]}if(p==="first"&&u.queuedRequests.length===0){u.queuedRequests.push(function(){he(t,n,r,o,i)})}else if(p==="all"){u.queuedRequests.push(function(){he(t,n,r,o,i)})}else if(p==="last"){u.queuedRequests=[];u.queuedRequests.push(function(){he(t,n,r,o,i)})}re(s);return e}}const g=new XMLHttpRequest;u.xhr=g;u.abortable=X;const m=function(){u.xhr=null;u.abortable=false;if(u.queuedRequests!=null&&u.queuedRequests.length>0){const e=u.queuedRequests.shift();e()}};const B=ne(r,"hx-prompt");if(B){var y=prompt(B);if(y===null||!ae(r,"htmx:prompt",{prompt:y,target:c})){re(s);m();return e}}if(a&&!k){if(!confirm(a)){re(s);m();return e}}let x=mn(r,c,y);if(t!=="get"&&!vn(r)){x["Content-Type"]="application/x-www-form-urlencoded"}if(i.headers){x=le(x,i.headers)}const U=dn(r,t);let b=U.errors;const V=U.formData;if(i.values){hn(V,Pn(i.values))}const j=Pn(Tn(r,o));const v=hn(V,j);let w=yn(v,r);if(Q.config.getCacheBusterParam&&t==="get"){w.set("org.htmx.cache-buster",ee(c,"id")||"true")}if(n==null||n===""){n=location.href}const S=Cn(r,"hx-request");const $=oe(r).boosted;let E=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;const C={boosted:$,useUrlParams:E,formData:w,parameters:kn(w),unfilteredFormData:v,unfilteredParameters:kn(v),headers:x,elt:r,target:c,verb:t,errors:b,withCredentials:i.credentials||S.credentials||Q.config.withCredentials,timeout:i.timeout||S.timeout||Q.config.timeout,path:n,triggeringEvent:o};if(!ae(r,"htmx:configRequest",C)){re(s);m();return e}n=C.path;t=C.verb;x=C.headers;w=Pn(C.parameters);b=C.errors;E=C.useUrlParams;if(b&&b.length>0){ae(r,"htmx:validation:halted",C);re(s);m();return e}const _=n.split("#");const z=_[0];const O=_[1];let R=n;if(E){R=z;const Z=!w.keys().next().done;if(Z){if(R.indexOf("?")<0){R+="?"}else{R+="&"}R+=gn(w);if(O){R+="#"+O}}}if(!In(r,R,C)){fe(r,"htmx:invalidPath",C);re(l);m();return e}g.open(t.toUpperCase(),R,true);g.overrideMimeType("text/html");g.withCredentials=C.withCredentials;g.timeout=C.timeout;if(S.noHeaders){}else{for(const D in x){if(x.hasOwnProperty(D)){const Y=x[D];qn(g,D,Y)}}}const H={xhr:g,target:c,requestConfig:C,etc:i,boosted:$,select:M,pathInfo:{requestPath:n,finalRequestPath:R,responsePath:null,anchor:O}};g.onload=function(){try{const t=Nn(r);H.pathInfo.responsePath=An(g);F(r,H);if(H.keepIndicators!==true){rn(T,q)}ae(r,"htmx:afterRequest",H);ae(r,"htmx:afterOnLoad",H);if(!se(r)){let e=null;while(t.length>0&&e==null){const n=t.shift();if(se(n)){e=n}}if(e){ae(e,"htmx:afterRequest",H);ae(e,"htmx:afterOnLoad",H)}}re(s)}catch(e){fe(r,"htmx:onLoadError",le({error:e},H));throw e}finally{m()}};g.onerror=function(){rn(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:sendError",H);re(l);m()};g.onabort=function(){rn(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:sendAbort",H);re(l);m()};g.ontimeout=function(){rn(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:timeout",H);re(l);m()};if(!ae(r,"htmx:beforeRequest",H)){re(s);m();return e}var T=tn(r);var q=nn(r);ie(["loadstart","loadend","progress","abort"],function(t){ie([g,g.upload],function(e){e.addEventListener(t,function(e){ae(r,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});ae(r,"htmx:beforeSend",H);const J=E?null:wn(g,r,w);g.send(J);return e}function Fn(e,t){const n=t.xhr;let r=null;let o=null;if(H(n,/HX-Push:/i)){r=n.getResponseHeader("HX-Push");o="push"}else if(H(n,/HX-Push-Url:/i)){r=n.getResponseHeader("HX-Push-Url");o="push"}else if(H(n,/HX-Replace-Url:/i)){r=n.getResponseHeader("HX-Replace-Url");o="replace"}if(r){if(r==="false"){return{}}else{return{type:o,path:r}}}const i=t.pathInfo.finalRequestPath;const s=t.pathInfo.responsePath;const l=ne(e,"hx-push-url");const c=ne(e,"hx-replace-url");const u=oe(e).boosted;let f=null;let a=null;if(l){f="push";a=l}else if(c){f="replace";a=c}else if(u){f="push";a=s||i}if(a){if(a==="false"){return{}}if(a==="true"){a=s||i}if(t.pathInfo.anchor&&a.indexOf("#")===-1){a=a+"#"+t.pathInfo.anchor}return{type:f,path:a}}else{return{}}}function Mn(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function Xn(e){for(var t=0;t<Q.config.responseHandling.length;t++){var n=Q.config.responseHandling[t];if(Mn(n,e.status)){return n}}return{swap:false}}function Bn(e){if(e){const t=f("title");if(t){t.textContent=e}else{window.document.title=e}}}function Un(e,t){if(t==="this"){return e}const n=ce(ue(e,t));if(n==null){fe(e,"htmx:targetError",{target:t});throw new Error(`Invalid re-target ${t}`)}return n}function Vn(t,e){const n=e.xhr;let r=e.target;const o=e.etc;const i=e.select;if(!ae(t,"htmx:beforeOnLoad",e))return;if(H(n,/HX-Trigger:/i)){Je(n,"HX-Trigger",t)}if(H(n,/HX-Location:/i)){Gt();let e=n.getResponseHeader("HX-Location");var s;if(e.indexOf("{")===0){s=v(e);e=s.path;delete s.path}Ln("get",e,s).then(function(){Wt(e)});return}const l=H(n,/HX-Refresh:/i)&&n.getResponseHeader("HX-Refresh")==="true";if(H(n,/HX-Redirect:/i)){e.keepIndicators=true;Q.location.href=n.getResponseHeader("HX-Redirect");l&&Q.location.reload();return}if(l){e.keepIndicators=true;Q.location.reload();return}const c=Fn(t,e);const u=Xn(n);const f=u.swap;let a=!!u.error;let h=Q.config.ignoreTitle||u.ignoreTitle;let d=u.select;if(u.target){e.target=Un(t,u.target)}var p=o.swapOverride;if(p==null&&u.swapOverride){p=u.swapOverride}if(H(n,/HX-Retarget:/i)){e.target=Un(t,n.getResponseHeader("HX-Retarget"))}if(H(n,/HX-Reswap:/i)){p=n.getResponseHeader("HX-Reswap")}var g=n.response;var m=le({shouldSwap:f,serverResponse:g,isError:a,ignoreTitle:h,selectOverride:d,swapOverride:p},e);if(u.event&&!ae(r,u.event,m))return;if(!ae(r,"htmx:beforeSwap",m))return;r=m.target;g=m.serverResponse;a=m.isError;h=m.ignoreTitle;d=m.selectOverride;p=m.swapOverride;e.target=r;e.failed=a;e.successful=!a;if(m.shouldSwap){if(n.status===286){lt(t)}Vt(t,function(e){g=e.transformResponse(g,n,t)});if(c.type){Gt()}var y=bn(t,p);if(!y.hasOwnProperty("ignoreTitle")){y.ignoreTitle=h}r.classList.add(Q.config.swappingClass);if(i){d=i}if(H(n,/HX-Reselect:/i)){d=n.getResponseHeader("HX-Reselect")}const x=ne(t,"hx-select-oob");const b=ne(t,"hx-select");ze(r,g,y,{select:d==="unset"?null:d||b,selectOOB:x,eventInfo:e,anchor:e.pathInfo.anchor,contextElement:t,afterSwapCallback:function(){if(H(n,/HX-Trigger-After-Swap:/i)){let e=t;if(!se(t)){e=te().body}Je(n,"HX-Trigger-After-Swap",e)}},afterSettleCallback:function(){if(H(n,/HX-Trigger-After-Settle:/i)){let e=t;if(!se(t)){e=te().body}Je(n,"HX-Trigger-After-Settle",e)}},beforeSwapCallback:function(){if(c.type){ae(te().body,"htmx:beforeHistoryUpdate",le({history:c},e));if(c.type==="push"){Wt(c.path);ae(te().body,"htmx:pushedIntoHistory",{path:c.path})}else{Zt(c.path);ae(te().body,"htmx:replacedInHistory",{path:c.path})}}}})}if(a){fe(t,"htmx:responseError",le({error:"Response Status Error Code "+n.status+" from "+e.pathInfo.requestPath},e))}}const jn={};function $n(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,n,r){return false},encodeParameters:function(e,t,n){return null}}}function _n(e,t){if(t.init){t.init(n)}jn[e]=le($n(),t)}function zn(e){delete jn[e]}function Jn(e,n,r){if(n==undefined){n=[]}if(e==undefined){return n}if(r==undefined){r=[]}const t=a(e,"hx-ext");if(t){ie(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){r.push(e.slice(7));return}if(r.indexOf(e)<0){const t=jn[e];if(t&&n.indexOf(t)<0){n.push(t)}}})}return Jn(ce(u(e)),n,r)}var Kn=false;te().addEventListener("DOMContentLoaded",function(){Kn=true});function Gn(e){if(Kn||te().readyState==="complete"){e()}else{te().addEventListener("DOMContentLoaded",e)}}function Wn(){if(Q.config.includeIndicatorStyles!==false){const e=Q.config.inlineStyleNonce?` nonce="${Q.config.inlineStyleNonce}"`:"";const t=Q.config.indicatorClass;const n=Q.config.requestClass;te().head.insertAdjacentHTML("beforeend",`<style${e}>`+`.${t}{opacity:0;visibility: hidden} `+`.${n} .${t}, .${n}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`+"</style>")}}function Zn(){const e=te().querySelector('meta[name="htmx-config"]');if(e){return v(e.content)}else{return null}}function Yn(){const e=Zn();if(e){Q.config=le(Q.config,e)}}Gn(function(){Yn();Wn();let e=te().body;Mt(e);const t=te().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){const t=e.target;const n=oe(t);if(n&&n.xhr){n.xhr.abort()}});const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){if(e.state&&e.state.htmx){en();ie(t,function(e){ae(e,"htmx:restored",{document:te(),triggerEvent:ae})})}else{if(n){n(e)}}};b().setTimeout(function(){ae(e,"htmx:load",{});e=null},0)});return Q}();
|
|
1
|
+
var htmx=(()=>{class e{#e=null;#t=[];issue(e,t){return this.#e?"replace"===t?(this.#t.map(e=>e.status="dropped"),this.#t=[],this.#e&&this.#e.abort(),!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.map(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.abort?.()}more(){return this.#t?.length}}return new class{#r=new Map;#i=new Set;#s;#n;#a="a,form";#o=["get","post","put","patch","delete"];#l;#h;#u;constructor(){this.#d(),this.#c(),this.#n=`[${this.#p("hx-action")}],[${this.#p("hx-get")}],[${this.#p("hx-post")}],[${this.#p("hx-put")}],[${this.#p("hx-patch")}],[${this.#p("hx-delete")}]`,this.#l=(new XPathEvaluator).createExpression(`.//*[@*[ starts-with(name(), "${this.#p("hx-on:")}")]]`),this.#s={attributeValue:this.#f.bind(this),parseTriggerSpecs:this.#m.bind(this),determineMethodAndAction:this.#g.bind(this),createRequestContext:this.#x.bind(this),collectFormData:this.#b.bind(this),handleHxVals:this.#y.bind(this)},document.addEventListener("DOMContentLoaded",()=>{this.#v(),this.process(document.body)})}#d(){this.config={logAll:!1,prefix:"",transitions:!0,history:!0,historyReload:!1,mode:"same-origin",defaultSwap:"innerHTML",indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",streams:{mode:"once",maxRetries:1/0,initialDelay:500,maxDelay:3e4,pauseHidden:!1},morphIgnore:["data-htmx-powered"],noSwap:[204]};let e=document.querySelector('meta[name="htmx:config"]');if(e){let t=JSON.parse(e.content);for(let e in t){let r=t[e];r&&"object"==typeof r&&!Array.isArray(r)&&this.config[e]?Object.assign(this.config[e],r):this.config[e]=r}}this.#i=new Set(this.config.extensions.split(",").map(e=>e.trim()).filter(Boolean))}#c(){if(!1!==this.config.includeIndicatorCSS){let e="";this.config.inlineStyleNonce&&(e=` nonce="${this.config.inlineStyleNonce}"`);let t=this.config.indicatorClass,r=this.config.requestClass;document.head.insertAdjacentHTML("beforeend",`<style${e}>.${t}{opacity:0;visibility: hidden} .${r} .${t}, .${r}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}</style>`)}}defineExtension(e,t){if(!this.#i.delete(e))return!1;t.init&&t.init(this.#s),Object.entries(t).forEach(([e,t])=>{this.#r.get(e)?.push(t)||this.#r.set(e,[t])})}#S(e){return!e.closest||null!=e.closest(`[${this.#p("hx-ignore")}]`)}#p(e){return this.config.prefix?e.replace("hx-",this.config.prefix):e}#E(e,t){let r=[...e.querySelectorAll(t)];return e.matches?.(t)&&r.unshift(e),r}#w(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#f(e,t,r){let i=(t=this.#p(t))+":append",s=t+":inherited",n=t+":inherited:append";if(e.hasAttribute(t)||e.hasAttribute(s))return e.getAttribute(t)||e.getAttribute(s);if(e.hasAttribute(i)||e.hasAttribute(n)){let r=e.getAttribute(i)||e.getAttribute(n),a=e.parentNode?.closest?.(`[${CSS.escape(s)}],[${CSS.escape(n)}]`);if(a){let e=this.#f(a,t);return e?e+","+r:r}return r}let a=e.parentNode?.closest?.(`[${CSS.escape(s)}],[${CSS.escape(n)}]`);return a?this.#f(a,t):r}#q(e){let t=[],r=0;for(;r<e.length;){let i=e[r];if('"'===i||"'"===i){let s=i,n=i;for(r++;r<e.length;)if(i=e[r],n+=i,r++,"\\"===i&&r<e.length)n+=e[r],r++;else if(i===s)break;t.push(n)}else if(/\s/.test(i))for(;r<e.length&&/\s/.test(e[r]);)r++;else if(":"===i||","===i)t.push(i),r++;else{let i="";for(;r<e.length&&!/[\s"':,]/.test(e[r]);)i+=e[r++];t.push(i)}}return t}#m(e){let t=[],r=null,i=this.#q(e);for(let e=0;e<i.length;e++){let s=i[e];if(","===s)r=null;else if(r)":"===i[e+1]?r[s]=i[e+=2]:r[s]=!0;else{for(;s.includes("[")&&!s.includes("]")&&e+1<i.length;)s+=i[++e];if(s.includes("[")&&!s.includes("]"))throw"unterminated:"+s;r={name:s},t.push(r)}}return t}#g(e,t){if(this.#A(e))return this.#T(e,t);{let t=this.#f(e,"hx-method")||"get",r=this.#f(e,"hx-action");if(!r)for(let i of this.#o){let s=this.#f(e,"hx-"+i);if(s){r=s,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#T(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET"}}#C(e){this.#N(e)&&this.#H(e,"htmx:before:init",{},!0)&&(e._htmx={eventHandler:this.#M(e)},e.setAttribute("data-htmx-powered","true"),this.#O(e),this.#I(e),this.#k(e),this.#H(e,"htmx:after:init",{},!0),this.#H(e,"load",{},!1))}#M(e){return async t=>{try{let r=this.#x(e,t);await this.#L(r)}catch(e){console.error(e)}}}#x(e,t){let{action:r,method:i}=this.#g(e,t),s={sourceElement:e,sourceEvent:t,status:"created",select:this.#f(e,"hx-select"),selectOOB:this.#f(e,"hx-select-oob"),target:this.#f(e,"hx-target"),swap:this.#f(e,"hx-swap",this.config.defaultSwap),push:this.#f(e,"hx-push-url"),replace:this.#f(e,"hx-replace-url"),transition:this.config.transitions,request:{validate:"true"===this.#f(e,"hx-validate",e.matches("form")?"true":"false"),action:r,method:i,headers:this.#V(e)}},n=this.#f(e,"hx-config");if(n){let e=JSON.parse(n),t=s.request;for(let r in e)if(r.startsWith("+")){let i=r.substring(1);t[i]&&"object"==typeof s[i]?Object.assign(s[i],e[r]):t[i]=e[r]}else t[r]=e[r]}return s}#V(e){let t={"HX-Request":"true",Accept:"text/html, text/event-stream"};this.#A(e)&&(t["HX-Boosted"]="true");let r=this.#f(e,"hx-headers");return r&&Object.assign(t,JSON.parse(r)),t}#D(e,t){return t instanceof Element?t:"this"===t?e.hasAttribute(this.#p("hx-target"))?e:e.closest(`[${this.#p("hx-target")}\\:inherited='this']`):null!=t?this.find(e,t):this.#A(e)?document.body:e}#A(e){return e._htmx?.boosted}async#L(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#R(r))return;this.#_(r)&&r.preventDefault(),e.target=this.#D(t,e.target);let i=t.form||t.closest("form"),s=this.#b(t,i,r.submitter);if(this.#y(t,s),e.values)for(let t in e.values)s.delete(t),s.append(t,e.values[t]);let n=new AbortController,a=e.request.action.replace?.(/#.*$/,"");if(Object.assign(e.request,{originalAction:e.request.action,action:a,form:i,submitter:r.submitter,abort:n.abort.bind(n),body:s,credentials:"same-origin",signal:n.signal,mode:this.config.mode}),!this.#H(t,"htmx:config:request",{ctx:e}))return;if(!this.#o.includes(e.request.method.toLowerCase()))return;if(e.request.validate&&e.request.form&&!e.request.form.reportValidity())return;let o=this.#B(e.request.action);if(o){let t=Object.fromEntries(e.request.body);return void await this.#j(e.sourceElement,t,o,!1)}if(/GET|DELETE/.test(e.request.method)){let t=new URLSearchParams(e.request.body);t.size&&(e.request.action+=(/\?/.test(e.request.action)?"&":"?")+t),e.request.body=null}else"multipart/form-data"!==this.#f(t,"hx-encoding")&&(e.request.body=new URLSearchParams(e.request.body));await this.#$(e)}async#$(e){let t=e.sourceElement,r=this.#z(t),i=this.#P(t);if(!i.issue(e,r))return;e.status="issuing",this.#F(e);let s=this.#f(t,"hx-indicator"),n=this.#Q(t,s),a=this.#f(t,"hx-disable"),o=this.#U(t,a);try{let r=this.#f(t,"hx-confirm");if(r){let t=this.#B(r);if(t){if(!await this.#j(e.elt,{},t,!0))return}else if(!window.confirm(r))return}if(e.fetch||=window.fetch,!this.#H(t,"htmx:before:request",{ctx:e}))return;let i=await(e.fetchOverride||e.fetch(e.request.action,e.request));if(e.response={raw:i,status:i.status,headers:i.headers},this.#W(e),!this.#H(t,"htmx:after:request",{ctx:e}))return;if(this.#J(e))return;let s=i.headers.get("Content-Type")?.includes("text/event-stream");s?await this.#G(e,t,i):(e.text=await i.text(),"issuing"===e.status&&(e.hx.retarget&&(e.target=this.#D(t,e.hx.retarget)),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#K(e),this.#X(e),await this.swap(e),this.#Y(e),e.status="swapped"))}catch(r){e.status="error: "+r,this.#H(t,"htmx:error",{ctx:e,error:r})}finally{this.#Z(n),this.#ee(o),this.#H(t,"htmx:finally:request",{ctx:e}),i.finish(),i.more()&&this.#$(i.next())}}#W(e,t){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#J(e){if(e.hx.trigger&&this.#te(e.hx.trigger,e.sourceElement),"true"===e.hx.refresh)return location.reload(),!0;if(e.hx.redirect)return location.href=e.hx.redirect,!0;if(e.hx.location){let t=e.hx.location,r={};return"{"===t[0]&&(r=JSON.parse(t),t=r.path,delete r.path),r.push=r.push||"true",this.ajax("GET",t,r),!0}}async#G(e,t,r){let i=t._htmx?.streamConfig||{...this.config.streams},s=()=>new Promise(e=>{let t=()=>!document.hidden&&(document.removeEventListener("visibilitychange",t),e());document.addEventListener("visibilitychange",t)}),n=null,a=0,o=r;for(;t.isConnected;){if(a>0){if("continuous"!==i.mode||a>i.maxRetries)break;if(i.pauseHidden&&document.hidden&&(await s(),!t.isConnected))break;let r={attempt:a,delay:Math.min(i.initialDelay*Math.pow(2,a-1),i.maxDelay),lastEventId:n,cancelled:!1};if(e.status="reconnecting to stream",!this.#H(t,"htmx:before:sse:reconnect",{ctx:e,reconnect:r})||r.cancelled)break;if(await new Promise(e=>setTimeout(e,r.delay)),!t.isConnected)break;try{n&&((e.request.headers=e.request.headers||{})["Last-Event-ID"]=n),o=await fetch(e.request.action,e.request)}catch(r){e.status="stream error",this.#H(t,"htmx:error",{ctx:e,error:r}),a++;continue}}if(!this.#H(t,"htmx:before:sse:stream",{ctx:e}))break;e.status="streaming",a=0;try{for await(const r of this.#re(o)){if(!t.isConnected)break;if(i.pauseHidden&&document.hidden&&(await s(),!t.isConnected))break;let a={data:r.data,event:r.event,id:r.id,cancelled:!1};this.#H(t,"htmx:before:sse:message",{ctx:e,message:a})&&!a.cancelled&&(r.id&&(n=r.id),r.event?(this.#H(t,r.event,{data:r.data,id:r.id}),this.#H(t,"htmx:after:sse:message",{ctx:e,message:a})):(e.text=r.data,e.status="stream message received",e.response.cancelled||(this.#X(e),await this.swap(e),this.#Y(e),e.status="swapped"),this.#H(t,"htmx:after:sse:message",{ctx:e,message:a})))}}catch(r){e.status="stream error",this.#H(t,"htmx:error",{ctx:e,error:r})}if(!t.isConnected)break;this.#H(t,"htmx:after:sse:stream",{ctx:e}),a++}}async*#re(e){let t,r,i,s,n,a=e.body.getReader(),o=new TextDecoder,l="",h={data:"",event:"",id:"",retry:null};try{for(;;){let{done:e,value:u}=await a.read();if(e)break;for(let e of(l+=o.decode(u,{stream:1}),t=l.split("\n"),l=t.pop()||"",t))e&&"\r"!==e?(r=e.indexOf(":"))>0&&(s=e.slice(0,r),n=e.slice(r+1).trimStart(),"data"===s?h.data+=(h.data?"\n":"")+n:"event"===s?h.event=n:"id"===s?h.id=n:"retry"===s&&(i=parseInt(n,10),!isNaN(i))&&(h.retry=i)):h.data&&(yield h,h={data:"",event:"",id:"",retry:null})}}finally{a.releaseLock()}}#F(e){let t;t=e.request.timeout?"string"==typeof e.request.timeout?this.parseInterval(e.request.timeout):e.request.timeout:this.config.defaultTimeout,e.requestTimeout=setTimeout(()=>e.abort?.(),t)}#z(e){let t=this.#f(e,"hx-sync");return t?.split(":")[1]||"queue first"}#P(t){let r=this.#f(t,"hx-sync"),i=t;if(r&&r.includes(":")){let e=r.split(":")[0];i=this.#ie(e)}return i._htmxRequestQueue||=new e}#R(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)}#_(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#O(e,t=e._htmx.eventHandler){let r=this.#f(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]),select,textarea")?"change":"click"),e._htmx.triggerSpecs=this.#m(r),e._htmx.listeners=[];for(let r of e._htmx.triggerSpecs){r.handler=t,r.listeners=[],r.values={};let[i,s]=this.#se(r.name);if(r.once){let e=r.handler;r.handler=t=>{e(t);for(let e of r.listeners)e.fromElt.removeEventListener(e.eventName,e.handler)}}if("intersect"===i||"revealed"===i){let t={};r.opts?.root&&(t.root=this.#ie(e,r.opts.root)),r.opts?.threshold&&(t.threshold=parseFloat(r.opts.threshold));let s="revealed"===i;r.observer=new IntersectionObserver(t=>{for(let i=0;i<t.length;i++){if(t[i].isIntersecting){this.trigger(e,"intersect",{},!1),s&&r.observer.disconnect();break}}},t),i="intersect",r.observer.observe(e)}if(r.delay){let e=r.handler;r.handler=t=>{clearTimeout(r.timeout),r.timeout=setTimeout(()=>e(t),this.parseInterval(r.delay))}}if(r.throttle){let e=r.handler;r.handler=t=>{r.throttled?r.throttledEvent=t:(r.throttled=!0,e(t),r.throttleTimeout=setTimeout(()=>{if(r.throttled=!1,r.throttledEvent){let e=r.throttledEvent;r.throttledEvent=null,r.handler(e)}},this.parseInterval(r.throttle)))}}if(r.target){let e=r.handler;r.handler=t=>{t.target?.matches?.(r.target)&&e(t)}}if("every"===i){let t=Object.keys(r).find(e=>"name"!==e);r.interval=setInterval(()=>{e.isConnected?this.#H(e,"every",{},!1):clearInterval(r.interval)},this.parseInterval(t))}if(s){let t=r.handler;r.handler=r=>{this.#_(r)&&r.preventDefault(),this.#ne(e,r,s)&&t(r)}}let n=[e];if(r.from&&(n=this.#ae(e,r.from)),r.consume){let e=r.handler;r.handler=t=>{t.stopPropagation(),e(t)}}if(r.changed){let e=r.handler;r.handler=t=>{let i=!1;for(let e of n)r.values[e]!==e.value&&(i=!0,r.values[e]=e.value);i&&e(t)}}for(let t of n){let s={fromElt:t,eventName:i,handler:r.handler};e._htmx.listeners.push(s),r.listeners.push(s),t.addEventListener(i,r.handler)}}}#I(e){let t=this.#f(e,"hx-stream");if(!t)return;let r={...this.config.streams},i=this.#q(t);for(let e=0;e<i.length;e++){let t=i[e];if("once"===t||"continuous"===t)r.mode=t;else if("pauseHidden"===t)r.pauseHidden=!0;else if(":"===i[e+1]){let s=t,n=i[e+2];"mode"===s?r.mode=n:"maxRetries"===s?r.maxRetries=parseInt(n):"initialDelay"===s?r.initialDelay=this.parseInterval(n):"maxDelay"===s?r.maxDelay=this.parseInterval(n):"pauseHidden"===s&&(r.pauseHidden="true"===n),e+=2}}e._htmx||(e._htmx={}),e._htmx.streamConfig=r}#se(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#te(e,t){if("{"===e[0]){let r=JSON.parse(e);for(let e in r){let i=r[e];i?.target&&(t=this.find(i.target)||t),this.trigger(t,e,"object"==typeof i?i:{value:i})}}else e.split(",").forEach(e=>this.trigger(t,e.trim(),{}))}#oe(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}async#j(e,t,r,i=!0){let s={};Object.assign(s,this.#oe(e)),Object.assign(s,t);let n=Object.keys(s),a=Object.values(s),o=new(0,Object.getPrototypeOf(async function(){}).constructor)(...n,i?`return (${r})`:r);return await o.call(e,...a)}#ne(e,t,r){let i={};Object.assign(i,this.#oe(e));for(let e in t)i[e]=t[e];let s=Object.keys(i),n=Object.values(i);return new Function(...s,`return (${r})`).call(e,...n)}process(e){if(!e||this.#S(e))return;if(!this.#H(e,"htmx:before:process"))return;for(let t of this.#E(e,this.#n))this.#C(t);for(let t of this.#E(e,this.#a))this.#le(t);this.#he(e);let t=this.#l.evaluate(e),r=null;for(;r=t.iterateNext();)this.#he(r);this.#H(e,"htmx:after:process")}#le(e){"true"===this.#f(e,"hx-boost")&&this.#N(e)&&(e._htmx={eventHandler:this.#M(e),requests:[],boosted:!0},e.setAttribute("data-htmx-powered","true"),e.matches("a")&&!e.hasAttribute("target")?e.addEventListener("click",t=>{e._htmx.eventHandler(t)}):e.addEventListener("submit",t=>{e._htmx.eventHandler(t)}))}#N(e){return!e._htmx&&!this.#S(e)}#ue(e){if(e._htmx){this.#H(e,"htmx:before:cleanup"),e._htmx.interval&&clearInterval(e._htmx.interval);for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout);for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler);this.#H(e,"htmx:after:cleanup")}for(let t of e.querySelectorAll("[data-htmx-powered]"))this.#ue(t)}#de(e){let t=document.createElement("div");t.style.display="none",document.body.appendChild(t);let r=e.querySelectorAll?.(`[${this.#p("hx-preserve")}]`)||[];for(let e of r){let r=document.getElementById(e.id);t.moveBefore?t.moveBefore(r,null):t.appendChild(r)}return t}#ce(e){for(let t of e.children){let e=document.getElementById(t.id);e.parentNode.moveBefore?e.parentNode.moveBefore(t,e):e.replaceWith(t),this.#ue(e),e.remove()}e.remove()}#pe(e){return Document.parseHTMLUnsafe?.(e)||(new DOMParser).parseFromString(e,"text/html")}#fe(e){let t,r,i=e.replace(/<partial(\s+|>)/gi,"<template partial$1").replace(/<\/partial>/gi,"</template>"),s=i.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,""),n=s.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();return"html"===n?(t=this.#pe(i),r=t.body):"body"===n?(t=this.#pe(s),r=t.body):(t=this.#pe(`<template>${s}</template>`),r=t.querySelector("template").content),{fragment:r,title:t.title}}#me(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;if("true"!==r&&r&&!r.includes(" ")){let e=r.indexOf(":");-1!==e&&(s=r.substring(e+1),r=r.substring(0,e))}"true"!==r&&r||(r="outerHTML");let n=this.#ge(r);n.target&&(s=n.target);let a,o=t.cloneNode(!0);void 0===n.strip&&"outerHTML"!==n.style&&(n.strip=!0),n.strip?a=o.content||o:(a=document.createDocumentFragment(),a.appendChild(o)),t.remove(),(s||r.includes("target:"))&&e.push({type:"oob",fragment:a,target:s,swapSpec:n,sourceElement:i})}#xe(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,...n]=s.split(":"),a=n.length?n.join(":"):"true";for(let s of e.querySelectorAll(r))this.#me(i,s,a,t)}for(let r of e.querySelectorAll(`[${this.#p("hx-swap-oob")}]`)){let e=r.getAttribute(this.#p("hx-swap-oob"));r.removeAttribute(this.#p("hx-swap-oob")),this.#me(i,r,e,t)}return i}#be(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#ge(e){let t=this.#q(e),r={style:":"===t[1]?this.config.defaultSwap:t[0]||this.config.defaultSwap};r.style=this.#w(r.style);for(let e=":"===t[1]?0:1;e<t.length;e++)if(":"===t[e+1]){let i=t[e],s=t[e+=2];if("swap"===i)r.swapDelay=this.parseInterval(s);else if("transition"===i||"ignoreTitle"===i||"strip"===i)r[i]="true"===s;else if("focus-scroll"===i)r.focusScroll="true"===s;else if("scroll"===i||"show"===i){let n=[s];for(;":"===t[e+1];)n.push(t[e+2]),e+=2;r[i]=1===n.length?n[0]:n.pop(),n.length>1&&(r[i+"Target"]=n.join(":"))}else if("target"===i){let n=[s];for(;e+1<t.length&&":"!==t[e+1]&&":"!==t[e+2];)n.push(t[e+1]),e++;r[i]=n.join(" ")}}return r}#ye(e,t){let r=[];for(let i of e.querySelectorAll("template[partial]")){let e=this.#ge(i.getAttribute(this.#p("hx-swap"))||this.config.defaultSwap);r.push({type:"partial",fragment:i.content.cloneNode(!0),target:i.getAttribute(this.#p("hx-target")),swapSpec:e,sourceElement:t}),i.remove()}return r}#ve(e,t){"top"===t?e.scrollTop=0:"bottom"===t&&(e.scrollTop=e.scrollHeight)}#Y(e){let t=e.request.originalAction?.split("#")[1];t&&document.getElementById(t)?.scrollIntoView({block:"start",behavior:"auto"})}#Se(e){let t=this.#E(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=e.textContent,e.replaceWith(t)}}async swap(e){let{fragment:t,title:r}=this.#fe(e.text),i=[],s=this.#xe(t,e.sourceElement,e.selectOOB),n=this.#ye(t,e.sourceElement);i.push(...s,...n);let a=this.#Ee(e,t,n,r);if(a&&i.push(a),0===i.length)return;let o=i.filter(e=>e.transition),l=i.filter(e=>!e.transition);if(this.#H(document,"htmx:before:swap",{ctx:e,tasks:i})){for(let e of l)e.swapSpec?.swapDelay?setTimeout(()=>this.#we(e),e.swapSpec.swapDelay):this.#we(e);if(o.length>0){let e=()=>{for(let e of o)this.#we(e)};await this.#qe(e)}this.#H(document,"htmx:after:swap",{ctx:e}),a?.title&&(document.title=a.title),await this.timeout(1);for(let e of i)for(let t of e.restoreTasks||[])t();this.#H(document,"htmx:after:restore",{ctx:e})}}#Ee(e,t,r,i){let s=this.#ge(e.swap||this.config.defaultSwap);if("delete"===s.style||/\S/.test(t.innerHTML||"")||!r.length){let r=document.createDocumentFragment();if(e.select){let i=t.querySelector(e.select);i&&(!1===s.strip?r.append(i):r.append(...i.childNodes))}else r.append(...t.childNodes);return{type:"main",fragment:r,target:s.target||e.target,swapSpec:s,sourceElement:e.sourceElement,transition:!1!==e.transition&&!1!==s.transition,title:i}}}#we(e){let{target:t,swapSpec:r,fragment:i}=e;if("string"==typeof t&&(t=document.querySelector(t)),!t)return;let s=this.#de(i);this.#Se(i);let n=t.parentNode,a=[...i.childNodes];if("innerHTML"===r.style){this.#Ae(e,t);for(const e of t.children)this.#ue(e);t.replaceChildren(...i.childNodes)}else if("outerHTML"===r.style)n&&(this.#Ae(e,n),this.#be(n,t,i),this.#ue(t),n.removeChild(t));else if("innerMorph"===r.style)this.#Te(t,i,!0);else if("outerMorph"===r.style)this.#Te(t,i,!1);else if("beforebegin"===r.style)n&&this.#be(n,t,i);else if("afterbegin"===r.style)this.#be(t,t.firstChild,i);else if("beforeend"===r.style)this.#be(t,null,i);else{if("afterend"!==r.style){if("delete"===r.style)return void(n&&(this.#ue(t),n.removeChild(t)));if("none"===r.style)return;if(this.#Ce(t,"htmx:handle:swap",e))throw new Error(`Unknown swap style: ${r.style}`);return}n&&this.#be(n,t.nextSibling,i)}this.#ce(s);for(const e of a)this.process(e);r.scroll&&this.#ve(t,r.scroll)}#H(e,t,r={},i=!0){return this.config.logAll&&console.log(t,r,e),this.trigger(e,t,r,i)}#Ce(e,t,r={}){let i=this.#r.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if("string"==typeof e&&(e=this.parseInterval(e)),e>0)return new Promise(t=>setTimeout(t,e))}forEvent(e,t,r=document){return new Promise((i,s)=>{let n=e=>{clearTimeout(a),i(e)},a=t&&setTimeout(()=>{r.removeEventListener(e,n),i(null)},t);r.addEventListener(e,n,{once:!0})})}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#Ne(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#ie(e,t)}findAll(e,t){return this.#ae(e,t)}parseInterval(e){let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Ne(e),this.#Ce(e,t,r);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0,originalTarget:e}),n=e.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source,s=r.target?this.#D(i||document.body,r.target):i;if(r.target&&!s||r.source&&!i)return Promise.reject(new Error("Element not found"));i=i||s||document.body;let n=this.#x(i,r.event||{});return Object.assign(n,r,{target:s}),Object.assign(n.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(n.request.headers,r.headers),this.#L(n)}#v(){this.config.history&&window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&this.#He()})}#Me(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#H(document,"htmx:after:push:into:history",{path:e}))}#Oe(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#H(document,"htmx:after:replace:into:history",{path:e}))}#He(e){e=e||location.pathname+location.search,this.#H(document,"htmx:before:restore:history",{path:e,cacheMiss:!0})&&(this.config.historyReload?location.reload():this.ajax("GET",e,{target:"body",swap:"outerHTML",request:{headers:{"HX-History-Restore-Request":"true"}}}))}#X(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;(s?.push||s?.pushurl||s?.replaceurl)&&(r=s.push||s.pushurl,i=s.replaceurl),r||i||!this.#A(t)||(r="true");let a=r||i;if(!a||"false"===a)return;"true"===a&&(a=e.request.originalAction);let o=r?"push":"replace",l={history:{type:o,path:a},sourceElement:t,response:n};this.#H(document,"htmx:before:history:update",l)&&("push"===o?this.#Me(a):this.#Oe(a),this.#H(document,"htmx:after:history:update",l))}#he(e){for(let t of e.getAttributeNames())if(t.startsWith(this.#p("hx-on:"))){let r=t.substring(this.#p("hx-on:").length),i=e.getAttribute(t);e.addEventListener(r,async t=>{try{await this.#j(e,{event:t},i,!1)}catch(e){console.log(e)}})}}#Q(e,t){let r=[];if(t){r=[e,...this.#E(e,t)];for(const e of r)e._htmxReqCount||=0,e._htmxReqCount++,e.classList.add(this.config.requestClass)}return r}#Z(e){for(let t of e)t._htmxReqCount&&(t._htmxReqCount--,t._htmxReqCount<=0&&(t.classList.remove(this.config.requestClass),delete t._htmxReqCount))}#U(e,t){let r=[];if(t){r=this.#E(e,t);for(let e of r)e._htmxDisableCount||=0,e._htmxDisableCount++,e.disabled=!0}return r}#ee(e){for(const t of e)t._htmxDisableCount&&(t._htmxDisableCount--,t._htmxDisableCount<=0&&(t.disabled=!1,delete t._htmxDisableCount))}#b(e,t,r){let i=new FormData,s=new Set;t?this.#Ie(t,s,i):e.name&&(i.append(e.name,e.value),s.add(e)),r&&r.name&&(i.append(r.name,r.value),s.add(r));let n=this.#f(e,"hx-include");if(n){let t=this.#ae(e,n);for(let e of t)this.#Ie(e,s,i)}return i}#Ie(e,t,r){let i=this.#E(e,"input:not([disabled]), select:not([disabled]), textarea:not([disabled])");for(let e of i)if(e.name&&!t.has(e))if(t.add(e),e.matches("input[type=checkbox], input[type=radio]"))e.checked&&r.append(e.name,e.value);else if(e.matches("input[type=file]"))for(let t of e.files)r.append(e.name,t);else if(e.matches("select[multiple]"))for(let t of e.selectedOptions)r.append(e.name,t.value);else e.matches("select, textarea, input")&&r.append(e.name,e.value)}#y(e,t){let r=this.#f(e,"hx-vals");if(r){r.includes("{")||(r=`{${r}}`);let e=JSON.parse(r);for(let r in e)t.append(r,e[r])}}#ke(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#ae(e,t,r){let[i,s]=this.#Le(e,t);if(s.startsWith("global "))return this.#ae(i,s.slice(7),!0);let n=this.#Ve(s),a=[],o=[];for(const e of n){let t,s=this.#ke(e);s.startsWith("closest ")?t=i.closest(s.slice(8)):s.startsWith("find ")?t=document.querySelector(i,s.slice(5)):"next"===s||"nextElementSibling"===s?t=i.nextElementSibling:s.startsWith("next ")?t=this.#De(i,s.slice(5),!!r):"previous"===s||"previousElementSibling"===s?t=i.previousElementSibling:s.startsWith("previous ")?t=this.#Re(i,s.slice(9),!!r):"document"===s?t=document:"window"===s?t=window:"body"===s?t=document.body:"root"===s?t=this.#_e(i,!!r):"host"===s?t=i.getRootNode().host:o.push(s),t&&a.push(t)}if(o.length>0){let e=o.join(","),t=this.#_e(i,!!r);a.push(...t.querySelectorAll(e))}return a}#Le(e,t){return void 0===t?[document,e]:[this.#Ne(e),t]}#Ve(e){let t=[],r=0,i=0;for(let s=0;s<=e.length;s++){let n=e[s];"<"===n?r++:"/"===n&&">"===e[s+1]?r--:(","===n&&!r||s===e.length)&&(s>i&&t.push(e.substring(i,s)),i=s+1)}return t}#De(e,t,r){return this.#Be(this.#_e(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#Re(e,t,r){let i=[...this.#_e(e,r).querySelectorAll(t)].reverse();return this.#Be(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#Be(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#_e(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#ie(e,t){return this.#ae(e,t)[0]}#B(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#k(e){e.addEventListener("htmx:abort",()=>{this.#P(e).abort()})}#Te(e,t,r){let{persistentIds:i,idMap:s}=this.#je(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let a={target:e,idMap:s,persistentIds:i,pantry:n};r?this.#$e(a,e,t):this.#$e(a,e.parentNode,t,e,e.nextSibling),this.#ue(n),n.remove()}#$e(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;for(const n of r.childNodes){if(i&&i!=s){let t=this.#ze(e,n,i,s);if(t){if(t!==i){let r=i;for(;r&&r!==t;){let t=r;r=r.nextSibling,this.#Pe(e,t)}}this.#Fe(t,n,e),i=t.nextSibling;continue}}if(n instanceof Element&&e.persistentIds.has(n.id)){let r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${n.id}"]`)||e.pantry.querySelector(`[id="${n.id}"]`),s=r.id,a=r;for(;a=a.parentNode;){let t=e.idMap.get(a);t&&(t.delete(s),t.size||e.idMap.delete(a))}this.#Qe(t,r,i),this.#Fe(r,n,e),i=r.nextSibling;continue}let r;e.idMap.has(n)?(r=document.createElement(n.tagName),t.insertBefore(r,i),this.#Fe(r,n,e)):(r=document.importNode(n,!0),t.insertBefore(r,i)),i=r.nextSibling}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#Pe(e,t)}}#ze(e,t,r,i){let s=null,n=t.nextSibling,a=0,o=0,l=e.idMap.get(t),h=l?.size||0,u=r;for(;u&&u!=i;){let r=e.idMap.get(u);if(this.#Ue(u,t)){if(r&&l&&[...r].some(e=>l.has(e)))return u;if(null===s&&!r){if(!h)return u;s=u}}if(o+=r?.size||0,o>h)break;if(null===s&&n&&this.#Ue(u,n)&&(a++,n=n.nextSibling,a>=2&&(s=void 0)),u.contains(document.activeElement))break;u=u.nextSibling}return s||null}#Ue(e,t){return e.nodeType===t.nodeType&&e.tagName===t.tagName&&(!e.id||e.id===t.id)}#Pe(e,t){e.idMap.has(t)?this.#Qe(e.pantry,t,null):(this.#ue(t),t.remove())}#Qe(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#Fe(e,t,r){let i=t.nodeType;if(1===i){let r=this.config.morphIgnore||[];this.#We(e,t,r),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value)}8!==i&&3!==i||e.nodeValue===t.nodeValue||(e.nodeValue=t.nodeValue),e.isEqualNode(t)||this.#$e(r,e,t)}#We(e,t,r=[]){for(const i of t.attributes)r.includes(i.name)||e.getAttribute(i.name)===i.value||(e.setAttribute(i.name,i.value),"value"===i.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=i.value));for(let i=e.attributes.length-1;i>=0;i--){let s=e.attributes[i];!s||t.hasAttribute(s.name)||r.includes(s.name)||e.removeAttribute(s.name)}}#Je(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#je(e,t){let r=this.#E(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#Ge(r,i),n=new Map;return this.#Je(n,s,e.parentElement,r),this.#Je(n,s,t,i),{persistentIds:s,idMap:n}}#Ge(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#K(e){let t=e.response.raw.status;this.config.noSwap.includes(t)&&(e.swap="none");let r=t+"";for(let t of[r,r.slice(0,2)+"x",r[0]+"xx"]){let r=this.#f(e.sourceElement,"hx-status:"+t);if(r)return void(e.swap=r)}}#qe(e){return new Promise(t=>{this.#h||=[],this.#h.push({task:e,resolve:t}),this.#u||this.#Ke()})}async#Ke(){if(0===this.#h.length||this.#u)return;this.#u=!0;let{task:e,resolve:t}=this.#h.shift();try{if(document.startViewTransition){let t=document.startViewTransition(e).finished;this.#H(document,"htmx:before:viewTransition",{task:e,finished:t}),await t,this.#H(document,"htmx:after:viewTransition",{task:e})}else e()}catch(e){}finally{this.#u=!1,t(),this.#Ke()}}#Ae(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.fragment.querySelectorAll("[id]");e.restoreTasks=[];for(let t of s){let r=i[t.id];if(r?.tagName===t.tagName){let i=t.cloneNode(!1);this.#We(t,r,this.config.morphIgnore),e.restoreTasks.push(()=>{this.#We(t,i,this.config.morphIgnore)})}}}#Ne(e){return"string"==typeof e?this.find(e):e}}})();
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,101 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "htmx.org",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
],
|
|
8
|
-
"version": "2.0.7",
|
|
9
|
-
"homepage": "https://htmx.org/",
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/bigskysoftware/htmx/issues"
|
|
12
|
-
},
|
|
13
|
-
"license": "0BSD",
|
|
3
|
+
"version": "4.0.0-alpha1",
|
|
4
|
+
"description": "A hypermedia-oriented JavaScript library",
|
|
5
|
+
"main": "dist/htmx.js",
|
|
6
|
+
"module": "dist/htmx.esm.js",
|
|
14
7
|
"files": [
|
|
15
8
|
"LICENSE",
|
|
16
9
|
"README.md",
|
|
17
|
-
"dist/htmx.esm.d.ts",
|
|
18
10
|
"dist/*.js",
|
|
19
11
|
"dist/ext/*.js",
|
|
20
|
-
"dist/*.js.
|
|
21
|
-
"editors/jetbrains/htmx.web-types.json"
|
|
12
|
+
"dist/*.js.br",
|
|
13
|
+
"src/editors/jetbrains/htmx.web-types.json"
|
|
22
14
|
],
|
|
23
|
-
"main": "dist/htmx.esm.js",
|
|
24
|
-
"types": "dist/htmx.esm.d.ts",
|
|
25
|
-
"jsdelivr": "dist/htmx.min.js",
|
|
26
|
-
"unpkg": "dist/htmx.min.js",
|
|
27
|
-
"web-types": "editors/jetbrains/htmx.web-types.json",
|
|
28
15
|
"scripts": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"test
|
|
36
|
-
"test:chrome": "
|
|
37
|
-
"test:firefox": "
|
|
38
|
-
"test:webkit": "
|
|
39
|
-
"test:all": "
|
|
40
|
-
"test:
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"sha": "bash ./scripts/sha.sh"
|
|
16
|
+
"build": "npm run build:iife && npm run build:esm && npm run build:minify && npm run build:compress",
|
|
17
|
+
"build:iife": "sed 's/__/#/g' src/htmx.js > dist/htmx.js",
|
|
18
|
+
"build:esm": "sed 's/this\\.__/this.#/g; s/^ __/ #/g' src/htmx.js > dist/htmx.esm.js && echo '' >> dist/htmx.esm.js && echo 'export default htmx' >> dist/htmx.esm.js",
|
|
19
|
+
"build:minify": "terser --compress --mangle --source-map -o dist/htmx.min.js dist/htmx.js && terser --compress --mangle --source-map -o dist/htmx.esm.min.js dist/htmx.esm.js",
|
|
20
|
+
"build:compress": "brotli-cli compress dist/*.js",
|
|
21
|
+
|
|
22
|
+
"test": "npm run test:chrome",
|
|
23
|
+
"test:chrome": "web-test-runner --browsers chromium --config test/web-test-runner.config.mjs --playwright",
|
|
24
|
+
"test:firefox": "web-test-runner --browsers firefox --config test/web-test-runner.config.mjs --playwright",
|
|
25
|
+
"test:webkit": "web-test-runner --browsers webkit --config test/web-test-runner.config.mjs --playwright",
|
|
26
|
+
"test:all": "web-test-runner --browsers chromium firefox webkit --config test/web-test-runner.config.mjs --playwright --concurrency 1",
|
|
27
|
+
"test:manual": "node test/manual/server.js",
|
|
28
|
+
|
|
29
|
+
"publish": "npm publish --tag next --dry-run",
|
|
30
|
+
"merge": " (echo \"src/** merge=ours\ndist/** merge=ours\ntest/** merge=ours\n\" > .gitattributes && git add .gitattributes && git merge master); git reset HEAD .gitattributes 2>/dev/null; rm .gitattributes 2>/dev/null\n"
|
|
45
31
|
},
|
|
46
32
|
"repository": {
|
|
47
33
|
"type": "git",
|
|
48
|
-
"url": "
|
|
49
|
-
},
|
|
50
|
-
"eslintConfig": {
|
|
51
|
-
"extends": ["standard", "plugin:mocha/recommended"],
|
|
52
|
-
"rules": {
|
|
53
|
-
"mocha/consistent-spacing-between-blocks": 0,
|
|
54
|
-
"mocha/no-setup-in-describe": 0,
|
|
55
|
-
"mocha/no-skipped-tests": 0,
|
|
56
|
-
"camelcase": 0,
|
|
57
|
-
"no-var": 0,
|
|
58
|
-
"no-undef": 0,
|
|
59
|
-
"eqeqeq": 0,
|
|
60
|
-
"no-multi-str": 0,
|
|
61
|
-
"no-prototype-builtins": 0,
|
|
62
|
-
"no-cond-assign": 0,
|
|
63
|
-
"no-empty": 0,
|
|
64
|
-
"no-eval": 0,
|
|
65
|
-
"no-new-func": 0,
|
|
66
|
-
"no-redeclare": 0,
|
|
67
|
-
"no-return-assign": 0,
|
|
68
|
-
"no-unused-vars": 0,
|
|
69
|
-
"no-useless-call": 0,
|
|
70
|
-
"no-useless-escape": 0,
|
|
71
|
-
"no-unused-expressions": 0,
|
|
72
|
-
"no-restricted-properties": ["error", {
|
|
73
|
-
"property": "substr",
|
|
74
|
-
"message": "Use .slice or .substring instead of .substr"
|
|
75
|
-
}],
|
|
76
|
-
"space-before-function-paren": [
|
|
77
|
-
"error",
|
|
78
|
-
"never"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
34
|
+
"url": "https://github.com/bigskysoftware/htmx"
|
|
81
35
|
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"hypermedia",
|
|
38
|
+
"htmx",
|
|
39
|
+
"ajax",
|
|
40
|
+
"sse"
|
|
41
|
+
],
|
|
42
|
+
"workspaces": [
|
|
43
|
+
"ext/*"
|
|
44
|
+
],
|
|
45
|
+
"author": "Big Sky Software",
|
|
46
|
+
"license": "BSD-0-Clause",
|
|
82
47
|
"devDependencies": {
|
|
83
|
-
"@types/node": "20.0.0",
|
|
84
|
-
"@types/parse5": "^7.0.0",
|
|
85
48
|
"@web/test-runner": "^0.20.2",
|
|
86
49
|
"@web/test-runner-playwright": "^0.11.0",
|
|
50
|
+
"brotli-cli": "^2.1.1",
|
|
87
51
|
"chai": "^4.5.0",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"eslint-config-standard": "^17.1.0",
|
|
91
|
-
"eslint-plugin-import": "^2.29.1",
|
|
92
|
-
"eslint-plugin-mocha": "^10.5.0",
|
|
93
|
-
"fs-extra": "^9.1.0",
|
|
94
|
-
"mocha": "^11.1.0",
|
|
95
|
-
"mock-socket": "^9.3.1",
|
|
96
|
-
"sinon": "^10.0.1",
|
|
97
|
-
"typescript": "^5.5.4",
|
|
98
|
-
"uglify-js": "^3.19.3",
|
|
99
|
-
"ws": "^8.18.1"
|
|
52
|
+
"mocha": "^11.7.4",
|
|
53
|
+
"terser": "^5.36.0"
|
|
100
54
|
}
|
|
101
|
-
}
|
|
55
|
+
}
|
package/dist/ext/README.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Why Are These Files Here?
|
|
2
|
-
|
|
3
|
-
These are legacy extensions for htmx 1.x and are **NOT** actively maintained or guaranteed to work with htmx 2.x.
|
|
4
|
-
They are here because we unfortunately linked to unversioned unpkg URLs in the installation guides for them
|
|
5
|
-
in 1.x, so we need to keep them here to preserve those URLs and not break existing users functionality.
|
|
6
|
-
|
|
7
|
-
If you are looking for extensions for htmx 2.x, please see the [htmx 2.0 extensions site](https://htmx.org/extensions),
|
|
8
|
-
which has links to the new extensions repos (They have all been moved to their own NPM projects and URLs, like
|
|
9
|
-
they should have been from the start!)
|
package/dist/ext/ajax-header.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
if (htmx.version && !htmx.version.startsWith("1.")) {
|
|
2
|
-
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
|
3
|
-
". It is recommended that you move to the version of this extension found on https://htmx.org/extensions")
|
|
4
|
-
}
|
|
5
|
-
htmx.defineExtension('ajax-header', {
|
|
6
|
-
onEvent: function (name, evt) {
|
|
7
|
-
if (name === "htmx:configRequest") {
|
|
8
|
-
evt.detail.headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
});
|
package/dist/ext/alpine-morph.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
if (htmx.version && !htmx.version.startsWith("1.")) {
|
|
2
|
-
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
|
3
|
-
". It is recommended that you move to the version of this extension found on https://htmx.org/extensions")
|
|
4
|
-
}
|
|
5
|
-
htmx.defineExtension('alpine-morph', {
|
|
6
|
-
isInlineSwap: function (swapStyle) {
|
|
7
|
-
return swapStyle === 'morph';
|
|
8
|
-
},
|
|
9
|
-
handleSwap: function (swapStyle, target, fragment) {
|
|
10
|
-
if (swapStyle === 'morph') {
|
|
11
|
-
if (fragment.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
12
|
-
Alpine.morph(target, fragment.firstElementChild);
|
|
13
|
-
return [target];
|
|
14
|
-
} else {
|
|
15
|
-
Alpine.morph(target, fragment.outerHTML);
|
|
16
|
-
return [target];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
package/dist/ext/class-tools.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
|
|
3
|
-
if (htmx.version && !htmx.version.startsWith("1.")) {
|
|
4
|
-
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
|
5
|
-
". It is recommended that you move to the version of this extension found on https://htmx.org/extensions")
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function splitOnWhitespace(trigger) {
|
|
9
|
-
return trigger.split(/\s+/);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function parseClassOperation(trimmedValue) {
|
|
13
|
-
var split = splitOnWhitespace(trimmedValue);
|
|
14
|
-
if (split.length > 1) {
|
|
15
|
-
var operation = split[0];
|
|
16
|
-
var classDef = split[1].trim();
|
|
17
|
-
var cssClass;
|
|
18
|
-
var delay;
|
|
19
|
-
if (classDef.indexOf(":") > 0) {
|
|
20
|
-
var splitCssClass = classDef.split(':');
|
|
21
|
-
cssClass = splitCssClass[0];
|
|
22
|
-
delay = htmx.parseInterval(splitCssClass[1]);
|
|
23
|
-
} else {
|
|
24
|
-
cssClass = classDef;
|
|
25
|
-
delay = 100;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
operation: operation,
|
|
29
|
-
cssClass: cssClass,
|
|
30
|
-
delay: delay
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function performOperation(elt, classOperation, classList, currentRunTime) {
|
|
38
|
-
setTimeout(function () {
|
|
39
|
-
elt.classList[classOperation.operation].call(elt.classList, classOperation.cssClass);
|
|
40
|
-
}, currentRunTime)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function toggleOperation(elt, classOperation, classList, currentRunTime) {
|
|
44
|
-
setTimeout(function () {
|
|
45
|
-
setInterval(function () {
|
|
46
|
-
elt.classList[classOperation.operation].call(elt.classList, classOperation.cssClass);
|
|
47
|
-
}, classOperation.delay);
|
|
48
|
-
}, currentRunTime)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function processClassList(elt, classList) {
|
|
52
|
-
var runs = classList.split("&");
|
|
53
|
-
for (var i = 0; i < runs.length; i++) {
|
|
54
|
-
var run = runs[i];
|
|
55
|
-
var currentRunTime = 0;
|
|
56
|
-
var classOperations = run.split(",");
|
|
57
|
-
for (var j = 0; j < classOperations.length; j++) {
|
|
58
|
-
var value = classOperations[j];
|
|
59
|
-
var trimmedValue = value.trim();
|
|
60
|
-
var classOperation = parseClassOperation(trimmedValue);
|
|
61
|
-
if (classOperation) {
|
|
62
|
-
if (classOperation.operation === "toggle") {
|
|
63
|
-
toggleOperation(elt, classOperation, classList, currentRunTime);
|
|
64
|
-
currentRunTime = currentRunTime + classOperation.delay;
|
|
65
|
-
} else {
|
|
66
|
-
currentRunTime = currentRunTime + classOperation.delay;
|
|
67
|
-
performOperation(elt, classOperation, classList, currentRunTime);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function maybeProcessClasses(elt) {
|
|
75
|
-
if (elt.getAttribute) {
|
|
76
|
-
var classList = elt.getAttribute("classes") || elt.getAttribute("data-classes");
|
|
77
|
-
if (classList) {
|
|
78
|
-
processClassList(elt, classList);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
htmx.defineExtension('class-tools', {
|
|
84
|
-
onEvent: function (name, evt) {
|
|
85
|
-
if (name === "htmx:afterProcessNode") {
|
|
86
|
-
var elt = evt.detail.elt;
|
|
87
|
-
maybeProcessClasses(elt);
|
|
88
|
-
if (elt.querySelectorAll) {
|
|
89
|
-
var children = elt.querySelectorAll("[classes], [data-classes]");
|
|
90
|
-
for (var i = 0; i < children.length; i++) {
|
|
91
|
-
maybeProcessClasses(children[i]);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
})();
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
if (htmx.version && !htmx.version.startsWith("1.")) {
|
|
2
|
-
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
|
3
|
-
". It is recommended that you move to the version of this extension found on https://htmx.org/extensions")
|
|
4
|
-
}
|
|
5
|
-
htmx.defineExtension('client-side-templates', {
|
|
6
|
-
transformResponse : function(text, xhr, elt) {
|
|
7
|
-
|
|
8
|
-
var mustacheTemplate = htmx.closest(elt, "[mustache-template]");
|
|
9
|
-
if (mustacheTemplate) {
|
|
10
|
-
var data = JSON.parse(text);
|
|
11
|
-
var templateId = mustacheTemplate.getAttribute('mustache-template');
|
|
12
|
-
var template = htmx.find("#" + templateId);
|
|
13
|
-
if (template) {
|
|
14
|
-
return Mustache.render(template.innerHTML, data);
|
|
15
|
-
} else {
|
|
16
|
-
throw "Unknown mustache template: " + templateId;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var mustacheArrayTemplate = htmx.closest(elt, "[mustache-array-template]");
|
|
21
|
-
if (mustacheArrayTemplate) {
|
|
22
|
-
var data = JSON.parse(text);
|
|
23
|
-
var templateId = mustacheArrayTemplate.getAttribute('mustache-array-template');
|
|
24
|
-
var template = htmx.find("#" + templateId);
|
|
25
|
-
if (template) {
|
|
26
|
-
return Mustache.render(template.innerHTML, {"data": data });
|
|
27
|
-
} else {
|
|
28
|
-
throw "Unknown mustache template: " + templateId;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var handlebarsTemplate = htmx.closest(elt, "[handlebars-template]");
|
|
33
|
-
if (handlebarsTemplate) {
|
|
34
|
-
var data = JSON.parse(text);
|
|
35
|
-
var templateId = handlebarsTemplate.getAttribute('handlebars-template');
|
|
36
|
-
var templateElement = htmx.find('#' + templateId).innerHTML;
|
|
37
|
-
var renderTemplate = Handlebars.compile(templateElement);
|
|
38
|
-
if (renderTemplate) {
|
|
39
|
-
return renderTemplate(data);
|
|
40
|
-
} else {
|
|
41
|
-
throw "Unknown handlebars template: " + templateId;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
var handlebarsArrayTemplate = htmx.closest(elt, "[handlebars-array-template]");
|
|
46
|
-
if (handlebarsArrayTemplate) {
|
|
47
|
-
var data = JSON.parse(text);
|
|
48
|
-
var templateId = handlebarsArrayTemplate.getAttribute('handlebars-array-template');
|
|
49
|
-
var templateElement = htmx.find('#' + templateId).innerHTML;
|
|
50
|
-
var renderTemplate = Handlebars.compile(templateElement);
|
|
51
|
-
if (renderTemplate) {
|
|
52
|
-
return renderTemplate(data);
|
|
53
|
-
} else {
|
|
54
|
-
throw "Unknown handlebars template: " + templateId;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var nunjucksTemplate = htmx.closest(elt, "[nunjucks-template]");
|
|
59
|
-
if (nunjucksTemplate) {
|
|
60
|
-
var data = JSON.parse(text);
|
|
61
|
-
var templateName = nunjucksTemplate.getAttribute('nunjucks-template');
|
|
62
|
-
var template = htmx.find('#' + templateName);
|
|
63
|
-
if (template) {
|
|
64
|
-
return nunjucks.renderString(template.innerHTML, data);
|
|
65
|
-
} else {
|
|
66
|
-
return nunjucks.render(templateName, data);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var xsltTemplate = htmx.closest(elt, "[xslt-template]");
|
|
71
|
-
if (xsltTemplate) {
|
|
72
|
-
var templateId = xsltTemplate.getAttribute('xslt-template');
|
|
73
|
-
var template = htmx.find("#" + templateId);
|
|
74
|
-
if (template) {
|
|
75
|
-
var content = template.innerHTML ? new DOMParser().parseFromString(template.innerHTML, 'application/xml')
|
|
76
|
-
: template.contentDocument;
|
|
77
|
-
var processor = new XSLTProcessor();
|
|
78
|
-
processor.importStylesheet(content);
|
|
79
|
-
var data = new DOMParser().parseFromString(text, "application/xml");
|
|
80
|
-
var frag = processor.transformToFragment(data, document);
|
|
81
|
-
return new XMLSerializer().serializeToString(frag);
|
|
82
|
-
} else {
|
|
83
|
-
throw "Unknown XSLT template: " + templateId;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var nunjucksArrayTemplate = htmx.closest(elt, "[nunjucks-array-template]");
|
|
88
|
-
if (nunjucksArrayTemplate) {
|
|
89
|
-
var data = JSON.parse(text);
|
|
90
|
-
var templateName = nunjucksArrayTemplate.getAttribute('nunjucks-array-template');
|
|
91
|
-
var template = htmx.find('#' + templateName);
|
|
92
|
-
if (template) {
|
|
93
|
-
return nunjucks.renderString(template.innerHTML, {"data": data});
|
|
94
|
-
} else {
|
|
95
|
-
return nunjucks.render(templateName, {"data": data});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return text;
|
|
99
|
-
}
|
|
100
|
-
});
|