diff --git a/dist/bunny.js b/dist/bunny.js index 887c06c..48fc4ae 100644 --- a/dist/bunny.js +++ b/dist/bunny.js @@ -1 +1 @@ -(()=>{"use strict";var __webpack_modules__={335:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var htmx=function(){const htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").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:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0},parseInterval:null,_:null,version:"2.0.2"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;const internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map((function(e){return"[hx-"+e+"], [data-hx-"+e+"]"})).join(", "),HEAD_TAG_REGEX=makeTagRegEx("head");function makeTagRegEx(e,t=!1){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function parseInterval(e){if(null==e)return;let t=NaN;return t="ms"==e.slice(-2)?parseFloat(e.slice(0,-2)):"s"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1)):"m"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1))*60:parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){const t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){const r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var a=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return a&&("*"===a||a.split(" ").indexOf(n)>=0)?r:null;if(o&&("*"===o||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,(function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))})),"unset"!==n)return n}function matches(e,t){const n=e instanceof Element&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function getStartTag(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return t?t[1].toLowerCase():""}function parseHTML(e){return(new DOMParser).parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){const t=getDocument().createElement("script");return forEach(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&("text/javascript"===e.type||"module"===e.type||""===e.type)}function normalizeScriptTags(e){Array.from(e.querySelectorAll("script")).forEach((e=>{if(isJavaScriptScriptNode(e)){const t=duplicateScript(e),n=e.parentNode;try{n.insertBefore(t,e)}catch(e){logError(e)}finally{e.remove()}}}))}function makeFragment(e){const t=e.replace(HEAD_TAG_REGEX,""),n=getStartTag(t);let r;if("html"===n){r=new DocumentFragment;const t=parseHTML(e);takeChildrenFor(r,t.body),r.title=t.title}else if("body"===n){r=new DocumentFragment;const e=parseHTML(t);takeChildrenFor(r,e.body),r.title=e.title}else{const e=parseHTML('");r=e.querySelector("template").content,r.title=e.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&(htmx.config.allowScriptTags?normalizeScriptTags(r):r.querySelectorAll("script").forEach((e=>e.remove()))),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return"function"==typeof e}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){const t="htmx-internal-data";let n=e[t];return n||(n=e[t]={}),n}function toArray(e){const t=[];if(e)for(let n=0;n=0}function bodyContains(e){const t=e.getRootNode&&e.getRootNode();return t&&t instanceof window.ShadowRoot?getDocument().body.contains(t.host):getDocument().body.contains(e)}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function parseJSON(e){try{return JSON.parse(e)}catch(e){return logError(e),null}}function canAccessLocalStorage(){const e="htmx:localStorageTest";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function normalizePath(e){try{const t=new URL(e);return t&&(e=t.pathname+t.search),/^\/$/.test(e)||(e=e.replace(/\/+$/,"")),e}catch(t){return e}}function internalEval(str){return maybeEval(getDocument().body,(function(){return eval(str)}))}function onLoadHelper(e){return htmx.on("htmx:load",(function(t){e(t.detail.elt)}))}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return"string"!=typeof e?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return"string"!=typeof e?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout((function(){removeElement(e),e=null}),t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return"string"==typeof e?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){(e=asElement(resolveTarget(e)))&&(n?getWindow().setTimeout((function(){addClassToElement(e,t),e=null}),n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout((function(){removeClassFromElement(r,t),r=null}),n):r.classList&&(r.classList.remove(t),0===r.classList.length&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){(e=resolveTarget(e)).classList.toggle(t)}function takeClassForElement(e,t){forEach((e=resolveTarget(e)).parentElement.children,(function(e){removeClassFromElement(e,t)})),addClassToElement(asElement(e),t)}function closest(e,t){if((e=asElement(resolveTarget(e)))&&e.closest)return e.closest(t);do{if(null==e||matches(e,t))return e}while(e=e&&asElement(parentElt(e)));return null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){const t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){return e=resolveTarget(e),0===t.indexOf("closest ")?[closest(asElement(e),normalizeSelector(t.substr(8)))]:0===t.indexOf("find ")?[find(asParentNode(e),normalizeSelector(t.substr(5)))]:"next"===t?[asElement(e).nextElementSibling]:0===t.indexOf("next ")?[scanForwardQuery(e,normalizeSelector(t.substr(5)),!!n)]:"previous"===t?[asElement(e).previousElementSibling]:0===t.indexOf("previous ")?[scanBackwardsQuery(e,normalizeSelector(t.substr(9)),!!n)]:"document"===t?[document]:"window"===t?[window]:"body"===t?[document.body]:"root"===t?[getRootNode(e,!!n)]:0===t.indexOf("global ")?querySelectorAllExt(e,t.slice(7),!0):toArray(asParentNode(getRootNode(e,!!n)).querySelectorAll(normalizeSelector(t)))}var scanForwardQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let t=0;t=0;t--){const n=r[t];if(n.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return n}};function querySelectorExt(e,t){return"string"!=typeof e?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return"string"==typeof e?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t}:{target:resolveTarget(e),event:asString(t),listener:n}}function addEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.addEventListener(r.event,r.listener)})),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)})),isFunction(t)?t:n}const DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){const n=getClosestAttributeValue(e,t);if(n){if("this"===n)return[findThisElement(e,t)];{const r=querySelectorAllExt(e,n);return 0===r.length?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,(function(e){return null!=getAttributeValue(asElement(e),t)})))}function getTarget(e){const t=getClosestAttributeValue(e,"hx-target");return t?"this"===t?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){const t=htmx.config.attributesToSettle;for(let n=0;n0?(o=e.substr(0,e.indexOf(":")),r=e.substr(e.indexOf(":")+1,e.length)):o=e);const a=getDocument().querySelectorAll(r);return a?(forEach(a,(function(e){let r;const a=t.cloneNode(!0);r=getDocument().createDocumentFragment(),r.appendChild(a),isInlineSwap(o,e)||(r=asParentNode(a));const s={shouldSwap:!0,target:e,fragment:r};triggerEvent(e,"htmx:oobBeforeSwap",s)&&(e=s.target,s.shouldSwap&&swapWithStyle(o,e,e,r,n),forEach(n.elts,(function(e){triggerEvent(e,"htmx:oobAfterSwap",s)})))})),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t})),e}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),(function(e){const t=getAttributeValue(e,"id"),n=getDocument().getElementById(t);null!=n&&e.parentNode.replaceChild(n,e)}))}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),(function(t){const r=getRawAttribute(t,"id");if(r&&r.length>0){const o=r.replace("'","\\'"),a=t.tagName.replace(":","\\:"),s=asParentNode(e),i=s&&s.querySelector(a+"[id='"+o+"']");if(i&&i!==s){const e=t.cloneNode();cloneAttributes(t,i),n.tasks.push((function(){cloneAttributes(t,e)}))}}}))}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){const t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));null!=n&&n.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){const o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n0}function swap(e,t,n,r){r||(r={}),e=resolveTarget(e);const o=document.activeElement;let a={};try{a={elt:o,start:o?o.selectionStart:null,end:o?o.selectionEnd:null}}catch(e){}const s=makeSettleInfo(e);if("textContent"===n.swapStyle)e.textContent=t;else{let o=makeFragment(t);if(s.title=o.title,r.selectOOB){const e=r.selectOOB.split(",");for(let t=0;t0?getWindow().setTimeout(i,n.settleDelay):i()}function handleTriggerHeader(e,t,n){const r=e.getResponseHeader(t);if(0===r.indexOf("{")){const e=parseJSON(r);for(const t in e)if(e.hasOwnProperty(t)){let r=e[t];isRawObject(r)?n=void 0!==r.target?r.target:n:r={value:r},triggerEvent(n,t,r)}}else{const e=r.split(",");for(let t=0;t0;){const s=t[0];if("]"===s){if(r--,0===r){null===a&&(o+="true"),t.shift(),o+=")})";try{const t=maybeEval(e,(function(){return Function(o)()}),(function(){return!0}));return t.source=o,t}catch(e){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:e,source:o}),null}}}else"["===s&&r++;isPossibleRelativeReference(s,a,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o+=s,a=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}const INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){const r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);const t=o.length,n=consumeUntil(o,/[,\[\s]/);if(""!==n)if("every"===n){const t={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),t.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE),(a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a),r.push(t)}else{const t={trigger:n};var a;for((a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a);o.length>0&&","!==o[0];){consumeUntil(o,NOT_WHITESPACE);const n=o.shift();if("changed"===n)t.changed=!0;else if("once"===n)t.once=!0;else if("consume"===n)t.consume=!0;else if("delay"===n&&":"===o[0])o.shift(),t.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if("from"===n&&":"===o[0]){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else if("closest"===(s=consumeUntil(o,WHITESPACE_OR_COMMA))||"find"===s||"next"===s||"previous"===s){o.shift();const e=consumeCSSSelector(o);e.length>0&&(s+=" "+e)}t.from=s}else"target"===n&&":"===o[0]?(o.shift(),t.target=consumeCSSSelector(o)):"throttle"===n&&":"===o[0]?(o.shift(),t.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):"queue"===n&&":"===o[0]?(o.shift(),t.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):"root"===n&&":"===o[0]?(o.shift(),t[n]=consumeCSSSelector(o)):"threshold"===n&&":"===o[0]?(o.shift(),t[n]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()})}r.push(t)}o.length===t&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(","===o[0]&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){const t=getAttributeValue(e,"hx-trigger");let n=[];if(t){const r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){const r=getInternalData(e);r.timeout=getWindow().setTimeout((function(){bodyContains(e)&&!0!==r.cancelled&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))}),n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&0!==getRawAttribute(e,"href").indexOf("#")}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(""===e.target||"_self"===e.target)||"FORM"===e.tagName&&"dialog"!==String(getRawAttribute(e,"method")).toLowerCase()){let r,o;if(t.boosted=!0,"A"===e.tagName)r="get",o=getRawAttribute(e,"href");else{const t=getRawAttribute(e,"method");r=t?t.toLowerCase():"get",o=getRawAttribute(e,"action")}n.forEach((function(n){addEventListener(e,(function(e,t){const n=asElement(e);eltIsDisabled(n)?cleanUpElement(n):issueAjaxRequest(r,o,n,t)}),t,n,!0)}))}}function shouldCancel(e,t){const n=asElement(t);if(!n)return!1;if("submit"===e.type||"click"===e.type){if("FORM"===n.tagName)return!0;if(matches(n,'input[type="submit"], button')&&null!==closest(n,"form"))return!0;if(n instanceof HTMLAnchorElement&&n.href&&("#"===n.getAttribute("href")||0!==n.getAttribute("href").indexOf("#")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&"click"===t.type&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){const r=e.eventFilter;if(r)try{return!0!==r.call(t,n)}catch(e){const t=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:e,source:t}),!0}return!1}function addEventListener(e,t,n,r,o){const a=getInternalData(e);let s;s=r.from?querySelectorAllExt(e,r.from):[e],r.changed&&s.forEach((function(e){getInternalData(e).lastValue=e.value})),forEach(s,(function(s){const i=function(n){if(!bodyContains(e))return void s.removeEventListener(r.trigger,i);if(ignoreBoostedAnchorCtrlClick(e,n))return;if((o||shouldCancel(n,e))&&n.preventDefault(),maybeFilterEvent(r,e,n))return;const l=getInternalData(n);if(l.triggerSpec=r,null==l.handledFor&&(l.handledFor=[]),l.handledFor.indexOf(e)<0){if(l.handledFor.push(e),r.consume&&n.stopPropagation(),r.target&&n.target&&!matches(asElement(n.target),r.target))return;if(r.once){if(a.triggeredOnce)return;a.triggeredOnce=!0}if(r.changed){const e=getInternalData(s),t=s.value;if(e.lastValue===t)return;e.lastValue=t}if(a.delayed&&clearTimeout(a.delayed),a.throttle)return;r.throttle>0?a.throttle||(triggerEvent(e,"htmx:trigger"),t(e,n),a.throttle=getWindow().setTimeout((function(){a.throttle=null}),r.throttle)):r.delay>0?a.delayed=getWindow().setTimeout((function(){triggerEvent(e,"htmx:trigger"),t(e,n)}),r.delay):(triggerEvent(e,"htmx:trigger"),t(e,n))}};null==n.listenerInfos&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:i,on:s}),s.addEventListener(r.trigger,i)}))}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),setInterval((function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),(function(e){maybeReveal(e)})))}),200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",(function(){triggerEvent(e,"revealed")}),{once:!0}))}function loadImmediately(e,t,n,r){const o=function(){n.loaded||(n.loaded=!0,t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,(function(o){if(hasAttribute(e,"hx-"+o)){const a=getAttributeValue(e,"hx-"+o);r=!0,t.path=a,t.verb=o,n.forEach((function(n){addTriggerHandler(e,n,t,(function(e,t){const n=asElement(e);closest(n,htmx.config.disableSelector)?cleanUpElement(n):issueAjaxRequest(o,a,n,t)}))}))}})),r}function addTriggerHandler(e,t,n,r){if("revealed"===t.trigger)initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if("intersect"===t.trigger){const o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver((function(t){for(let n=0;n0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){const t=asElement(e);if(!t)return!1;const n=t.attributes;for(let e=0;e", "+e)).join(""))}return[]}function maybeSetLastButtonClicked(e){const t=closest(asElement(e.target),"button, input[type='submit']"),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){const t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getRelatedFormData(e){const t=closest(asElement(e.target),"button, input[type='submit']");if(!t)return;const n=resolveTarget("#"+getRawAttribute(t,"form"),t.getRootNode())||closest(t,"form");return n?getInternalData(n):void 0}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){const r=getInternalData(e);let o;Array.isArray(r.onHandlers)||(r.onHandlers=[]);const a=function(t){maybeEval(e,(function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,t))}))};e.addEventListener(t,a),r.onHandlers.push({event:t,listener:a})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;thtmx.config.historyCacheSize;)a.shift();for(;a.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(a));break}catch(e){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:e,cache:a}),a.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);const t=parseJSON(localStorage.getItem("htmx-history-cache"))||[];for(let n=0;n=200&&this.status<400){triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",n);const t=makeFragment(this.response),r=t.querySelector("[hx-history-elt],[data-hx-history-elt]")||t,o=getHistoryElement(),a=makeSettleInfo(o);handleTitle(t.title),swapInnerHTML(o,r,a),settleImmediately(a.tasks),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:this.response})}else triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",n)},t.send()}function restoreHistory(e){saveCurrentPageToHistory();const t=getCachedHistory(e=e||location.pathname+location.search);if(t){const n=makeFragment(t.content),r=getHistoryElement(),o=makeSettleInfo(r);handleTitle(n.title),swapInnerHTML(r,n,o),settleImmediately(o.tasks),getWindow().setTimeout((function(){window.scrollTo(0,t.scroll)}),0),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,item:t})}else htmx.config.refreshOnHistoryMiss?window.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return null==t&&(t=[e]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.classList.add.call(e.classList,htmx.config.requestClass)})),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return null==t&&(t=[]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.setAttribute("disabled",""),e.setAttribute("data-disabled-by-htmx","")})),t}function removeRequestIndicators(e,t){forEach(e,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&e.classList.remove.call(e.classList,htmx.config.requestClass)})),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&(e.removeAttribute("disabled"),e.removeAttribute("data-disabled-by-htmx"))}))}function haveSeenNode(e,t){for(let n=0;nt.indexOf(e)<0)):r.filter((e=>e!==t)),n.delete(e),forEach(r,(t=>n.append(e,t)))}}function processInputValue(e,t,n,r,o){if(null!=r&&!haveSeenNode(e,r)){if(e.push(r),shouldInclude(r)){const e=getRawAttribute(r,"name");let a=r.value;r instanceof HTMLSelectElement&&r.multiple&&(a=toArray(r.querySelectorAll("option:checked")).map((function(e){return e.value}))),r instanceof HTMLInputElement&&r.files&&(a=toArray(r.files)),addValueToFormData(e,a,t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,(function(r){e.indexOf(r)>=0?removeValueFromFormData(r.name,r.value,t):e.push(r),o&&validateElement(r,n)})),new FormData(r).forEach((function(e,n){e instanceof File&&""===e.name||addValueToFormData(n,e,t)})))}}function validateElement(e,t){const n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(t.push({elt:n,message:n.validationMessage,validity:n.validity}),triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(const n of t.keys())e.delete(n);return t.forEach((function(t,n){e.append(n,t)})),e}function getInputValues(e,t){const n=[],r=new FormData,o=new FormData,a=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let i=e instanceof HTMLFormElement&&!0!==e.noValidate||"true"===getAttributeValue(e,"hx-validate");if(s.lastButtonClicked&&(i=i&&!0!==s.lastButtonClicked.formNoValidate),"get"!==t&&processInputValue(n,o,a,closest(e,"form"),i),processInputValue(n,r,a,e,i),s.lastButtonClicked||"BUTTON"===e.tagName||"INPUT"===e.tagName&&"submit"===getRawAttribute(e,"type")){const t=s.lastButtonClicked||e;addValueToFormData(getRawAttribute(t,"name"),t.value,o)}return forEach(findAttributeTargets(e,"hx-include"),(function(e){processInputValue(n,r,a,asElement(e),i),matches(e,"form")||forEach(asParentNode(e).querySelectorAll(INPUT_SELECTOR),(function(e){processInputValue(n,r,a,e,i)}))})),overrideFormData(r,o),{errors:a,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){""!==e&&(e+="&"),"[object Object]"===String(n)&&(n=JSON.stringify(n));const r=encodeURIComponent(n);return e+(encodeURIComponent(t)+"=")+r}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach((function(e,n){t=appendParam(t,n,e)})),t}function getHeaders(e,t,n){const r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":getDocument().location.href};return getValuesForElement(e,"hx-headers",!1,r),void 0!==n&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){const n=getClosestAttributeValue(t,"hx-params");if(n){if("none"===n)return new FormData;if("*"===n)return e;if(0===n.indexOf("not "))return forEach(n.substr(4).split(","),(function(t){t=t.trim(),e.delete(t)})),e;{const t=new FormData;return forEach(n.split(","),(function(n){n=n.trim(),e.has(n)&&e.getAll(n).forEach((function(e){t.append(n,e)}))})),t}}return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){const n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){const e=splitOnWhitespace(n);if(e.length>0)for(let t=0;t0?a.join(":"):null;r.scroll=e,r.scrollTarget=o}else if(0===n.indexOf("show:")){var a;const e=(a=n.substr(5).split(":")).pop();o=a.length>0?a.join(":"):null,r.show=e,r.showTarget=o}else if(0===n.indexOf("focus-scroll:")){const e=n.substr(13);r.focusScroll="true"==e}else 0==t?r.swapStyle=n:logError("Unknown modifier in hx-swap: "+n)}}return r}function usesFormData(e){return"multipart/form-data"===getClosestAttributeValue(e,"hx-encoding")||matches(e,"form")&&"multipart/form-data"===getRawAttribute(e,"enctype")}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,(function(o){null==r&&(r=o.encodeParameters(e,n,t))})),null!=r?r:usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n)}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){const n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),"top"===t.scroll&&(n||o)&&((o=o||n).scrollTop=0),"bottom"===t.scroll&&(r||o)&&((o=o||r).scrollTop=o.scrollHeight)}if(t.show){if(o=null,t.showTarget){let e=t.showTarget;"window"===t.showTarget&&(e="body"),o=asElement(querySelectorExt(n,e))}"top"===t.show&&(n||o)&&(o=o||n).scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior}),"bottom"===t.show&&(r||o)&&(o=o||r).scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior})}}function getValuesForElement(e,t,n,r){if(null==r&&(r={}),null==e)return r;const o=getAttributeValue(e,t);if(o){let t,a=o.trim(),s=n;if("unset"===a)return null;0===a.indexOf("javascript:")?(a=a.substr(11),s=!0):0===a.indexOf("js:")&&(a=a.substr(3),s=!0),0!==a.indexOf("{")&&(a="{"+a+"}"),t=s?maybeEval(e,(function(){return Function("return ("+a+")")()}),{}):parseJSON(a);for(const e in t)t.hasOwnProperty(e)&&null==r[e]&&(r[e]=t[e])}return getValuesForElement(asElement(parentElt(e)),t,n,r)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t){return getValuesForElement(e,"hx-vars",!0,t)}function getHXValsForElement(e,t){return getValuesForElement(e,"hx-vals",!1,t)}function getExpressionVars(e){return mergeObjects(getHXVarsForElement(e),getHXValsForElement(e))}function safelySetHeaderValue(e,t,n){if(null!==n)try{e.setRequestHeader(t,n)}catch(r){e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL&&"undefined"!=typeof URL)try{const t=new URL(e.responseURL);return t.pathname+t.search}catch(t){triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return t.test(e.getAllResponseHeaders())}function ajaxHelper(e,t,n){return e=e.toLowerCase(),n?n instanceof Element||"string"==typeof n?issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n),returnPromise:!0}):issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:resolveTarget(n.target),swapOverride:n.swap,select:n.select,returnPromise:!0}):issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){const t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r,o;return"function"==typeof URL?(o=new URL(t,document.location.href),r=document.location.origin===o.origin):(o=t,r=startsWith(t,document.location.origin)),!(htmx.config.selfRequestsOnly&&!r)&&triggerEvent(e,"htmx:validateUrl",mergeObjects({url:o,sameHost:r},n))}function formDataFromObject(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e)e.hasOwnProperty(n)&&("function"==typeof e[n].forEach?e[n].forEach((function(e){t.append(n,e)})):"object"!=typeof e[n]||e[n]instanceof Blob?t.append(n,e[n]):t.append(n,JSON.stringify(e[n])));return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(n,r){return"number"==typeof r?n[r]:"length"===r?n.length:"push"===r?function(r){n.push(r),e.append(t,r)}:"function"==typeof n[r]?function(){n[r].apply(n,arguments),e.delete(t),n.forEach((function(n){e.append(t,n)}))}:n[r]&&1===n[r].length?n[r][0]:n[r]},set:function(n,r,o){return n[r]=o,e.delete(t),n.forEach((function(n){e.append(t,n)})),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if("symbol"==typeof n)return Reflect.get(t,n);if("toJSON"===n)return()=>Object.fromEntries(e);if(n in t)return"function"==typeof t[n]?function(){return e[n].apply(e,arguments)}:t[n];const r=e.getAll(n);return 0===r.length?void 0:1===r.length?r[0]:formDataArrayProxy(t,n,r)},set:function(e,t,n){return"string"==typeof t&&(e.delete(t),"function"==typeof n.forEach?n.forEach((function(n){e.append(t,n)})):"object"!=typeof n||n instanceof Blob?e.append(t,n):e.append(t,JSON.stringify(n)),!0)},deleteProperty:function(e,t){return"string"==typeof t&&e.delete(t),!0},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function issueAjaxRequest(e,t,n,r,o,a){let s=null,i=null;if((o=null!=o?o:{}).returnPromise&&"undefined"!=typeof Promise)var l=new Promise((function(e,t){s=e,i=t}));null==n&&(n=getDocument().body);const c=o.handler||handleAjaxResponse,u=o.select||null;if(!bodyContains(n))return maybeCall(s),l;const d=o.targetOverride||asElement(getTarget(n));if(null==d||d==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getAttributeValue(n,"hx-target")}),maybeCall(i),l;let f=getInternalData(n);const g=f.lastButtonClicked;if(g){const n=getRawAttribute(g,"formaction");null!=n&&(t=n);const r=getRawAttribute(g,"formmethod");null!=r&&"dialog"!==r.toLowerCase()&&(e=r)}const h=getClosestAttributeValue(n,"hx-confirm");if(void 0===a&&!1===triggerEvent(n,"htmx:confirm",{target:d,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(a){return issueAjaxRequest(e,t,n,r,o,!!a)},question:h}))return maybeCall(s),l;let m=n,p=getClosestAttributeValue(n,"hx-sync"),E=null,b=!1;if(p){const e=p.split(":"),t=e[0].trim();if(m="this"===t?findThisElement(n,"hx-sync"):asElement(querySelectorExt(n,t)),p=(e[1]||"drop").trim(),f=getInternalData(m),"drop"===p&&f.xhr&&!0!==f.abortable)return maybeCall(s),l;if("abort"===p){if(f.xhr)return maybeCall(s),l;b=!0}else"replace"===p?triggerEvent(m,"htmx:abort"):0===p.indexOf("queue")&&(E=(p.split(" ")[1]||"last").trim())}if(f.xhr){if(!f.abortable){if(null==E){if(r){const e=getInternalData(r);e&&e.triggerSpec&&e.triggerSpec.queue&&(E=e.triggerSpec.queue)}null==E&&(E="last")}return null==f.queuedRequests&&(f.queuedRequests=[]),"first"===E&&0===f.queuedRequests.length||"all"===E?f.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)})):"last"===E&&(f.queuedRequests=[],f.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)}))),maybeCall(s),l}triggerEvent(m,"htmx:abort")}const x=new XMLHttpRequest;f.xhr=x,f.abortable=b;const y=function(){f.xhr=null,f.abortable=!1,null!=f.queuedRequests&&f.queuedRequests.length>0&&f.queuedRequests.shift()()},v=getClosestAttributeValue(n,"hx-prompt");if(v){var w=prompt(v);if(null===w||!triggerEvent(n,"htmx:prompt",{prompt:w,target:d}))return maybeCall(s),y(),l}if(h&&!a&&!confirm(h))return maybeCall(s),y(),l;let S=getHeaders(n,d,w);"get"===e||usesFormData(n)||(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));const A=getInputValues(n,e);let C=A.errors;const T=A.formData;o.values&&overrideFormData(T,formDataFromObject(o.values));const H=overrideFormData(T,formDataFromObject(getExpressionVars(n)));let R=filterValues(H,n);htmx.config.getCacheBusterParam&&"get"===e&&R.set("org.htmx.cache-buster",getRawAttribute(d,"id")||"true"),null!=t&&""!==t||(t=getDocument().location.href);const O=getValuesForElement(n,"hx-request"),I=getInternalData(n).boosted;let D=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0;const _={boosted:I,useUrlParams:D,formData:R,parameters:formDataProxy(R),unfilteredFormData:H,unfilteredParameters:formDataProxy(H),headers:S,target:d,verb:e,errors:C,withCredentials:o.credentials||O.credentials||htmx.config.withCredentials,timeout:o.timeout||O.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",_))return maybeCall(s),y(),l;if(t=_.path,e=_.verb,S=_.headers,R=formDataFromObject(_.parameters),C=_.errors,D=_.useUrlParams,C&&C.length>0)return triggerEvent(n,"htmx:validation:halted",_),maybeCall(s),y(),l;const N=t.split("#"),L=N[0],q=N[1];let P=t;if(D&&(P=L,!R.keys().next().done&&(P.indexOf("?")<0?P+="?":P+="&",P+=urlEncode(R),q&&(P+="#"+q))),!verifyPath(n,P,_))return triggerErrorEvent(n,"htmx:invalidPath",_),maybeCall(i),l;if(x.open(e.toUpperCase(),P,!0),x.overrideMimeType("text/html"),x.withCredentials=_.withCredentials,x.timeout=_.timeout,O.noHeaders);else for(const e in S)if(S.hasOwnProperty(e)){const t=S[e];safelySetHeaderValue(x,e,t)}const F={xhr:x,target:d,requestConfig:_,etc:o,boosted:I,select:u,pathInfo:{requestPath:t,finalRequestPath:P,responsePath:null,anchor:q}};if(x.onload=function(){try{const e=hierarchyForElt(n);if(F.pathInfo.responsePath=getPathFromResponse(x),c(n,F),!0!==F.keepIndicators&&removeRequestIndicators(k,M),triggerEvent(n,"htmx:afterRequest",F),triggerEvent(n,"htmx:afterOnLoad",F),!bodyContains(n)){let t=null;for(;e.length>0&&null==t;){const n=e.shift();bodyContains(n)&&(t=n)}t&&(triggerEvent(t,"htmx:afterRequest",F),triggerEvent(t,"htmx:afterOnLoad",F))}maybeCall(s),y()}catch(e){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:e},F)),e}},x.onerror=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendError",F),maybeCall(i),y()},x.onabort=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendAbort",F),maybeCall(i),y()},x.ontimeout=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:timeout",F),maybeCall(i),y()},!triggerEvent(n,"htmx:beforeRequest",F))return maybeCall(s),y(),l;var k=addRequestIndicatorClasses(n),M=disableElements(n);forEach(["loadstart","loadend","progress","abort"],(function(e){forEach([x,x.upload],(function(t){t.addEventListener(e,(function(t){triggerEvent(n,"htmx:xhr:"+e,{lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total})}))}))})),triggerEvent(n,"htmx:beforeSend",F);const V=D?null:encodeParamsForBody(x,n,R);return x.send(V),l}function determineHistoryUpdates(e,t){const n=t.xhr;let r=null,o=null;if(hasHeader(n,/HX-Push:/i)?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,/HX-Push-Url:/i)?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,/HX-Replace-Url:/i)&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return"false"===r?{}:{type:o,path:r};const a=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,i=getClosestAttributeValue(e,"hx-push-url"),l=getClosestAttributeValue(e,"hx-replace-url"),c=getInternalData(e).boosted;let u=null,d=null;return i?(u="push",d=i):l?(u="replace",d=l):c&&(u="push",d=s||a),d?"false"===d?{}:("true"===d&&(d=s||a),t.pathInfo.anchor&&-1===d.indexOf("#")&&(d=d+"#"+t.pathInfo.anchor),{type:u,path:d}):{}}function codeMatches(e,t){return new RegExp(e.code).test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t0?getWindow().setTimeout(u,E.swapDelay):u()}d&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}const extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(null==t&&(t=[]),null==e)return t;null==n&&(n=[]);const r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),(function(e){if("ignore:"!=(e=e.replace(/ /g,"")).slice(0,7)){if(n.indexOf(e)<0){const n=extensions[e];n&&t.indexOf(n)<0&&t.push(n)}}else n.push(e.slice(7))})),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;function ready(e){isReady||"complete"===getDocument().readyState?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(!1!==htmx.config.includeIndicatorStyles){const e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"";getDocument().head.insertAdjacentHTML("beforeend"," ."+htmx.config.indicatorClass+"{opacity:0} ."+htmx.config.requestClass+" ."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+htmx.config.requestClass+"."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ")}}function getMetaConfig(){const e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){const e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return getDocument().addEventListener("DOMContentLoaded",(function(){isReady=!0})),ready((function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);const t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",(function(e){const t=getInternalData(e.target);t&&t.xhr&&t.xhr.abort()}));const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){e.state&&e.state.htmx?(restoreHistory(),forEach(t,(function(e){triggerEvent(e,"htmx:restored",{document:getDocument(),triggerEvent})}))):n&&n(e)},getWindow().setTimeout((function(){triggerEvent(e,"htmx:load",{}),e=null}),0)})),htmx}();const __WEBPACK_DEFAULT_EXPORT__=htmx}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={},htmx=__webpack_require__(335);let tool={indexOf:function(e){return Array.prototype.indexOf.call(e.parentNode.children,e)},escapeHTML:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}};const src_tool=tool;htmx.A.defineExtension("bny-tab",{onEvent:function(e,t){return"htmx:beforeProcessNode"===e?function(e){const t=e.target;return null===t||!e.target.classList.contains("bny-tab")||(htmx.A.findAll(".bny-tab-item",t).forEach((e=>{htmx.A.on(e,"click",(function(){const e=src_tool.indexOf(this),t=this.parentNode.parentNode,n=htmx.A.find(t,`.bny-tab-body>div:nth-child(${e+1})`);htmx.A.findAll(t,".bny-tab-title .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.findAll(t,".bny-tab-body .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.addClass(this,"this"),htmx.A.addClass(n,"this"),n.classList.contains("process")||(htmx.A.process(n),htmx.A.addClass(n,"process"))}))})),!1)}(t):"htmx:afterProcessNode"===e?(function(e){const t=e.target;if(null!==t&&t.classList.contains("bny-tab-body")){const e=htmx.A.findAll(t.parentNode,".bny-tab-title .bny-tab-item").length,n=htmx.A.findAll(t,"div").length;if(e-n>0)for(let r=0;rdiv:nth-child(${n+1})`);200===e.detail.xhr.status?htmx.A.swap(r,e.detail.serverResponse,{swapStyle:"innerHTML"}):htmx.A.swap(r,"网络错误...",{swapStyle:"innerHTML"})}}(t),!1):void 0}}),htmx.A.defineExtension("bny-card",{onEvent:function(e,t){if("htmx:beforeSwap"===e){if(200===t.detail.xhr.status){const e=JSON.parse(t.detail.serverResponse);if(1===e.code){const n=e.data,r=n&&n.body?`\n

${n.body.title||""}

\n
${n.body.subtitle||""}
\n

${n.body.text||""}

\n `:"";t.detail.elt.innerHTML=`\n
\n ${n&&n.top_img?``:""}\n ${n&&n.header?`
${n.header}
`:""}\n
${r}
\n ${n&&n.footer?``:""}\n ${n&&n.bottom_img?``:""}\n
`}else t.detail.elt.innerHTML=`
${data.msg}
`}else t.detail.elt.innerHTML='
网络错误
';return!1}}}),htmx.A.defineExtension("bny-code",{onEvent:function(e,t){if(null!==t.target&&"htmx:beforeSwap"===e){const e=t.target.getAttribute("hx-swap")||"innerHTML";if(200===t.detail.xhr.status){const n=`
${src_tool.escapeHTML(t.detail.serverResponse)}
`;htmx.A.swap(t.target,n,{swapStyle:e})}else htmx.A.swap(t.target,"网络错误...",{swapStyle:e});return!1}}}),htmx.A.defineExtension("bny-marquee",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e&&t.target.classList.contains("bny-marquee")){const e=t.target.getAttribute("speed")||50;let o=htmx.A.find(t.target,".bny-marquee-content");var n=o.parentNode.offsetWidth,r=(o.offsetWidth+n)/Number(e);return o.style.animationDuration=r+"s",!1}}}),htmx.A.defineExtension("bny-alert",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e){const e=t.target;let n=document.createElement("span");n.setAttribute("class","alert-del"),n.textContent="X",e.append(n),htmx.A.on(n,"click",(function(){this.parentNode.style.opacity=0,setTimeout((()=>{this.parentNode.remove()}),235)}))}}}),function(){function e(t){let n="";return t.forEach((t=>{const r=t.icon?``:"",o=t.children?`${e(t.children)}`:"",a=t.url?t.url:"javascript:;",s=t.title?`${t.title}`:"";n+=`
  • ${r}${s}${o}
  • `})),n}function t(t){const n=t.target.getAttribute("hx-swap")||"innerHTML",r=null!==t.target.getAttribute("vertical")?"vertical":"";if(200===t.detail.xhr.status){const o=JSON.parse(t.detail.serverResponse);if(1===o.code){const a=o.data;htmx.A.swap(t.detail.elt,`${e(a)}`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,`加载失败${o.msg}...`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,"网络错误...",{swapStyle:n})}htmx.A.defineExtension("bny-menu",{onEvent:function(e,n){null!==n.target&&"htmx:beforeSwap"===e&&t(n)}})}(),window.htmx=htmx.A})(); \ No newline at end of file +(()=>{"use strict";var __webpack_modules__={335:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var htmx=function(){const htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").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:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0},parseInterval:null,_:null,version:"2.0.2"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;const internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map((function(e){return"[hx-"+e+"], [data-hx-"+e+"]"})).join(", "),HEAD_TAG_REGEX=makeTagRegEx("head");function makeTagRegEx(e,t=!1){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function parseInterval(e){if(null==e)return;let t=NaN;return t="ms"==e.slice(-2)?parseFloat(e.slice(0,-2)):"s"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1)):"m"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1))*60:parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){const t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){const r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var a=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return a&&("*"===a||a.split(" ").indexOf(n)>=0)?r:null;if(o&&("*"===o||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,(function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))})),"unset"!==n)return n}function matches(e,t){const n=e instanceof Element&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function getStartTag(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return t?t[1].toLowerCase():""}function parseHTML(e){return(new DOMParser).parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){const t=getDocument().createElement("script");return forEach(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&("text/javascript"===e.type||"module"===e.type||""===e.type)}function normalizeScriptTags(e){Array.from(e.querySelectorAll("script")).forEach((e=>{if(isJavaScriptScriptNode(e)){const t=duplicateScript(e),n=e.parentNode;try{n.insertBefore(t,e)}catch(e){logError(e)}finally{e.remove()}}}))}function makeFragment(e){const t=e.replace(HEAD_TAG_REGEX,""),n=getStartTag(t);let r;if("html"===n){r=new DocumentFragment;const t=parseHTML(e);takeChildrenFor(r,t.body),r.title=t.title}else if("body"===n){r=new DocumentFragment;const e=parseHTML(t);takeChildrenFor(r,e.body),r.title=e.title}else{const e=parseHTML('");r=e.querySelector("template").content,r.title=e.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&(htmx.config.allowScriptTags?normalizeScriptTags(r):r.querySelectorAll("script").forEach((e=>e.remove()))),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return"function"==typeof e}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){const t="htmx-internal-data";let n=e[t];return n||(n=e[t]={}),n}function toArray(e){const t=[];if(e)for(let n=0;n=0}function bodyContains(e){const t=e.getRootNode&&e.getRootNode();return t&&t instanceof window.ShadowRoot?getDocument().body.contains(t.host):getDocument().body.contains(e)}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function parseJSON(e){try{return JSON.parse(e)}catch(e){return logError(e),null}}function canAccessLocalStorage(){const e="htmx:localStorageTest";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function normalizePath(e){try{const t=new URL(e);return t&&(e=t.pathname+t.search),/^\/$/.test(e)||(e=e.replace(/\/+$/,"")),e}catch(t){return e}}function internalEval(str){return maybeEval(getDocument().body,(function(){return eval(str)}))}function onLoadHelper(e){return htmx.on("htmx:load",(function(t){e(t.detail.elt)}))}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return"string"!=typeof e?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return"string"!=typeof e?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout((function(){removeElement(e),e=null}),t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return"string"==typeof e?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){(e=asElement(resolveTarget(e)))&&(n?getWindow().setTimeout((function(){addClassToElement(e,t),e=null}),n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout((function(){removeClassFromElement(r,t),r=null}),n):r.classList&&(r.classList.remove(t),0===r.classList.length&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){(e=resolveTarget(e)).classList.toggle(t)}function takeClassForElement(e,t){forEach((e=resolveTarget(e)).parentElement.children,(function(e){removeClassFromElement(e,t)})),addClassToElement(asElement(e),t)}function closest(e,t){if((e=asElement(resolveTarget(e)))&&e.closest)return e.closest(t);do{if(null==e||matches(e,t))return e}while(e=e&&asElement(parentElt(e)));return null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){const t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){return e=resolveTarget(e),0===t.indexOf("closest ")?[closest(asElement(e),normalizeSelector(t.substr(8)))]:0===t.indexOf("find ")?[find(asParentNode(e),normalizeSelector(t.substr(5)))]:"next"===t?[asElement(e).nextElementSibling]:0===t.indexOf("next ")?[scanForwardQuery(e,normalizeSelector(t.substr(5)),!!n)]:"previous"===t?[asElement(e).previousElementSibling]:0===t.indexOf("previous ")?[scanBackwardsQuery(e,normalizeSelector(t.substr(9)),!!n)]:"document"===t?[document]:"window"===t?[window]:"body"===t?[document.body]:"root"===t?[getRootNode(e,!!n)]:0===t.indexOf("global ")?querySelectorAllExt(e,t.slice(7),!0):toArray(asParentNode(getRootNode(e,!!n)).querySelectorAll(normalizeSelector(t)))}var scanForwardQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let t=0;t=0;t--){const n=r[t];if(n.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return n}};function querySelectorExt(e,t){return"string"!=typeof e?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return"string"==typeof e?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t}:{target:resolveTarget(e),event:asString(t),listener:n}}function addEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.addEventListener(r.event,r.listener)})),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)})),isFunction(t)?t:n}const DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){const n=getClosestAttributeValue(e,t);if(n){if("this"===n)return[findThisElement(e,t)];{const r=querySelectorAllExt(e,n);return 0===r.length?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,(function(e){return null!=getAttributeValue(asElement(e),t)})))}function getTarget(e){const t=getClosestAttributeValue(e,"hx-target");return t?"this"===t?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){const t=htmx.config.attributesToSettle;for(let n=0;n0?(o=e.substr(0,e.indexOf(":")),r=e.substr(e.indexOf(":")+1,e.length)):o=e);const a=getDocument().querySelectorAll(r);return a?(forEach(a,(function(e){let r;const a=t.cloneNode(!0);r=getDocument().createDocumentFragment(),r.appendChild(a),isInlineSwap(o,e)||(r=asParentNode(a));const s={shouldSwap:!0,target:e,fragment:r};triggerEvent(e,"htmx:oobBeforeSwap",s)&&(e=s.target,s.shouldSwap&&swapWithStyle(o,e,e,r,n),forEach(n.elts,(function(e){triggerEvent(e,"htmx:oobAfterSwap",s)})))})),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t})),e}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),(function(e){const t=getAttributeValue(e,"id"),n=getDocument().getElementById(t);null!=n&&e.parentNode.replaceChild(n,e)}))}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),(function(t){const r=getRawAttribute(t,"id");if(r&&r.length>0){const o=r.replace("'","\\'"),a=t.tagName.replace(":","\\:"),s=asParentNode(e),i=s&&s.querySelector(a+"[id='"+o+"']");if(i&&i!==s){const e=t.cloneNode();cloneAttributes(t,i),n.tasks.push((function(){cloneAttributes(t,e)}))}}}))}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){const t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));null!=n&&n.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){const o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n0}function swap(e,t,n,r){r||(r={}),e=resolveTarget(e);const o=document.activeElement;let a={};try{a={elt:o,start:o?o.selectionStart:null,end:o?o.selectionEnd:null}}catch(e){}const s=makeSettleInfo(e);if("textContent"===n.swapStyle)e.textContent=t;else{let o=makeFragment(t);if(s.title=o.title,r.selectOOB){const e=r.selectOOB.split(",");for(let t=0;t0?getWindow().setTimeout(i,n.settleDelay):i()}function handleTriggerHeader(e,t,n){const r=e.getResponseHeader(t);if(0===r.indexOf("{")){const e=parseJSON(r);for(const t in e)if(e.hasOwnProperty(t)){let r=e[t];isRawObject(r)?n=void 0!==r.target?r.target:n:r={value:r},triggerEvent(n,t,r)}}else{const e=r.split(",");for(let t=0;t0;){const s=t[0];if("]"===s){if(r--,0===r){null===a&&(o+="true"),t.shift(),o+=")})";try{const t=maybeEval(e,(function(){return Function(o)()}),(function(){return!0}));return t.source=o,t}catch(e){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:e,source:o}),null}}}else"["===s&&r++;isPossibleRelativeReference(s,a,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o+=s,a=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}const INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){const r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);const t=o.length,n=consumeUntil(o,/[,\[\s]/);if(""!==n)if("every"===n){const t={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),t.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE),(a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a),r.push(t)}else{const t={trigger:n};var a;for((a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a);o.length>0&&","!==o[0];){consumeUntil(o,NOT_WHITESPACE);const n=o.shift();if("changed"===n)t.changed=!0;else if("once"===n)t.once=!0;else if("consume"===n)t.consume=!0;else if("delay"===n&&":"===o[0])o.shift(),t.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if("from"===n&&":"===o[0]){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else if("closest"===(s=consumeUntil(o,WHITESPACE_OR_COMMA))||"find"===s||"next"===s||"previous"===s){o.shift();const e=consumeCSSSelector(o);e.length>0&&(s+=" "+e)}t.from=s}else"target"===n&&":"===o[0]?(o.shift(),t.target=consumeCSSSelector(o)):"throttle"===n&&":"===o[0]?(o.shift(),t.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):"queue"===n&&":"===o[0]?(o.shift(),t.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):"root"===n&&":"===o[0]?(o.shift(),t[n]=consumeCSSSelector(o)):"threshold"===n&&":"===o[0]?(o.shift(),t[n]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()})}r.push(t)}o.length===t&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(","===o[0]&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){const t=getAttributeValue(e,"hx-trigger");let n=[];if(t){const r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){const r=getInternalData(e);r.timeout=getWindow().setTimeout((function(){bodyContains(e)&&!0!==r.cancelled&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))}),n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&0!==getRawAttribute(e,"href").indexOf("#")}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(""===e.target||"_self"===e.target)||"FORM"===e.tagName&&"dialog"!==String(getRawAttribute(e,"method")).toLowerCase()){let r,o;if(t.boosted=!0,"A"===e.tagName)r="get",o=getRawAttribute(e,"href");else{const t=getRawAttribute(e,"method");r=t?t.toLowerCase():"get",o=getRawAttribute(e,"action")}n.forEach((function(n){addEventListener(e,(function(e,t){const n=asElement(e);eltIsDisabled(n)?cleanUpElement(n):issueAjaxRequest(r,o,n,t)}),t,n,!0)}))}}function shouldCancel(e,t){const n=asElement(t);if(!n)return!1;if("submit"===e.type||"click"===e.type){if("FORM"===n.tagName)return!0;if(matches(n,'input[type="submit"], button')&&null!==closest(n,"form"))return!0;if(n instanceof HTMLAnchorElement&&n.href&&("#"===n.getAttribute("href")||0!==n.getAttribute("href").indexOf("#")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&"click"===t.type&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){const r=e.eventFilter;if(r)try{return!0!==r.call(t,n)}catch(e){const t=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:e,source:t}),!0}return!1}function addEventListener(e,t,n,r,o){const a=getInternalData(e);let s;s=r.from?querySelectorAllExt(e,r.from):[e],r.changed&&s.forEach((function(e){getInternalData(e).lastValue=e.value})),forEach(s,(function(s){const i=function(n){if(!bodyContains(e))return void s.removeEventListener(r.trigger,i);if(ignoreBoostedAnchorCtrlClick(e,n))return;if((o||shouldCancel(n,e))&&n.preventDefault(),maybeFilterEvent(r,e,n))return;const l=getInternalData(n);if(l.triggerSpec=r,null==l.handledFor&&(l.handledFor=[]),l.handledFor.indexOf(e)<0){if(l.handledFor.push(e),r.consume&&n.stopPropagation(),r.target&&n.target&&!matches(asElement(n.target),r.target))return;if(r.once){if(a.triggeredOnce)return;a.triggeredOnce=!0}if(r.changed){const e=getInternalData(s),t=s.value;if(e.lastValue===t)return;e.lastValue=t}if(a.delayed&&clearTimeout(a.delayed),a.throttle)return;r.throttle>0?a.throttle||(triggerEvent(e,"htmx:trigger"),t(e,n),a.throttle=getWindow().setTimeout((function(){a.throttle=null}),r.throttle)):r.delay>0?a.delayed=getWindow().setTimeout((function(){triggerEvent(e,"htmx:trigger"),t(e,n)}),r.delay):(triggerEvent(e,"htmx:trigger"),t(e,n))}};null==n.listenerInfos&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:i,on:s}),s.addEventListener(r.trigger,i)}))}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),setInterval((function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),(function(e){maybeReveal(e)})))}),200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",(function(){triggerEvent(e,"revealed")}),{once:!0}))}function loadImmediately(e,t,n,r){const o=function(){n.loaded||(n.loaded=!0,t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,(function(o){if(hasAttribute(e,"hx-"+o)){const a=getAttributeValue(e,"hx-"+o);r=!0,t.path=a,t.verb=o,n.forEach((function(n){addTriggerHandler(e,n,t,(function(e,t){const n=asElement(e);closest(n,htmx.config.disableSelector)?cleanUpElement(n):issueAjaxRequest(o,a,n,t)}))}))}})),r}function addTriggerHandler(e,t,n,r){if("revealed"===t.trigger)initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if("intersect"===t.trigger){const o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver((function(t){for(let n=0;n0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){const t=asElement(e);if(!t)return!1;const n=t.attributes;for(let e=0;e", "+e)).join(""))}return[]}function maybeSetLastButtonClicked(e){const t=closest(asElement(e.target),"button, input[type='submit']"),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){const t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getRelatedFormData(e){const t=closest(asElement(e.target),"button, input[type='submit']");if(!t)return;const n=resolveTarget("#"+getRawAttribute(t,"form"),t.getRootNode())||closest(t,"form");return n?getInternalData(n):void 0}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){const r=getInternalData(e);let o;Array.isArray(r.onHandlers)||(r.onHandlers=[]);const a=function(t){maybeEval(e,(function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,t))}))};e.addEventListener(t,a),r.onHandlers.push({event:t,listener:a})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;thtmx.config.historyCacheSize;)a.shift();for(;a.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(a));break}catch(e){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:e,cache:a}),a.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);const t=parseJSON(localStorage.getItem("htmx-history-cache"))||[];for(let n=0;n=200&&this.status<400){triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",n);const t=makeFragment(this.response),r=t.querySelector("[hx-history-elt],[data-hx-history-elt]")||t,o=getHistoryElement(),a=makeSettleInfo(o);handleTitle(t.title),swapInnerHTML(o,r,a),settleImmediately(a.tasks),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:this.response})}else triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",n)},t.send()}function restoreHistory(e){saveCurrentPageToHistory();const t=getCachedHistory(e=e||location.pathname+location.search);if(t){const n=makeFragment(t.content),r=getHistoryElement(),o=makeSettleInfo(r);handleTitle(n.title),swapInnerHTML(r,n,o),settleImmediately(o.tasks),getWindow().setTimeout((function(){window.scrollTo(0,t.scroll)}),0),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,item:t})}else htmx.config.refreshOnHistoryMiss?window.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return null==t&&(t=[e]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.classList.add.call(e.classList,htmx.config.requestClass)})),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return null==t&&(t=[]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.setAttribute("disabled",""),e.setAttribute("data-disabled-by-htmx","")})),t}function removeRequestIndicators(e,t){forEach(e,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&e.classList.remove.call(e.classList,htmx.config.requestClass)})),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&(e.removeAttribute("disabled"),e.removeAttribute("data-disabled-by-htmx"))}))}function haveSeenNode(e,t){for(let n=0;nt.indexOf(e)<0)):r.filter((e=>e!==t)),n.delete(e),forEach(r,(t=>n.append(e,t)))}}function processInputValue(e,t,n,r,o){if(null!=r&&!haveSeenNode(e,r)){if(e.push(r),shouldInclude(r)){const e=getRawAttribute(r,"name");let a=r.value;r instanceof HTMLSelectElement&&r.multiple&&(a=toArray(r.querySelectorAll("option:checked")).map((function(e){return e.value}))),r instanceof HTMLInputElement&&r.files&&(a=toArray(r.files)),addValueToFormData(e,a,t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,(function(r){e.indexOf(r)>=0?removeValueFromFormData(r.name,r.value,t):e.push(r),o&&validateElement(r,n)})),new FormData(r).forEach((function(e,n){e instanceof File&&""===e.name||addValueToFormData(n,e,t)})))}}function validateElement(e,t){const n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(t.push({elt:n,message:n.validationMessage,validity:n.validity}),triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(const n of t.keys())e.delete(n);return t.forEach((function(t,n){e.append(n,t)})),e}function getInputValues(e,t){const n=[],r=new FormData,o=new FormData,a=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let i=e instanceof HTMLFormElement&&!0!==e.noValidate||"true"===getAttributeValue(e,"hx-validate");if(s.lastButtonClicked&&(i=i&&!0!==s.lastButtonClicked.formNoValidate),"get"!==t&&processInputValue(n,o,a,closest(e,"form"),i),processInputValue(n,r,a,e,i),s.lastButtonClicked||"BUTTON"===e.tagName||"INPUT"===e.tagName&&"submit"===getRawAttribute(e,"type")){const t=s.lastButtonClicked||e;addValueToFormData(getRawAttribute(t,"name"),t.value,o)}return forEach(findAttributeTargets(e,"hx-include"),(function(e){processInputValue(n,r,a,asElement(e),i),matches(e,"form")||forEach(asParentNode(e).querySelectorAll(INPUT_SELECTOR),(function(e){processInputValue(n,r,a,e,i)}))})),overrideFormData(r,o),{errors:a,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){""!==e&&(e+="&"),"[object Object]"===String(n)&&(n=JSON.stringify(n));const r=encodeURIComponent(n);return e+(encodeURIComponent(t)+"=")+r}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach((function(e,n){t=appendParam(t,n,e)})),t}function getHeaders(e,t,n){const r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":getDocument().location.href};return getValuesForElement(e,"hx-headers",!1,r),void 0!==n&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){const n=getClosestAttributeValue(t,"hx-params");if(n){if("none"===n)return new FormData;if("*"===n)return e;if(0===n.indexOf("not "))return forEach(n.substr(4).split(","),(function(t){t=t.trim(),e.delete(t)})),e;{const t=new FormData;return forEach(n.split(","),(function(n){n=n.trim(),e.has(n)&&e.getAll(n).forEach((function(e){t.append(n,e)}))})),t}}return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){const n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){const e=splitOnWhitespace(n);if(e.length>0)for(let t=0;t0?a.join(":"):null;r.scroll=e,r.scrollTarget=o}else if(0===n.indexOf("show:")){var a;const e=(a=n.substr(5).split(":")).pop();o=a.length>0?a.join(":"):null,r.show=e,r.showTarget=o}else if(0===n.indexOf("focus-scroll:")){const e=n.substr(13);r.focusScroll="true"==e}else 0==t?r.swapStyle=n:logError("Unknown modifier in hx-swap: "+n)}}return r}function usesFormData(e){return"multipart/form-data"===getClosestAttributeValue(e,"hx-encoding")||matches(e,"form")&&"multipart/form-data"===getRawAttribute(e,"enctype")}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,(function(o){null==r&&(r=o.encodeParameters(e,n,t))})),null!=r?r:usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n)}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){const n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),"top"===t.scroll&&(n||o)&&((o=o||n).scrollTop=0),"bottom"===t.scroll&&(r||o)&&((o=o||r).scrollTop=o.scrollHeight)}if(t.show){if(o=null,t.showTarget){let e=t.showTarget;"window"===t.showTarget&&(e="body"),o=asElement(querySelectorExt(n,e))}"top"===t.show&&(n||o)&&(o=o||n).scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior}),"bottom"===t.show&&(r||o)&&(o=o||r).scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior})}}function getValuesForElement(e,t,n,r){if(null==r&&(r={}),null==e)return r;const o=getAttributeValue(e,t);if(o){let t,a=o.trim(),s=n;if("unset"===a)return null;0===a.indexOf("javascript:")?(a=a.substr(11),s=!0):0===a.indexOf("js:")&&(a=a.substr(3),s=!0),0!==a.indexOf("{")&&(a="{"+a+"}"),t=s?maybeEval(e,(function(){return Function("return ("+a+")")()}),{}):parseJSON(a);for(const e in t)t.hasOwnProperty(e)&&null==r[e]&&(r[e]=t[e])}return getValuesForElement(asElement(parentElt(e)),t,n,r)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t){return getValuesForElement(e,"hx-vars",!0,t)}function getHXValsForElement(e,t){return getValuesForElement(e,"hx-vals",!1,t)}function getExpressionVars(e){return mergeObjects(getHXVarsForElement(e),getHXValsForElement(e))}function safelySetHeaderValue(e,t,n){if(null!==n)try{e.setRequestHeader(t,n)}catch(r){e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL&&"undefined"!=typeof URL)try{const t=new URL(e.responseURL);return t.pathname+t.search}catch(t){triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return t.test(e.getAllResponseHeaders())}function ajaxHelper(e,t,n){return e=e.toLowerCase(),n?n instanceof Element||"string"==typeof n?issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n),returnPromise:!0}):issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:resolveTarget(n.target),swapOverride:n.swap,select:n.select,returnPromise:!0}):issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){const t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r,o;return"function"==typeof URL?(o=new URL(t,document.location.href),r=document.location.origin===o.origin):(o=t,r=startsWith(t,document.location.origin)),!(htmx.config.selfRequestsOnly&&!r)&&triggerEvent(e,"htmx:validateUrl",mergeObjects({url:o,sameHost:r},n))}function formDataFromObject(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e)e.hasOwnProperty(n)&&("function"==typeof e[n].forEach?e[n].forEach((function(e){t.append(n,e)})):"object"!=typeof e[n]||e[n]instanceof Blob?t.append(n,e[n]):t.append(n,JSON.stringify(e[n])));return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(n,r){return"number"==typeof r?n[r]:"length"===r?n.length:"push"===r?function(r){n.push(r),e.append(t,r)}:"function"==typeof n[r]?function(){n[r].apply(n,arguments),e.delete(t),n.forEach((function(n){e.append(t,n)}))}:n[r]&&1===n[r].length?n[r][0]:n[r]},set:function(n,r,o){return n[r]=o,e.delete(t),n.forEach((function(n){e.append(t,n)})),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if("symbol"==typeof n)return Reflect.get(t,n);if("toJSON"===n)return()=>Object.fromEntries(e);if(n in t)return"function"==typeof t[n]?function(){return e[n].apply(e,arguments)}:t[n];const r=e.getAll(n);return 0===r.length?void 0:1===r.length?r[0]:formDataArrayProxy(t,n,r)},set:function(e,t,n){return"string"==typeof t&&(e.delete(t),"function"==typeof n.forEach?n.forEach((function(n){e.append(t,n)})):"object"!=typeof n||n instanceof Blob?e.append(t,n):e.append(t,JSON.stringify(n)),!0)},deleteProperty:function(e,t){return"string"==typeof t&&e.delete(t),!0},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function issueAjaxRequest(e,t,n,r,o,a){let s=null,i=null;if((o=null!=o?o:{}).returnPromise&&"undefined"!=typeof Promise)var l=new Promise((function(e,t){s=e,i=t}));null==n&&(n=getDocument().body);const c=o.handler||handleAjaxResponse,u=o.select||null;if(!bodyContains(n))return maybeCall(s),l;const d=o.targetOverride||asElement(getTarget(n));if(null==d||d==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getAttributeValue(n,"hx-target")}),maybeCall(i),l;let f=getInternalData(n);const g=f.lastButtonClicked;if(g){const n=getRawAttribute(g,"formaction");null!=n&&(t=n);const r=getRawAttribute(g,"formmethod");null!=r&&"dialog"!==r.toLowerCase()&&(e=r)}const h=getClosestAttributeValue(n,"hx-confirm");if(void 0===a&&!1===triggerEvent(n,"htmx:confirm",{target:d,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(a){return issueAjaxRequest(e,t,n,r,o,!!a)},question:h}))return maybeCall(s),l;let m=n,p=getClosestAttributeValue(n,"hx-sync"),E=null,b=!1;if(p){const e=p.split(":"),t=e[0].trim();if(m="this"===t?findThisElement(n,"hx-sync"):asElement(querySelectorExt(n,t)),p=(e[1]||"drop").trim(),f=getInternalData(m),"drop"===p&&f.xhr&&!0!==f.abortable)return maybeCall(s),l;if("abort"===p){if(f.xhr)return maybeCall(s),l;b=!0}else"replace"===p?triggerEvent(m,"htmx:abort"):0===p.indexOf("queue")&&(E=(p.split(" ")[1]||"last").trim())}if(f.xhr){if(!f.abortable){if(null==E){if(r){const e=getInternalData(r);e&&e.triggerSpec&&e.triggerSpec.queue&&(E=e.triggerSpec.queue)}null==E&&(E="last")}return null==f.queuedRequests&&(f.queuedRequests=[]),"first"===E&&0===f.queuedRequests.length||"all"===E?f.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)})):"last"===E&&(f.queuedRequests=[],f.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)}))),maybeCall(s),l}triggerEvent(m,"htmx:abort")}const x=new XMLHttpRequest;f.xhr=x,f.abortable=b;const y=function(){f.xhr=null,f.abortable=!1,null!=f.queuedRequests&&f.queuedRequests.length>0&&f.queuedRequests.shift()()},v=getClosestAttributeValue(n,"hx-prompt");if(v){var w=prompt(v);if(null===w||!triggerEvent(n,"htmx:prompt",{prompt:w,target:d}))return maybeCall(s),y(),l}if(h&&!a&&!confirm(h))return maybeCall(s),y(),l;let S=getHeaders(n,d,w);"get"===e||usesFormData(n)||(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));const A=getInputValues(n,e);let C=A.errors;const T=A.formData;o.values&&overrideFormData(T,formDataFromObject(o.values));const H=overrideFormData(T,formDataFromObject(getExpressionVars(n)));let R=filterValues(H,n);htmx.config.getCacheBusterParam&&"get"===e&&R.set("org.htmx.cache-buster",getRawAttribute(d,"id")||"true"),null!=t&&""!==t||(t=getDocument().location.href);const O=getValuesForElement(n,"hx-request"),I=getInternalData(n).boosted;let D=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0;const _={boosted:I,useUrlParams:D,formData:R,parameters:formDataProxy(R),unfilteredFormData:H,unfilteredParameters:formDataProxy(H),headers:S,target:d,verb:e,errors:C,withCredentials:o.credentials||O.credentials||htmx.config.withCredentials,timeout:o.timeout||O.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",_))return maybeCall(s),y(),l;if(t=_.path,e=_.verb,S=_.headers,R=formDataFromObject(_.parameters),C=_.errors,D=_.useUrlParams,C&&C.length>0)return triggerEvent(n,"htmx:validation:halted",_),maybeCall(s),y(),l;const N=t.split("#"),L=N[0],q=N[1];let P=t;if(D&&(P=L,!R.keys().next().done&&(P.indexOf("?")<0?P+="?":P+="&",P+=urlEncode(R),q&&(P+="#"+q))),!verifyPath(n,P,_))return triggerErrorEvent(n,"htmx:invalidPath",_),maybeCall(i),l;if(x.open(e.toUpperCase(),P,!0),x.overrideMimeType("text/html"),x.withCredentials=_.withCredentials,x.timeout=_.timeout,O.noHeaders);else for(const e in S)if(S.hasOwnProperty(e)){const t=S[e];safelySetHeaderValue(x,e,t)}const F={xhr:x,target:d,requestConfig:_,etc:o,boosted:I,select:u,pathInfo:{requestPath:t,finalRequestPath:P,responsePath:null,anchor:q}};if(x.onload=function(){try{const e=hierarchyForElt(n);if(F.pathInfo.responsePath=getPathFromResponse(x),c(n,F),!0!==F.keepIndicators&&removeRequestIndicators(k,M),triggerEvent(n,"htmx:afterRequest",F),triggerEvent(n,"htmx:afterOnLoad",F),!bodyContains(n)){let t=null;for(;e.length>0&&null==t;){const n=e.shift();bodyContains(n)&&(t=n)}t&&(triggerEvent(t,"htmx:afterRequest",F),triggerEvent(t,"htmx:afterOnLoad",F))}maybeCall(s),y()}catch(e){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:e},F)),e}},x.onerror=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendError",F),maybeCall(i),y()},x.onabort=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendAbort",F),maybeCall(i),y()},x.ontimeout=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:timeout",F),maybeCall(i),y()},!triggerEvent(n,"htmx:beforeRequest",F))return maybeCall(s),y(),l;var k=addRequestIndicatorClasses(n),M=disableElements(n);forEach(["loadstart","loadend","progress","abort"],(function(e){forEach([x,x.upload],(function(t){t.addEventListener(e,(function(t){triggerEvent(n,"htmx:xhr:"+e,{lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total})}))}))})),triggerEvent(n,"htmx:beforeSend",F);const V=D?null:encodeParamsForBody(x,n,R);return x.send(V),l}function determineHistoryUpdates(e,t){const n=t.xhr;let r=null,o=null;if(hasHeader(n,/HX-Push:/i)?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,/HX-Push-Url:/i)?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,/HX-Replace-Url:/i)&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return"false"===r?{}:{type:o,path:r};const a=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,i=getClosestAttributeValue(e,"hx-push-url"),l=getClosestAttributeValue(e,"hx-replace-url"),c=getInternalData(e).boosted;let u=null,d=null;return i?(u="push",d=i):l?(u="replace",d=l):c&&(u="push",d=s||a),d?"false"===d?{}:("true"===d&&(d=s||a),t.pathInfo.anchor&&-1===d.indexOf("#")&&(d=d+"#"+t.pathInfo.anchor),{type:u,path:d}):{}}function codeMatches(e,t){return new RegExp(e.code).test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t0?getWindow().setTimeout(u,E.swapDelay):u()}d&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}const extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(null==t&&(t=[]),null==e)return t;null==n&&(n=[]);const r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),(function(e){if("ignore:"!=(e=e.replace(/ /g,"")).slice(0,7)){if(n.indexOf(e)<0){const n=extensions[e];n&&t.indexOf(n)<0&&t.push(n)}}else n.push(e.slice(7))})),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;function ready(e){isReady||"complete"===getDocument().readyState?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(!1!==htmx.config.includeIndicatorStyles){const e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"";getDocument().head.insertAdjacentHTML("beforeend"," ."+htmx.config.indicatorClass+"{opacity:0} ."+htmx.config.requestClass+" ."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+htmx.config.requestClass+"."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ")}}function getMetaConfig(){const e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){const e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return getDocument().addEventListener("DOMContentLoaded",(function(){isReady=!0})),ready((function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);const t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",(function(e){const t=getInternalData(e.target);t&&t.xhr&&t.xhr.abort()}));const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){e.state&&e.state.htmx?(restoreHistory(),forEach(t,(function(e){triggerEvent(e,"htmx:restored",{document:getDocument(),triggerEvent})}))):n&&n(e)},getWindow().setTimeout((function(){triggerEvent(e,"htmx:load",{}),e=null}),0)})),htmx}();const __WEBPACK_DEFAULT_EXPORT__=htmx}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={},htmx=__webpack_require__(335);let bunny={dialog:function(e){console.log(typeof e,e)}};const src_bunny=bunny;let tool={indexOf:function(e){return Array.prototype.indexOf.call(e.parentNode.children,e)},escapeHTML:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}};const src_tool=tool;htmx.A.defineExtension("bny-tab",{onEvent:function(e,t){return"htmx:beforeProcessNode"===e?function(e){const t=e.target;return null===t||!e.target.classList.contains("bny-tab")||(htmx.A.findAll(".bny-tab-item",t).forEach((e=>{htmx.A.on(e,"click",(function(){const e=src_tool.indexOf(this),t=this.parentNode.parentNode,n=htmx.A.find(t,`.bny-tab-body>div:nth-child(${e+1})`);htmx.A.findAll(t,".bny-tab-title .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.findAll(t,".bny-tab-body .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.addClass(this,"this"),htmx.A.addClass(n,"this"),n.classList.contains("process")||(htmx.A.process(n),htmx.A.addClass(n,"process"))}))})),!1)}(t):"htmx:afterProcessNode"===e?(function(e){const t=e.target;if(null!==t&&t.classList.contains("bny-tab-body")){const e=htmx.A.findAll(t.parentNode,".bny-tab-title .bny-tab-item").length,n=htmx.A.findAll(t,"div").length;if(e-n>0)for(let r=0;rdiv:nth-child(${n+1})`);200===e.detail.xhr.status?htmx.A.swap(r,e.detail.serverResponse,{swapStyle:"innerHTML"}):htmx.A.swap(r,"网络错误...",{swapStyle:"innerHTML"})}}(t),!1):void 0}}),htmx.A.defineExtension("bny-card",{onEvent:function(e,t){if("htmx:beforeSwap"===e){if(200===t.detail.xhr.status){const e=JSON.parse(t.detail.serverResponse);if(1===e.code){const n=e.data,r=n&&n.body?`\n

    ${n.body.title||""}

    \n
    ${n.body.subtitle||""}
    \n

    ${n.body.text||""}

    \n `:"";t.detail.elt.innerHTML=`\n
    \n ${n&&n.top_img?``:""}\n ${n&&n.header?`
    ${n.header}
    `:""}\n
    ${r}
    \n ${n&&n.footer?``:""}\n ${n&&n.bottom_img?``:""}\n
    `}else t.detail.elt.innerHTML=`
    ${data.msg}
    `}else t.detail.elt.innerHTML='
    网络错误
    ';return!1}}}),htmx.A.defineExtension("bny-code",{onEvent:function(e,t){if(null!==t.target&&"htmx:beforeSwap"===e){const e=t.target.getAttribute("hx-swap")||"innerHTML";if(200===t.detail.xhr.status){const n=`
    ${src_tool.escapeHTML(t.detail.serverResponse)}
    `;htmx.A.swap(t.target,n,{swapStyle:e})}else htmx.A.swap(t.target,"网络错误...",{swapStyle:e});return!1}}}),htmx.A.defineExtension("bny-marquee",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e&&t.target.classList.contains("bny-marquee")){const e=t.target.getAttribute("speed")||50;let o=htmx.A.find(t.target,".bny-marquee-content");var n=o.parentNode.offsetWidth,r=(o.offsetWidth+n)/Number(e);return o.style.animationDuration=r+"s",!1}}}),htmx.A.defineExtension("bny-alert",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e){const e=t.target;let n=document.createElement("span");n.setAttribute("class","alert-del"),n.textContent="X",e.append(n),htmx.A.on(n,"click",(function(){this.parentNode.style.opacity=0,setTimeout((()=>{this.parentNode.remove()}),235)}))}}}),function(){function e(t){let n="";return t.forEach((t=>{const r=t.icon?``:"",o=t.children?`${e(t.children)}`:"",a=t.url?t.url:"javascript:;",s=t.title?`${t.title}`:"";n+=`
  • ${r}${s}${o}
  • `})),n}function t(t){const n=t.target.getAttribute("hx-swap")||"innerHTML",r=null!==t.target.getAttribute("vertical")?"vertical":"";if(200===t.detail.xhr.status){const o=JSON.parse(t.detail.serverResponse);if(1===o.code){const a=o.data;htmx.A.swap(t.detail.elt,`${e(a)}`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,`加载失败${o.msg}...`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,"网络错误...",{swapStyle:n})}htmx.A.defineExtension("bny-menu",{onEvent:function(e,n){null!==n.target&&"htmx:beforeSwap"===e&&t(n)}})}(),window.htmx=htmx.A,window.bunny=src_bunny})(); \ No newline at end of file diff --git a/doc/dialog.md b/doc/dialog.md new file mode 100644 index 0000000..a2533c3 --- /dev/null +++ b/doc/dialog.md @@ -0,0 +1,13 @@ +对话框 + + + + + \ No newline at end of file diff --git a/highlight.min.js b/highlight.min.js index 3c2f2a3..bb51211 100644 --- a/highlight.min.js +++ b/highlight.min.js @@ -262,7 +262,7 @@ K("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"} return n.split(/\s+/).find((e=>_(e)||N(e)))})(e);if(_(t))return ;if(O("before:highlightElement",{el:e,language:t - }),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e) + }),e.dataset.highlighted)return /* void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e) */ ;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), diff --git a/index.html b/index.html index 7e03d83..b0aa9a3 100644 --- a/index.html +++ b/index.html @@ -51,6 +51,7 @@
    辅助
    公共类
    表格
    +
    对话框
    @@ -69,6 +70,7 @@
    +
    diff --git a/src/bunny.js b/src/bunny.js new file mode 100644 index 0000000..8bf65c1 --- /dev/null +++ b/src/bunny.js @@ -0,0 +1,10 @@ +/** + * API组件 + */ +let bunny = { + dialog: function (e) { + console.log(typeof e, e) + } +} + +export default bunny \ No newline at end of file diff --git a/src/index.js b/src/index.js index c57924d..1c1070d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ import htmx from "./htmx.js" +import bunny from "./bunny.js" import "./bny-tab.js" import "./bny-card.js" import "./bny-code.js" @@ -6,4 +7,5 @@ import "./bny-marquee.js" import "./bny-alert.js" import "./bny-menu.js" -window.htmx = htmx \ No newline at end of file +window.htmx = htmx +window.bunny = bunny \ No newline at end of file