nixos-config/modules/home/tww/dist/bundle.js

890 lines
174 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var htmx_min = {};
var hasRequiredHtmx_min;
function requireHtmx_min () {
if (hasRequiredHtmx_min) return htmx_min;
hasRequiredHtmx_min = 1;
(function(){const Q={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){const n=cn(e,t||"post");return n.values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null,disableInheritance:false,responseHandling:[{code:"204",swap:false},{code:"[23]..",swap:true},{code:"[45]..",swap:false,error:true}],allowNestedOobSwaps:true},parseInterval:null,_:null,version:"2.0.0-beta4"};Q.onLoad=$;Q.process=Dt;Q.on=be;Q.off=we;Q.trigger=he;Q.ajax=Hn;Q.find=r;Q.findAll=p;Q.closest=g;Q.remove=K;Q.addClass=W;Q.removeClass=o;Q.toggleClass=Y;Q.takeClass=ge;Q.swap=ze;Q.defineExtension=Un;Q.removeExtension=Bn;Q.logAll=z;Q.logNone=J;Q.parseInterval=d;Q._=_;const n={addTriggerHandler:Et,bodyContains:le,canAccessLocalStorage:j,findThisElement:Ee,filterValues:dn,swap:ze,hasAttribute:s,getAttributeValue:te,getClosestAttributeValue:re,getClosestMatch:T,getExpressionVars:Cn,getHeaders:hn,getInputValues:cn,getInternalData:ie,getSwapSpecification:pn,getTriggerSpecs:lt,getTarget:Ce,makeFragment:D,mergeObjects:ue,makeSettleInfo:xn,oobSwap:Te,querySelectorExt:fe,settleImmediately:Gt,shouldCancel:dt,triggerEvent:he,triggerErrorEvent:ae,withExtensions:Ut};const v=["get","post","put","delete","patch"];const R=v.map(function(e){return "[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");const O=e("head");function e(e,t=false){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2));}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3;}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60;}else {t=parseFloat(e);}return isNaN(t)?undefined:t}function ee(e,t){return e instanceof Element&&e.getAttribute(t)}function s(e,t){return !!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function te(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function ne(){return document}function H(e,t){return e.getRootNode?e.getRootNode({composed:t}):ne()}function T(e,t){while(e&&!t(e)){e=u(e);}return e||null}function q(e,t,n){const r=te(t,n);const o=te(t,"hx-disinherit");var i=te(t,"hx-inherit");if(e!==t){if(Q.config.disableInheritance){if(i&&(i==="*"||i.split(" ").indexOf(n)>=0)){return r}else {return null}}if(o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return "unset"}}return r}function re(t,n){let r=null;T(t,function(e){return !!(r=q(t,ce(e),n))});if(r!=="unset"){return r}}function a(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 L(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else {return ""}}function N(e){const t=new DOMParser;return t.parseFromString(e,"text/html")}function A(e,t){while(t.childNodes.length>0){e.append(t.childNodes[0]);}}function I(e){const t=ne().createElement("script");se(e.attributes,function(e){t.setAttribute(e.name,e.value);});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce;}return t}function P(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function k(e){Array.from(e.querySelectorAll("script")).forEach(e=>{if(P(e)){const t=I(e);const n=e.parentNode;try{n.insertBefore(t,e);}catch(e){w(e);}finally{e.remove();}}});}function D(e){const t=e.replace(O,"");const n=L(t);let r;if(n==="html"){r=new DocumentFragment;const i=N(e);A(r,i.body);r.title=i.title;}else if(n==="body"){r=new DocumentFragment;const i=N(t);A(r,i.body);r.title=i.title;}else {const i=N('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content;r.title=i.title;var o=r.querySelector("title");if(o&&o.parentNode===r){o.remove();r.title=o.innerText;}}if(r){if(Q.config.allowScriptTags){k(r);}else {r.querySelectorAll("script").forEach(e=>e.remove());}}return r}function oe(e){if(e){e();}}function t(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function M(e){return typeof e==="function"}function X(e){return t(e,"Object")}function ie(e){const t="htmx-internal-data";let n=e[t];if(!n){n=e[t]={};}return n}function F(t){const n=[];if(t){for(let e=0;e<t.length;e++){n.push(t[e]);}}return n}function se(t,n){if(t){for(let e=0;e<t.length;e++){n(t[e]);}}}function U(e){const t=e.getBoundingClientRect();const n=t.top;const r=t.bottom;return n<window.innerHeight&&r>=0}function le(e){const t=e.getRootNode&&e.getRootNode();if(t&&t instanceof window.ShadowRoot){return ne().body.contains(t.host)}else {return ne().body.contains(e)}}function B(e){return e.trim().split(/\s+/)}function ue(e,t){for(const n in t){if(t.hasOwnProperty(n)){e[n]=t[n];}}return e}function S(e){try{return JSON.parse(e)}catch(e){w(e);return null}}function j(){const e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function V(t){try{const e=new URL(t);if(e){t=e.pathname+e.search;}if(!/^\/$/.test(t)){t=t.replace(/\/+$/,"");}return t}catch(e){return t}}function _(e){return vn(ne().body,function(){return eval(e)})}function $(t){const e=Q.on("htmx:load",function(e){t(e.detail.elt);});return e}function z(){Q.logger=function(e,t,n){if(console){console.log(t,e,n);}};}function J(){Q.logger=null;}function r(e,t){if(typeof e!=="string"){return e.querySelector(t)}else {return r(ne(),e)}}function p(e,t){if(typeof e!=="string"){return e.querySelectorAll(t)}else {return p(ne(),e)}}function E(){return window}function K(e,t){e=y(e);if(t){E().setTimeout(function(){K(e);e=null;},t);}else {u(e).removeChild(e);}}function ce(e){return e instanceof Element?e:null}function G(e){return e instanceof HTMLElement?e:null}function Z(e){return typeof e==="string"?e:null}function h(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function W(e,t,n){e=ce(y(e));if(!e){return}if(n){E().setTimeout(function(){W(e,t);e=null;},n);}else {e.classList&&e.classList.add(t);}}function o(e,t,n){let r=ce(y(e));if(!r){return}if(n){E().setTimeout(function(){o(r,t);r=null;},n);}else {if(r.classList){r.classList.remove(t);if(r.classList.length===0){r.removeAttribute("class");}}}}function Y(e,t){e=y(e);e.classList.toggle(t);}function ge(e,t){e=y(e);se(e.parentElement.children,function(e){o(e,t);});W(ce(e),t);}function g(e,t){e=ce(y(e));if(e&&e.closest){return e.closest(t)}else {do{if(e==null||a(e,t)){return e}}while(e=e&&ce(u(e)));return null}}function l(e,t){return e.substring(0,t.length)===t}function pe(e,t){return e.substring(e.length-t.length)===t}function i(e){const t=e.trim();if(l(t,"<")&&pe(t,"/>")){return t.substring(1,t.length-2)}else {return t}}function m(e,t,n){e=y(e);if(t.indexOf("closest ")===0){return [g(ce(e),i(t.substr(8)))]}else if(t.indexOf("find ")===0){return [r(h(e),i(t.substr(5)))]}else if(t==="next"){return [ce(e).nextElementSibling]}else if(t.indexOf("next ")===0){return [me(e,i(t.substr(5)),!!n)]}else if(t==="previous"){return [ce(e).previousElementSibling]}else if(t.indexOf("previous ")===0){return [ye(e,i(t.substr(9)),!!n)]}else if(t==="document"){return [document]}else if(t==="window"){return [window]}else if(t==="body"){return [document.body]}else if(t==="root"){return [H(e,!!n)]}else if(t.indexOf("global ")===0){return m(e,t.slice(7),true)}else {return F(h(H(e,!!n)).querySelectorAll(i(t)))}}var me=function(t,e,n){const r=h(H(t,n)).querySelectorAll(e);for(let e=0;e<r.length;e++){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_PRECEDING){return o}}};var ye=function(t,e,n){const r=h(H(t,n)).querySelectorAll(e);for(let e=r.length-1;e>=0;e--){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}};function fe(e,t){if(typeof e!=="string"){return m(e,t)[0]}else {return m(ne().body,e)[0]}}function y(e,t){if(typeof e==="string"){return r(h(t)||document,e)}else {return e}}function xe(e,t,n){if(M(t)){return {target:ne().body,event:Z(e),listener:t}}else {return {target:y(e),event:Z(t),listener:n}}}function be(t,n,r){_n(function(){const e=xe(t,n,r);e.target.addEventListener(e.event,e.listener);});const e=M(n);return e?n:r}function we(t,n,r){_n(function(){const e=xe(t,n,r);e.target.removeEventListener(e.event,e.listener);});return M(n)?n:r}const ve=ne().createElement("output");function Se(e,t){const n=re(e,t);if(n){if(n==="this"){return [Ee(e,t)]}else {const r=m(e,n);if(r.length===0){w('The selector "'+n+'" on '+t+" returned no matches!");return [ve]}else {return r}}}}function Ee(e,t){return ce(T(e,function(e){return te(ce(e),t)!=null}))}function Ce(e){const t=re(e,"hx-target");if(t){if(t==="this"){return Ee(e,"hx-target")}else {return fe(e,t)}}else {const n=ie(e);if(n.boosted){return ne().body}else {return e}}}function Re(t){const n=Q.config.attributesToSettle;for(let e=0;e<n.length;e++){if(t===n[e]){return true}}return false}function Oe(t,n){se(t.attributes,function(e){if(!n.hasAttribute(e.name)&&Re(e.name)){t.removeAttribute(e.name);}});se(n.attributes,function(e){if(Re(e.name)){t.setAttribute(e.name,e.value);}});}function He(t,e){const n=jn(e);for(let e=0;e<n.length;e++){const r=n[e];try{if(r.isInlineSwap(t)){return true}}catch(e){w(e);}}return t==="outerHTML"}function Te(e,o,i){let t="#"+ee(o,"id");let s="outerHTML";if(e==="true");else if(e.indexOf(":")>0){s=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length);}else {s=e;}const n=ne().querySelectorAll(t);if(n){se(n,function(e){let t;const n=o.cloneNode(true);t=ne().createDocumentFragment();t.appendChild(n);if(!He(s,e)){t=h(n);}const r={shouldSwap:true,target:e,fragment:t};if(!he(e,"htmx:oobBeforeSwap",r))return;e=r.target;if(r.shouldSwap){_e(s,e,e,t,i);}se(i.elts,function(e){he(e,"htmx:oobAfterSwap",r);});});o.parentNode.removeChild(o);}else {o.parentNode.removeChild(o);ae(ne().body,"htmx:oobErrorNoTarget",{content:o});}return e}function qe(e){se(p(e,"[hx-preserve], [data-hx-preserve]"),function(e){const t=te(e,"id");const n=ne().getElementById(t);if(n!=null){e.parentNode.replaceChild(n,e);}});}function Le(l,e,u){se(e.querySelectorAll("[id]"),function(t){const n=ee(t,"id");if(n&&n.length>0){const r=n.replace("'","\\'");const o=t.tagName.replace(":","\\:");const e=h(l);const i=e&&e.querySelector(o+"[id='"+r+"']");if(i&&i!==e){const s=t.cloneNode();Oe(t,i);u.tasks.push(function(){Oe(t,s);});}}});}function Ne(e){return function(){o(e,Q.config.addedClass);Dt(ce(e));Ae(h(e));he(e,"htmx:load");}}function Ae(e){const t="[autofocus]";const n=G(a(e,t)?e:e.querySelector(t));if(n!=null){n.focus();}}function c(e,t,n,r){Le(e,n,r);while(n.childNodes.length>0){const o=n.firstChild;W(ce(o),Q.config.addedClass);e.insertBefore(o,t);if(o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE){r.tasks.push(Ne(o));}}}function Ie(e,t){let n=0;while(n<e.length){t=(t<<5)-t+e.charCodeAt(n++)|0;}return t}function Pe(t){let n=0;if(t.attributes){for(let e=0;e<t.attributes.length;e++){const r=t.attributes[e];if(r.value){n=Ie(r.name,n);n=Ie(r.value,n);}}}return n}function ke(t){const n=ie(t);if(n.onHandlers){for(let e=0;e<n.onHandlers.length;e++){const r=n.onHandlers[e];we(t,r.event,r.listener);}delete n.onHandlers;}}function De(e){const t=ie(e);if(t.timeout){clearTimeout(t.timeout);}if(t.listenerInfos){se(t.listenerInfos,function(e){if(e.on){we(e.on,e.trigger,e.listener);}});}ke(e);se(Object.keys(t),function(e){delete t[e];});}function f(e){he(e,"htmx:beforeCleanupElement");De(e);if(e.children){se(e.children,function(e){f(e);});}}function Me(t,e,n){let r;const o=t.previousSibling;c(u(t),t,e,n);if(o==null){r=u(t).firstChild;}else {r=o.nextSibling;}n.elts=n.elts.filter(function(e){return e!==t});while(r&&r!==t){if(r instanceof Element){n.elts.push(r);r=r.nextElementSibling;}else {r=null;}}f(t);if(t instanceof Element){t.remove();}else {t.parentNode.removeChild(t);}}function Xe(e,t,n){return c(e,e.firstChild,t,n)}function Fe(e,t,n){return c(u(e),e,t,n)}function Ue(e,t,n){return c(e,null,t,n)}function Be(e,t,n){return c(u(e),e.nextSibling,t,n)}function je(e){f(e);return u(e).removeChild(e)}function Ve(e,t,n){const r=e.firstChild;c(e,r,t,n);if(r){while(r.nextSibling){f(r.nextSibling);e.removeChild(r.nextSibling);}f(r);e.removeChild(r);}}function _e(t,e,n,r,o){switch(t){case "none":return;case "outerHTML":Me(n,r,o);return;case "afterbegin":Xe(n,r,o);return;case "beforebegin":Fe(n,r,o);return;case "beforeend":Ue(n,r,o);return;case "afterend":Be(n,r,o);return;case "delete":je(n);return;default:var i=jn(e);for(let e=0;e<i.length;e++){const s=i[e];try{const l=s.handleSwap(t,n,r,o);if(l){if(typeof l.length!=="undefined"){for(let e=0;e<l.length;e++){const u=l[e];if(u.nodeType!==Node.TEXT_NODE&&u.nodeType!==Node.COMMENT_NODE){o.tasks.push(Ne(u));}}}return}}catch(e){w(e);}}if(t==="innerHTML"){Ve(n,r,o);}else {_e(Q.config.defaultSwapStyle,e,n,r,o);}}}function $e(e,n){se(p(e,"[hx-swap-oob], [data-hx-swap-oob]"),function(e){if(Q.config.allowNestedOobSwaps||e.parentElement===null){const t=te(e,"hx-swap-oob");if(t!=null){Te(t,e,n);}}else {e.removeAttribute("hx-swap-oob");e.removeAttribute("data-hx-swap-oob");}});}function ze(e,t,r,o){if(!o){o={};}e=y(e);const n=document.activeElement;let i={};try{i={elt:n,start:n?n.selectionStart:null,end:n?n.selectionEnd:null};}catch(e){}const s=xn(e);if(r.swapStyle==="textContent"){e.textContent=t;}else {let n=D(t);s.title=n.title;if(o.selectOOB){const u=o.selectOOB.split(",");for(let t=0;t<u.length;t++){const c=u[t].split(":",2);let e=c[0].trim();if(e.indexOf("#")===0){e=e.substring(1);}const f=c[1]||"true";const a=n.querySelector("#"+e);if(a){Te(f,a,s);}}}$e(n,s);se(p(n,"template"),function(e){$e(e.content,s);if(e.content.childElementCount===0){e.remove();}});if(o.select){const h=ne().createDocumentFragment();se(n.querySelectorAll(o.select),function(e){h.appendChild(e);});n=h;}qe(n);_e(r.swapStyle,o.contextElement,e,n,s);}if(i.elt&&!le(i.elt)&&ee(i.elt,"id")){const d=document.getElementById(ee(i.elt,"id"));const g={preventScroll:r.focusScroll!==undefined?!r.focusScroll:!Q.config.defaultFocusScroll};if(d){if(i.start&&d.setSelectionRange){try{d.setSelectionRange(i.start,i.end);}catch(e){}}d.focus(g);}}e.classList.remove(Q.config.swappingClass);se(s.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass);}he(e,"htmx:afterSwap",o.eventInfo);});if(o.afterSwapCallback){o.afterSwapCallback();}if(!r.ignoreTitle){Dn(s.title);}const l=function(){se(s.tasks,function(e){e.call();});se(s.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass);}he(e,"htmx:afterSettle",o.eventInfo);});if(o.anchor){const e=ce(y("#"+o.anchor));if(e){e.scrollIntoView({block:"start",behavior:"auto"});}}bn(s.elts,r);if(o.afterSettleCallback){o.afterSettleCallback();}};if(r.settleDelay>0){E().setTimeout(l,r.settleDelay);}else {l();}}function Je(e,t,n){const r=e.getResponseHeader(t);if(r.indexOf("{")===0){const o=S(r);for(const i in o){if(o.hasOwnProperty(i)){let e=o[i];if(!X(e)){e={value:e};}he(n,i,e);}}}else {const s=r.split(",");for(let e=0;e<s.length;e++){he(n,s[e].trim(),[]);}}}const x=/[\s,]/;const Ge=/[_$a-zA-Z]/;const Ze=/[_$a-zA-Z0-9]/;const We=['"',"'","/"];const Ye=/[^\s]/;const Qe=/[{(]/;const et=/[})]/;function tt(e){const t=[];let n=0;while(n<e.length){if(Ge.exec(e.charAt(n))){var r=n;while(Ze.exec(e.charAt(n+1))){n++;}t.push(e.substr(r,n-r+1));}else if(We.indexOf(e.charAt(n))!==-1){const o=e.charAt(n);var r=n;n++;while(n<e.length&&e.charAt(n)!==o){if(e.charAt(n)==="\\"){n++;}n++;}t.push(e.substr(r,n-r+1));}else {const i=e.charAt(n);t.push(i);}n++;}return t}function nt(e,t,n){return Ge.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function rt(r,o,i){if(o[0]==="["){o.shift();let e=1;let t=" return (function("+i+"){ return (";let n=null;while(o.length>0){const s=o[0];if(s==="]"){e--;if(e===0){if(n===null){t=t+"true";}o.shift();t+=")})";try{const l=vn(r,function(){return Function(t)()},function(){return true});l.source=t;return l}catch(e){ae(ne().body,"htmx:syntax:error",{error:e,source:t});return null}}}else if(s==="["){e++;}if(nt(s,n,i)){t+="(("+i+"."+s+") ? ("+i+"."+s+") : (window."+s+"))";}else {t=t+s;}n=o.shift();}}}function b(e,t){let n="";while(e.length>0&&!t.test(e[0])){n+=e.shift();}return n}function ot(e){let t;if(e.length>0&&Qe.test(e[0])){e.shift();t=b(e,et).trim();e.shift();}else {t=b(e,x);}return t}const it="input, textarea, select";function st(e,t,n){const r=[];const o=tt(t);do{b(o,Ye);const l=o.length;const u=b(o,/[,\[\s]/);if(u!==""){if(u==="every"){const c={trigger:"every"};b(o,Ye);c.pollInterval=d(b(o,/[,\[\s]/));b(o,Ye);var i=rt(e,o,"event");if(i){c.eventFilter=i;}r.push(c);}else {const f={trigger:u};var i=rt(e,o,"event");if(i){f.eventFilter=i;}while(o.length>0&&o[0]!==","){b(o,Ye);const a=o.shift();if(a==="changed"){f.changed=true;}else if(a==="once"){f.once=true;}else if(a==="consume"){f.consume=true;}else if(a==="delay"&&o[0]===":"){o.shift();f.delay=d(b(o,x));}else if(a==="from"&&o[0]===":"){o.shift();if(Qe.test(o[0])){var s=ot(o);}else {var s=b(o,x);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();const h=ot(o);if(h.length>0){s+=" "+h;}}}f.from=s;}else if(a==="target"&&o[0]===":"){o.shift();f.target=ot(o);}else if(a==="throttle"&&o[0]===":"){o.shift();f.throttle=d(b(o,x));}else if(a==="queue"&&o[0]===":"){o.shift();f.queue=b(o,x);}else if(a==="root"&&o[0]===":"){o.shift();f[a]=ot(o);}else if(a==="threshold"&&o[0]===":"){o.shift();f[a]=b(o,x);}else {ae(e,"htmx:syntax:error",{token:o.shift()});}}r.push(f);}}if(o.length===l){ae(e,"htmx:syntax:error",{token:o.shift()});}b(o,Ye);}while(o[0]===","&&o.shift());if(n){n[t]=r;}return r}function lt(e){const t=te(e,"hx-trigger");let n=[];if(t){const r=Q.config.triggerSpecsCache;n=r&&r[t]||st(e,t,r);}if(n.length>0){return n}else if(a(e,"form")){return [{trigger:"submit"}]}else if(a(e,'input[type="button"], input[type="submit"]')){return [{trigger:"click"}]}else if(a(e,it)){return [{trigger:"change"}]}else {return [{trigger:"click"}]}}function ut(e){ie(e).cancelled=true;}function ct(e,t,n){const r=ie(e);r.timeout=E().setTimeout(function(){if(le(e)&&r.cancelled!==true){if(!pt(n,e,Xt("hx:poll:trigger",{triggerSpec:n,target:e}))){t(e);}ct(e,t,n);}},n.pollInterval);}function ft(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function at(e){return g(e,Q.config.disableSelector)}function ht(t,n,e){if(t instanceof HTMLAnchorElement&&ft(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){n.boosted=true;let r,o;if(t.tagName==="A"){r="get";o=ee(t,"href");}else {const i=ee(t,"method");r=i?i.toLowerCase():"get";o=ee(t,"action");}e.forEach(function(e){mt(t,function(e,t){const n=ce(e);if(at(n)){f(n);return}de(r,o,n,t);},n,e,true);});}}function dt(e,t){const n=ce(t);if(!n){return false}if(e.type==="submit"||e.type==="click"){if(n.tagName==="FORM"){return true}if(a(n,'input[type="submit"], button')&&g(n,"form")!==null){return true}if(n instanceof HTMLAnchorElement&&n.href&&(n.getAttribute("href")==="#"||n.getAttribute("href").indexOf("#")!==0)){return true}}return false}function gt(e,t){return ie(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function pt(e,t,n){const r=e.eventFilter;if(r){try{return r.call(t,n)!==true}catch(e){const o=r.source;ae(ne().body,"htmx:eventFilter:error",{error:e,source:o});return true}}return false}function mt(s,l,e,u,c){const f=ie(s);let t;if(u.from){t=m(s,u.from);}else {t=[s];}if(u.changed){t.forEach(function(e){const t=ie(e);t.lastValue=e.value;});}se(t,function(o){const i=function(e){if(!le(s)){o.removeEventListener(u.trigger,i);return}if(gt(s,e)){return}if(c||dt(e,s)){e.preventDefault();}if(pt(u,s,e)){return}const t=ie(e);t.triggerSpec=u;if(t.handledFor==null){t.handledFor=[];}if(t.handledFor.indexOf(s)<0){t.handledFor.push(s);if(u.consume){e.stopPropagation();}if(u.target&&e.target){if(!a(ce(e.target),u.target)){return}}if(u.once){if(f.triggeredOnce){return}else {f.triggeredOnce=true;}}if(u.changed){const n=ie(o);const r=o.value;if(n.lastValue===r){return}n.lastValue=r;}if(f.delayed){clearTimeout(f.delayed);}if(f.throttle){return}if(u.throttle>0){if(!f.throttle){l(s,e);f.throttle=E().setTimeout(function(){f.throttle=null;},u.throttle);}}else if(u.delay>0){f.delayed=E().setTimeout(function(){l(s,e);},u.delay);}else {he(s,"htmx:trigger");l(s,e);}}};if(e.listenerInfos==null){e.listenerInfos=[];}e.listenerInfos.push({trigger:u.trigger,listener:i,on:o});o.addEventListener(u.trigger,i);});}let yt=false;let xt=null;function bt(){if(!xt){xt=function(){yt=true;};window.addEventListener("scroll",xt);setInterval(function(){if(yt){yt=false;se(ne().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){wt(e);});}},200);}}function wt(e){if(!s(e,"data-hx-revealed")&&U(e)){e.setAttribute("data-hx-revealed","true");const t=ie(e);if(t.initHash){he(e,"revealed");}else {e.addEventListener("htmx:afterProcessNode",function(){he(e,"revealed");},{once:true});}}}function vt(e,t,n,r){const o=function(){if(!n.loaded){n.loaded=true;t(e);}};if(r>0){E().setTimeout(o,r);}else {o();}}function St(t,n,e){let i=false;se(v,function(r){if(s(t,"hx-"+r)){const o=te(t,"hx-"+r);i=true;n.path=o;n.verb=r;e.forEach(function(e){Et(t,e,n,function(e,t){const n=ce(e);if(g(n,Q.config.disableSelector)){f(n);return}de(r,o,n,t);});});}});return i}function Et(r,e,t,n){if(e.trigger==="revealed"){bt();mt(r,n,t,e);wt(ce(r));}else if(e.trigger==="intersect"){const o={};if(e.root){o.root=fe(r,e.root);}if(e.threshold){o.threshold=parseFloat(e.threshold);}const i=new IntersectionObserver(function(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.isIntersecting){he(r,"intersect");break}}},o);i.observe(ce(r));mt(ce(r),n,t,e);}else if(e.trigger==="load"){if(!pt(e,r,Xt("load",{elt:r}))){vt(ce(r),n,t,e.delay);}}else if(e.pollInterval>0){t.polling=true;ct(ce(r),n,e);}else {mt(r,n,t,e);}}function Ct(e){const t=ce(e);if(!t){return false}const n=t.attributes;for(let e=0;e<n.length;e++){const r=n[e].name;if(l(r,"hx-on:")||l(r,"data-hx-on:")||l(r,"hx-on-")||l(r,"data-hx-on-")){return true}}return false}const Rt=(new XPathEvaluator).createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or'+' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function Ot(e,t){if(Ct(e)){t.push(ce(e));}const n=Rt.evaluate(e);let r=null;while(r=n.iterateNext())t.push(ce(r));}function Ht(e){const t=[];if(e instanceof DocumentFragment){for(const n of e.childNodes){Ot(n,t);}}else {Ot(e,t);}return t}function Tt(e){if(e.querySelectorAll){const n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]";const r=[];for(const i in Xn){const s=Xn[i];if(s.getSelectors){var t=s.getSelectors();if(t){r.push(t);}}}const o=e.querySelectorAll(R+n+", form, [type='submit'],"+" [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(e=>", "+e).join(""));return o}else {return []}}function qt(e){const t=g(ce(e.target),"button, input[type='submit']");const n=Nt(e);if(n){n.lastButtonClicked=t;}}function Lt(e){const t=Nt(e);if(t){t.lastButtonClicked=null;}}function Nt(e){const t=g(ce(e.target),"button, input[type='submit']");if(!t){return}const n=y("#"+ee(t,"form"),t.getRootNode())||g(t,"form");if(!n){return}return ie(n)}function At(e){e.addEventListener("click",qt);e.addEventListener("focusin",qt);e.addEventListener("focusout",Lt);}function It(t,e,n){const r=ie(t);if(!Array.isArray(r.onHandlers)){r.onHandlers=[];}let o;const i=function(e){vn(t,function(){if(at(t)){return}if(!o){o=new Function("event",n);}o.call(t,e);});};t.addEventListener(e,i);r.onHandlers.push({event:e,listener:i});}function Pt(t){ke(t);for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;const r=t.attributes[e].value;if(l(n,"hx-on")||l(n,"data-hx-on")){const o=n.indexOf("-on")+3;const i=n.slice(o,o+1);if(i==="-"||i===":"){let e=n.slice(o+1);if(l(e,":")){e="htmx"+e;}else if(l(e,"-")){e="htmx:"+e.slice(1);}else if(l(e,"htmx-")){e="htmx:"+e.slice(5);}It(t,e,r);}}}}function kt(t){if(g(t,Q.config.disableSelector)){f(t);return}const n=ie(t);if(n.initHash!==Pe(t)){De(t);n.initHash=Pe(t);he(t,"htmx:beforeProcessNode");if(t.value){n.lastValue=t.value;}const e=lt(t);const r=St(t,n,e);if(!r){if(re(t,"hx-boost")==="true"){ht(t,n,e);}else if(s(t,"hx-trigger")){e.forEach(function(e){Et(t,e,n,function(){});});}}if(t.tagName==="FORM"||ee(t,"type")==="submit"&&s(t,"form")){At(t);}he(t,"htmx:afterProcessNode");}}function Dt(e){e=y(e);if(g(e,Q.config.disableSelector)){f(e);return}kt(e);se(Tt(e),function(e){kt(e);});se(Ht(e),Pt);}function Mt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xt(e,t){let n;if(window.CustomEvent&&typeof window.CustomEvent==="function"){n=new CustomEvent(e,{bubbles:true,cancelable:true,composed:true,detail:t});}else {n=ne().createEvent("CustomEvent");n.initCustomEvent(e,true,true,t);}return n}function ae(e,t,n){he(e,t,ue({error:t},n));}function Ft(e){return e==="htmx:afterProcessNode"}function Ut(e,t){se(jn(e),function(e){try{t(e);}catch(e){w(e);}});}function w(e){if(console.error){console.error(e);}else if(console.log){console.log("ERROR: ",e);}}function he(e,t,n){e=y(e);if(n==null){n={};}n.elt=e;const r=Xt(t,n);if(Q.logger&&!Ft(t)){Q.logger(e,t,n);}if(n.error){w(n.error);he(e,"htmx:error",{errorInfo:n});}let o=e.dispatchEvent(r);const i=Mt(t);if(o&&i!==t){const s=Xt(i,r.detail);o=o&&e.dispatchEvent(s);}Ut(ce(e),function(e){o=o&&(e.onEvent(t,r)!==false&&!r.defaultPrevented);});return o}let Bt=location.pathname+location.search;function jt(){const e=ne().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||ne().body}function Vt(t,e){if(!j()){return}const n=$t(e);const r=ne().title;const o=window.scrollY;if(Q.config.historyCacheSize<=0){localStorage.removeItem("htmx-history-cache");return}t=V(t);const i=S(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<i.length;e++){if(i[e].url===t){i.splice(e,1);break}}const s={url:t,content:n,title:r,scroll:o};he(ne().body,"htmx:historyItemCreated",{item:s,cache:i});i.push(s);while(i.length>Q.config.historyCacheSize){i.shift();}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){ae(ne().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift();}}}function _t(t){if(!j()){return null}t=V(t);const n=S(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<n.length;e++){if(n[e].url===t){return n[e]}}return null}function $t(e){const t=Q.config.requestClass;const n=e.cloneNode(true);se(p(n,"."+t),function(e){o(e,t);});return n.innerHTML}function zt(){const e=jt();const t=Bt||location.pathname+location.search;let n;try{n=ne().querySelector('[hx-history="false" i],[data-hx-history="false" i]');}catch(e){n=ne().querySelector('[hx-history="false"],[data-hx-history="false"]');}if(!n){he(ne().body,"htmx:beforeHistorySave",{path:t,historyElt:e});Vt(t,e);}if(Q.config.historyEnabled)history.replaceState({htmx:true},ne().title,window.location.href);}function Jt(e){if(Q.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(pe(e,"&")||pe(e,"?")){e=e.slice(0,-1);}}if(Q.config.historyEnabled){history.pushState({htmx:true},"",e);}Bt=e;}function Kt(e){if(Q.config.historyEnabled)history.replaceState({htmx:true},"",e);Bt=e;}function Gt(e){se(e,function(e){e.call(undefined);});}function Zt(o){const e=new XMLHttpRequest;const i={path:o,xhr:e};he(ne().body,"htmx:historyCacheMiss",i);e.open("GET",o,true);e.setRequestHeader("HX-Request","true");e.setRequestHeader("HX-History-Restore-Request","true");e.setRequestHeader("HX-Current-URL",ne().location.href);e.onload=function(){if(this.status>=200&&this.status<400){he(ne().body,"htmx:historyCacheMissLoad",i);const e=D(this.response);const t=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;const n=jt();const r=xn(n);Dn(e.title);Ve(n,t,r);Gt(r.tasks);Bt=o;he(ne().body,"htmx:historyRestore",{path:o,cacheMiss:true,serverResponse:this.response});}else {ae(ne().body,"htmx:historyCacheMissLoadError",i);}};e.send();}function Wt(e){zt();e=e||location.pathname+location.search;const t=_t(e);if(t){const n=D(t.content);const r=jt();const o=xn(r);Dn(n.title);Ve(r,n,o);Gt(o.tasks);E().setTimeout(function(){window.scrollTo(0,t.scroll);},0);Bt=e;he(ne().body,"htmx:historyRestore",{path:e,item:t});}else {if(Q.config.refreshOnHistoryMiss){window.location.reload(true);}else {Zt(e);}}}function Yt(e){let t=Se(e,"hx-indicator");if(t==null){t=[e];}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.classList.add.call(e.classList,Q.config.requestClass);});return t}function Qt(e){let t=Se(e,"hx-disabled-elt");if(t==null){t=[];}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","");});return t}function en(e,t){se(e,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList.remove.call(e.classList,Q.config.requestClass);}});se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.removeAttribute("disabled");}});}function tn(t,n){for(let e=0;e<t.length;e++){const r=t[e];if(r.isSameNode(n)){return true}}return false}function nn(e){const t=e;if(t.name===""||t.name==null||t.disabled||g(t,"fieldset[disabled]")){return false}if(t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"){return false}if(t.type==="checkbox"||t.type==="radio"){return t.checked}return true}function rn(t,e,n){if(t!=null&&e!=null){if(Array.isArray(e)){e.forEach(function(e){n.append(t,e);});}else {n.append(t,e);}}}function on(t,n,r){if(t!=null&&n!=null){let e=r.getAll(t);if(Array.isArray(n)){e=e.filter(e=>n.indexOf(e)<0);}else {e=e.filter(e=>e!==n);}r.delete(t);se(e,e=>r.append(t,e));}}function sn(t,n,r,o,i){if(o==null||tn(t,o)){return}else {t.push(o);}if(nn(o)){const s=ee(o,"name");let e=o.value;if(o instanceof HTMLSelectElement&&o.multiple){e=F(o.querySelectorAll("option:checked")).map(function(e){return e.value});}if(o instanceof HTMLInputElement&&o.files){e=F(o.files);}rn(s,e,n);if(i){ln(o,r);}}if(o instanceof HTMLFormElement){se(o.elements,function(e){if(t.indexOf(e)>=0){on(e.name,e.value,n);}else {t.push(e);}if(i){ln(e,r);}});new FormData(o).forEach(function(e,t){if(e instanceof File&&e.name===""){return}rn(t,e,n);});}}function ln(e,t){const n=e;if(n.willValidate){he(n,"htmx:validation:validate");if(!n.checkValidity()){t.push({elt:n,message:n.validationMessage,validity:n.validity});he(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity});}}}function un(t,e){for(const n of e.keys()){t.delete(n);e.getAll(n).forEach(function(e){t.append(n,e);});}return t}function cn(e,t){const n=[];const r=new FormData;const o=new FormData;const i=[];const s=ie(e);if(s.lastButtonClicked&&!le(s.lastButtonClicked)){s.lastButtonClicked=null;}let l=e instanceof HTMLFormElement&&e.noValidate!==true||te(e,"hx-validate")==="true";if(s.lastButtonClicked){l=l&&s.lastButtonClicked.formNoValidate!==true;}if(t!=="get"){sn(n,o,i,g(e,"form"),l);}sn(n,r,i,e,l);if(s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&ee(e,"type")==="submit"){const c=s.lastButtonClicked||e;const f=ee(c,"name");rn(f,c.value,o);}const u=Se(e,"hx-include");se(u,function(e){sn(n,r,i,ce(e),l);if(!a(e,"form")){se(h(e).querySelectorAll(it),function(e){sn(n,r,i,e,l);});}});un(r,o);return {errors:i,formData:r,values:An(r)}}function fn(e,t,n){if(e!==""){e+="&";}if(String(n)==="[object Object]"){n=JSON.stringify(n);}const r=encodeURIComponent(n);e+=encodeURIComponent(t)+"="+r;return e}function an(e){e=Ln(e);let n="";e.forEach(function(e,t){n=fn(n,t,e);});return n}function hn(e,t,n){const r={"HX-Request":"true","HX-Trigger":ee(e,"id"),"HX-Trigger-Name":ee(e,"name"),"HX-Target":te(t,"id"),"HX-Current-URL":ne().location.href};wn(e,"hx-headers",false,r);if(n!==undefined){r["HX-Prompt"]=n;}if(ie(e).boosted){r["HX-Boosted"]="true";}return r}function dn(n,e){const t=re(e,"hx-params");if(t){if(t==="none"){return new FormData}else if(t==="*"){return n}else if(t.indexOf("not ")===0){se(t.substr(4).split(","),function(e){e=e.trim();n.delete(e);});return n}else {const r=new FormData;se(t.split(","),function(t){t=t.trim();if(n.has(t)){n.getAll(t).forEach(function(e){r.append(t,e);});}});return r}}else {return n}}function gn(e){return !!ee(e,"href")&&ee(e,"href").indexOf("#")>=0}function pn(e,t){const n=t||re(e,"hx-swap");const r={swapStyle:ie(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&ie(e).boosted&&!gn(e)){r.show="top";}if(n){const s=B(n);if(s.length>0){for(let e=0;e<s.length;e++){const l=s[e];if(l.indexOf("swap:")===0){r.swapDelay=d(l.substr(5));}else if(l.indexOf("settle:")===0){r.settleDelay=d(l.substr(7));}else if(l.indexOf("transition:")===0){r.transition=l.substr(11)==="true";}else if(l.indexOf("ignoreTitle:")===0){r.ignoreTitle=l.substr(12)==="true";}else if(l.indexOf("scroll:")===0){const u=l.substr(7);var o=u.split(":");const c=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=c;r.scrollTarget=i;}else if(l.indexOf("show:")===0){const f=l.substr(5);var o=f.split(":");const a=o.pop();var i=o.length>0?o.join(":"):null;r.show=a;r.showTarget=i;}else if(l.indexOf("focus-scroll:")===0){const h=l.substr("focus-scroll:".length);r.focusScroll=h=="true";}else if(e==0){r.swapStyle=l;}else {w("Unknown modifier in hx-swap: "+l);}}}}return r}function mn(e){return re(e,"hx-encoding")==="multipart/form-data"||a(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function yn(t,n,r){let o=null;Ut(n,function(e){if(o==null){o=e.encodeParameters(t,r,n);}});if(o!=null){return o}else {if(mn(n)){return un(new FormData,Ln(r))}else {return an(r)}}}function xn(e){return {tasks:[],elts:[e]}}function bn(e,t){const n=e[0];const r=e[e.length-1];if(t.scroll){var o=null;if(t.scrollTarget){o=ce(fe(n,t.scrollTarget));}if(t.scroll==="top"&&(n||o)){o=o||n;o.scrollTop=0;}if(t.scroll==="bottom"&&(r||o)){o=o||r;o.scrollTop=o.scrollHeight;}}if(t.show){var o=null;if(t.showTarget){let e=t.showTarget;if(t.showTarget==="window"){e="body";}o=ce(fe(n,e));}if(t.show==="top"&&(n||o)){o=o||n;o.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior});}if(t.show==="bottom"&&(r||o)){o=o||r;o.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior});}}}function wn(r,e,o,i){if(i==null){i={};}if(r==null){return i}const s=te(r,e);if(s){let e=s.trim();let t=o;if(e==="unset"){return null}if(e.indexOf("javascript:")===0){e=e.substr(11);t=true;}else if(e.indexOf("js:")===0){e=e.substr(3);t=true;}if(e.indexOf("{")!==0){e="{"+e+"}";}let n;if(t){n=vn(r,function(){return Function("return ("+e+")")()},{});}else {n=S(e);}for(const l in n){if(n.hasOwnProperty(l)){if(i[l]==null){i[l]=n[l];}}}}return wn(ce(u(r)),e,o,i)}function vn(e,t,n){if(Q.config.allowEval){return t()}else {ae(e,"htmx:evalDisallowedError");return n}}function Sn(e,t){return wn(e,"hx-vars",true,t)}function En(e,t){return wn(e,"hx-vals",false,t)}function Cn(e){return ue(Sn(e),En(e))}function Rn(t,n,r){if(r!==null){try{t.setRequestHeader(n,r);}catch(e){t.setRequestHeader(n,encodeURIComponent(r));t.setRequestHeader(n+"-URI-AutoEncoded","true");}}}function On(t){if(t.responseURL&&typeof URL!=="undefined"){try{const e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ae(ne().body,"htmx:badResponseUrl",{url:t.responseURL});}}}function C(e,t){return t.test(e.getAllResponseHeaders())}function Hn(e,t,n){e=e.toLowerCase();if(n){if(n instanceof Element||typeof n==="string"){return de(e,t,null,null,{targetOverride:y(n),returnPromise:true})}else {return de(e,t,y(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:y(n.target),swapOverride:n.swap,select:n.select,returnPromise:true})}}else {return de(e,t,null,null,{returnPromise:true})}}function Tn(e){const t=[];while(e){t.push(e);e=e.parentElement;}return t}function qn(e,t,n){let r;let o;if(typeof URL==="function"){o=new URL(t,document.location.href);const i=document.location.origin;r=i===o.origin;}else {o=t;r=l(t,document.location.origin);}if(Q.config.selfRequestsOnly){if(!r){return false}}return he(e,"htmx:validateUrl",ue({url:o,sameHost:r},n))}function Ln(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e){if(e.hasOwnProperty(n)){if(typeof e[n].forEach==="function"){e[n].forEach(function(e){t.append(n,e);});}else if(typeof e[n]==="object"){t.append(n,JSON.stringify(e[n]));}else {t.append(n,e[n]);}}}return t}function Nn(r,o,e){return new Proxy(e,{get:function(t,e){if(typeof e==="number")return t[e];if(e==="length")return t.length;if(e==="push"){return function(e){t.push(e);r.append(o,e);}}if(typeof t[e]==="function"){return function(){t[e].apply(t,arguments);r.delete(o);t.forEach(function(e){r.append(o,e);});}}if(t[e]&&t[e].length===1){return t[e][0]}else {return t[e]}},set:function(e,t,n){e[t]=n;r.delete(o);e.forEach(function(e){r.append(o,e);});return true}})}function An(r){return new Proxy(r,{get:function(e,t){if(typeof t==="symbol"){return Reflect.get(e,t)}if(t==="toJSON"){return ()=>Object.fromEntries(r)}if(t in e){if(typeof e[t]==="function"){return function(){return r[t].apply(r,arguments)}}else {return e[t]}}const n=r.getAll(t);if(n.length===0){return undefined}else if(n.length===1){return n[0]}else {return Nn(e,t,n)}},set:function(t,n,e){if(typeof n!=="string"){return false}t.delete(n);if(typeof e.forEach==="function"){e.forEach(function(e){t.append(n,e);});}else {t.append(n,e);}return true},deleteProperty:function(e,t){if(typeof t==="string"){e.delete(t);}return true},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function de(t,n,r,o,i,D){let s=null;let l=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var e=new Promise(function(e,t){s=e;l=t;});}if(r==null){r=ne().body;}const M=i.handler||Mn;const X=i.select||null;if(!le(r)){oe(s);return e}const u=i.targetOverride||ce(Ce(r));if(u==null||u==ve){ae(r,"htmx:targetError",{target:te(r,"hx-target")});oe(l);return e}let c=ie(r);const f=c.lastButtonClicked;if(f){const L=ee(f,"formaction");if(L!=null){n=L;}const N=ee(f,"formmethod");if(N!=null){if(N.toLowerCase()!=="dialog"){t=N;}}}const a=re(r,"hx-confirm");if(D===undefined){const K=function(e){return de(t,n,r,o,i,!!e)};const G={target:u,elt:r,path:n,verb:t,triggeringEvent:o,etc:i,issueRequest:K,question:a};if(he(r,"htmx:confirm",G)===false){oe(s);return e}}let h=r;let d=re(r,"hx-sync");let g=null;let F=false;if(d){const A=d.split(":");const I=A[0].trim();if(I==="this"){h=Ee(r,"hx-sync");}else {h=ce(fe(r,I));}d=(A[1]||"drop").trim();c=ie(h);if(d==="drop"&&c.xhr&&c.abortable!==true){oe(s);return e}else if(d==="abort"){if(c.xhr){oe(s);return e}else {F=true;}}else if(d==="replace"){he(h,"htmx:abort");}else if(d.indexOf("queue")===0){const Z=d.split(" ");g=(Z[1]||"last").trim();}}if(c.xhr){if(c.abortable){he(h,"htmx:abort");}else {if(g==null){if(o){const P=ie(o);if(P&&P.triggerSpec&&P.triggerSpec.queue){g=P.triggerSpec.queue;}}if(g==null){g="last";}}if(c.queuedRequests==null){c.queuedRequests=[];}if(g==="first"&&c.queuedRequests.length===0){c.queuedRequests.push(function(){de(t,n,r,o,i);});}else if(g==="all"){c.queuedRequests.push(function(){de(t,n,r,o,i);});}else if(g==="last"){c.queuedRequests=[];c.queuedRequests.push(function(){de(t,n,r,o,i);});}oe(s);return e}}const p=new XMLHttpRequest;c.xhr=p;c.abortable=F;const m=function(){c.xhr=null;c.abortable=false;if(c.queuedRequests!=null&&c.queuedRequests.length>0){const e=c.queuedRequests.shift();e();}};const U=re(r,"hx-prompt");if(U){var y=prompt(U);if(y===null||!he(r,"htmx:prompt",{prompt:y,target:u})){oe(s);m();return e}}if(a&&!D){if(!confirm(a)){oe(s);m();return e}}let x=hn(r,u,y);if(t!=="get"&&!mn(r)){x["Content-Type"]="application/x-www-form-urlencoded";}if(i.headers){x=ue(x,i.headers);}const B=cn(r,t);let b=B.errors;const j=B.formData;if(i.values){un(j,Ln(i.values));}const V=Ln(Cn(r));const w=un(j,V);let v=dn(w,r);if(Q.config.getCacheBusterParam&&t==="get"){v.set("org.htmx.cache-buster",ee(u,"id")||"true");}if(n==null||n===""){n=ne().location.href;}const S=wn(r,"hx-request");const _=ie(r).boosted;let E=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;const C={boosted:_,useUrlParams:E,formData:v,parameters:An(v),unfilteredFormData:w,unfilteredParameters:An(w),headers:x,target:u,verb:t,errors:b,withCredentials:i.credentials||S.credentials||Q.config.withCredentials,timeout:i.timeout||S.timeout||Q.config.timeout,path:n,triggeringEvent:o};if(!he(r,"htmx:configRequest",C)){oe(s);m();return e}n=C.path;t=C.verb;x=C.headers;v=Ln(C.parameters);b=C.errors;E=C.useUrlParams;if(b&&b.length>0){he(r,"htmx:validation:halted",C);oe(s);m();return e}const $=n.split("#");const z=$[0];const R=$[1];let O=n;if(E){O=z;const W=!v.keys().next().done;if(W){if(O.indexOf("?")<0){O+="?";}else {O+="&";}O+=an(v);if(R){O+="#"+R;}}}if(!qn(r,O,C)){ae(r,"htmx:invalidPath",C);oe(l);return e}p.open(t.toUpperCase(),O,true);p.overrideMimeType("text/html");p.withCredentials=C.withCredentials;p.timeout=C.timeout;if(S.noHeaders);else {for(const k in x){if(x.hasOwnProperty(k)){const Y=x[k];Rn(p,k,Y);}}}const H={xhr:p,target:u,requestConfig:C,etc:i,boosted:_,select:X,pathInfo:{requestPath:n,finalRequestPath:O,responsePath:null,anchor:R}};p.onload=function(){try{const t=Tn(r);H.pathInfo.responsePath=On(p);M(r,H);en(T,q);he(r,"htmx:afterRequest",H);he(r,"htmx:afterOnLoad",H);if(!le(r)){let e=null;while(t.length>0&&e==null){const n=t.shift();if(le(n)){e=n;}}if(e){he(e,"htmx:afterRequest",H);he(e,"htmx:afterOnLoad",H);}}oe(s);m();}catch(e){ae(r,"htmx:onLoadError",ue({error:e},H));throw e}};p.onerror=function(){en(T,q);ae(r,"htmx:afterRequest",H);ae(r,"htmx:sendError",H);oe(l);m();};p.onabort=function(){en(T,q);ae(r,"htmx:afterRequest",H);ae(r,"htmx:sendAbort",H);oe(l);m();};p.ontimeout=function(){en(T,q);ae(r,"htmx:afterRequest",H);ae(r,"htmx:timeout",H);oe(l);m();};if(!he(r,"htmx:beforeRequest",H)){oe(s);m();return e}var T=Yt(r);var q=Qt(r);se(["loadstart","loadend","progress","abort"],function(t){se([p,p.upload],function(e){e.addEventListener(t,function(e){he(r,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total});});});});he(r,"htmx:beforeSend",H);const J=E?null:yn(p,r,v);p.send(J);return e}function In(e,t){const n=t.xhr;let r=null;let o=null;if(C(n,/HX-Push:/i)){r=n.getResponseHeader("HX-Push");o="push";}else if(C(n,/HX-Push-Url:/i)){r=n.getResponseHeader("HX-Push-Url");o="push";}else if(C(n,/HX-Replace-Url:/i)){r=n.getResponseHeader("HX-Replace-Url");o="replace";}if(r){if(r==="false"){return {}}else {return {type:o,path:r}}}const i=t.pathInfo.finalRequestPath;const s=t.pathInfo.responsePath;const l=re(e,"hx-push-url");const u=re(e,"hx-replace-url");const c=ie(e).boosted;let f=null;let a=null;if(l){f="push";a=l;}else if(u){f="replace";a=u;}else if(c){f="push";a=s||i;}if(a){if(a==="false"){return {}}if(a==="true"){a=s||i;}if(t.pathInfo.anchor&&a.indexOf("#")===-1){a=a+"#"+t.pathInfo.anchor;}return {type:f,path:a}}else {return {}}}function Pn(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function kn(e){for(var t=0;t<Q.config.responseHandling.length;t++){var n=Q.config.responseHandling[t];if(Pn(n,e.status)){return n}}return {swap:false}}function Dn(e){if(e){const t=r("title");if(t){t.innerHTML=e;}else {window.document.title=e;}}}function Mn(o,i){const s=i.xhr;let l=i.target;const e=i.etc;const u=i.select;if(!he(o,"htmx:beforeOnLoad",i))return;if(C(s,/HX-Trigger:/i)){Je(s,"HX-Trigger",o);}if(C(s,/HX-Location:/i)){zt();let e=s.getResponseHeader("HX-Location");var t;if(e.indexOf("{")===0){t=S(e);e=t.path;delete t.path;}Hn("get",e,t).then(function(){Jt(e);});return}const n=C(s,/HX-Refresh:/i)&&s.getResponseHeader("HX-Refresh")==="true";if(C(s,/HX-Redirect:/i)){location.href=s.getResponseHeader("HX-Redirect");n&&location.reload();return}if(n){location.reload();return}if(C(s,/HX-Retarget:/i)){if(s.getResponseHeader("HX-Retarget")==="this"){i.target=o;}else {i.target=ce(fe(o,s.getResponseHeader("HX-Retarget")));}}const c=In(o,i);const r=kn(s);const f=r.swap;let a=!!r.error;let h=Q.config.ignoreTitle||r.ignoreTitle;let d=r.select;if(r.target){i.target=ce(fe(o,r.target));}var g=e.swapOverride;if(g==null&&r.swapOverride){g=r.swapOverride;}if(C(s,/HX-Retarget:/i)){if(s.getResponseHeader("HX-Retarget")==="this"){i.target=o;}else {i.target=ce(fe(o,s.getResponseHeader("HX-Retarget")));}}if(C(s,/HX-Reswap:/i)){g=s.getResponseHeader("HX-Reswap");}var p=s.response;var m=ue({shouldSwap:f,serverResponse:p,isError:a,ignoreTitle:h,selectOverride:d},i);if(r.event&&!he(l,r.event,m))return;if(!he(l,"htmx:beforeSwap",m))return;l=m.target;p=m.serverResponse;a=m.isError;h=m.ignoreTitle;d=m.selectOverride;i.target=l;i.failed=a;i.successful=!a;if(m.shouldSwap){if(s.status===286){ut(o);}Ut(o,function(e){p=e.transformResponse(p,s,o);});if(c.type){zt();}if(C(s,/HX-Reswap:/i)){g=s.getResponseHeader("HX-Reswap");}var y=pn(o,g);if(!y.hasOwnProperty("ignoreTitle")){y.ignoreTitle=h;}l.classList.add(Q.config.swappingClass);let n=null;let r=null;if(u){d=u;}if(C(s,/HX-Reselect:/i)){d=s.getResponseHeader("HX-Reselect");}const x=re(o,"hx-select-oob");const b=re(o,"hx-select");let e=function(){try{if(c.type){he(ne().body,"htmx:beforeHistoryUpdate",ue({history:c},i));if(c.type==="push"){Jt(c.path);he(ne().body,"htmx:pushedIntoHistory",{path:c.path});}else {Kt(c.path);he(ne().body,"htmx:replacedInHistory",{path:c.path});}}ze(l,p,y,{select:d||b,selectOOB:x,eventInfo:i,anchor:i.pathInfo.anchor,contextElement:o,afterSwapCallback:function(){if(C(s,/HX-Trigger-After-Swap:/i)){let e=o;if(!le(o)){e=ne().body;}Je(s,"HX-Trigger-After-Swap",e);}},afterSettleCallback:function(){if(C(s,/HX-Trigger-After-Settle:/i)){let e=o;if(!le(o)){e=ne().body;}Je(s,"HX-Trigger-After-Settle",e);}oe(n);}});}catch(e){ae(o,"htmx:swapError",i);oe(r);throw e}};let t=Q.config.globalViewTransitions;if(y.hasOwnProperty("transition")){t=y.transition;}if(t&&he(o,"htmx:beforeTransition",i)&&typeof Promise!=="undefined"&&document.startViewTransition){const w=new Promise(function(e,t){n=e;r=t;});const v=e;e=function(){document.startViewTransition(function(){v();return w});};}if(y.swapDelay>0){E().setTimeout(e,y.swapDelay);}else {e();}}if(a){ae(o,"htmx:responseError",ue({error:"Response Status Error Code "+s.status+" from "+i.pathInfo.requestPath},i));}}const Xn={};function Fn(){return {init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,n,r){return false},encodeParameters:function(e,t,n){return null}}}function Un(e,t){if(t.init){t.init(n);}Xn[e]=ue(Fn(),t);}function Bn(e){delete Xn[e];}function jn(e,n,r){if(n==undefined){n=[];}if(e==undefined){return n}if(r==undefined){r=[];}const t=te(e,"hx-ext");if(t){se(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){r.push(e.slice(7));return}if(r.indexOf(e)<0){const t=Xn[e];if(t&&n.indexOf(t)<0){n.push(t);}}});}return jn(ce(u(e)),n,r)}var Vn=false;ne().addEventListener("DOMContentLoaded",function(){Vn=true;});function _n(e){if(Vn||ne().readyState==="complete"){e();}else {ne().addEventListener("DOMContentLoaded",e);}}function $n(){if(Q.config.includeIndicatorStyles!==false){const e=Q.config.inlineStyleNonce?` nonce="${Q.config.inlineStyleNonce}"`:"";ne().head.insertAdjacentHTML("beforeend","<style"+e+"> ."+Q.config.indicatorClass+"{opacity:0} ."+Q.config.requestClass+" ."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+Q.config.requestClass+"."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} </style>");}}function zn(){const e=ne().querySelector('meta[name="htmx-config"]');if(e){return S(e.content)}else {return null}}function Jn(){const e=zn();if(e){Q.config=ue(Q.config,e);}}_n(function(){Jn();$n();let e=ne().body;Dt(e);const t=ne().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){const t=e.target;const n=ie(t);if(n&&n.xhr){n.xhr.abort();}});const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){if(e.state&&e.state.htmx){Wt();se(t,function(e){he(e,"htmx:restored",{document:ne(),triggerEvent:he});});}else {if(n){n(e);}}};E().setTimeout(function(){he(e,"htmx:load",{});e=null;},0);});return Q})();
return htmx_min;
}
requireHtmx_min();
var _hyperscript_min$1 = {exports: {}};
var _hyperscript_min = _hyperscript_min$1.exports;
var hasRequired_hyperscript_min;
function require_hyperscript_min () {
if (hasRequired_hyperscript_min) return _hyperscript_min$1.exports;
hasRequired_hyperscript_min = 1;
(function (module, exports) {
(function(e,t){const r=t(e);if(typeof exports["nodeName"]!=="string"){module.exports=r;}else {e["_hyperscript"]=r;if("document"in e)e["_hyperscript"].browserInit();}})(typeof self!=="undefined"?self:_hyperscript_min,(e=>{const t={dynamicResolvers:[function(e,t){if(e==="Fixed"){return Number(t).toFixed()}else if(e.indexOf("Fixed:")===0){let r=e.split(":")[1];return Number(t).toFixed(parseInt(r))}}],String:function(e){if(e.toString){return e.toString()}else {return ""+e}},Int:function(e){return parseInt(e)},Float:function(e){return parseFloat(e)},Number:function(e){return Number(e)},Date:function(e){return new Date(e)},Array:function(e){return Array.from(e)},JSON:function(e){return JSON.stringify(e)},Object:function(e){if(e instanceof String){e=e.toString();}if(typeof e==="string"){return JSON.parse(e)}else {return Object.assign({},e)}}};const r={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},conversions:t};class n{static OP_TABLE={"+":"PLUS","-":"MINUS","*":"MULTIPLY","/":"DIVIDE",".":"PERIOD","..":"ELLIPSIS","\\":"BACKSLASH",":":"COLON","%":"PERCENT","|":"PIPE","!":"EXCLAMATION","?":"QUESTION","#":"POUND","&":"AMPERSAND",$:"DOLLAR",";":"SEMI",",":"COMMA","(":"L_PAREN",")":"R_PAREN","<":"L_ANG",">":"R_ANG","<=":"LTE_ANG",">=":"GTE_ANG","==":"EQ","===":"EQQ","!=":"NEQ","!==":"NEQQ","{":"L_BRACE","}":"R_BRACE","[":"L_BRACKET","]":"R_BRACKET","=":"EQUALS","~":"TILDE"};static isValidCSSClassChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isValidCSSIDChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isWhitespace(e){return e===" "||e==="\t"||n.isNewline(e)}static positionString(e){return "[Line: "+e.line+", Column: "+e.column+"]"}static isNewline(e){return e==="\r"||e==="\n"}static isNumeric(e){return e>="0"&&e<="9"}static isAlpha(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}static isIdentifierChar(e,t){return e==="_"||e==="$"}static isReservedChar(e){return e==="`"||e==="^"}static isValidSingleQuoteStringStart(e){if(e.length>0){var t=e[e.length-1];if(t.type==="IDENTIFIER"||t.type==="CLASS_REF"||t.type==="ID_REF"){return false}if(t.op&&(t.value===">"||t.value===")")){return false}}return true}static tokenize(e,t){var r=[];var a=e;var o=0;var s=0;var u=1;var l="<START>";var c=0;function f(){return t&&c===0}while(o<a.length){if(q()==="-"&&I()==="-"&&(n.isWhitespace(C(2))||C(2)===""||C(2)==="-")||q()==="/"&&I()==="/"&&(n.isWhitespace(C(2))||C(2)===""||C(2)==="/")){h();}else if(q()==="/"&&I()==="*"&&(n.isWhitespace(C(2))||C(2)===""||C(2)==="*")){v();}else {if(n.isWhitespace(q())){r.push(L());}else if(!A()&&q()==="."&&(n.isAlpha(I())||I()==="{"||I()==="-")){r.push(d());}else if(!A()&&q()==="#"&&(n.isAlpha(I())||I()==="{")){r.push(k());}else if(q()==="["&&I()==="@"){r.push(E());}else if(q()==="@"){r.push(T());}else if(q()==="*"&&n.isAlpha(I())){r.push(y());}else if(f()&&(n.isAlpha(q())||q()==="\\")){r.push(x());}else if(!f()&&(n.isAlpha(q())||n.isIdentifierChar(q()))){r.push(g());}else if(n.isNumeric(q())){r.push(b());}else if(!f()&&(q()==='"'||q()==="`")){r.push(S());}else if(!f()&&q()==="'"){if(n.isValidSingleQuoteStringStart(r)){r.push(S());}else {r.push(w());}}else if(n.OP_TABLE[q()]){if(l==="$"&&q()==="{"){c++;}if(q()==="}"){c--;}r.push(w());}else if(f()||n.isReservedChar(q())){r.push(p("RESERVED",R()));}else {if(o<a.length){throw Error("Unknown token: "+q()+" ")}}}}return new i(r,[],a);function m(e,t){var r=p(e,t);r.op=true;return r}function p(e,t){return {type:e,value:t||"",start:o,end:o+1,column:s,line:u}}function h(){while(q()&&!n.isNewline(q())){R();}R();}function v(){while(q()&&!(q()==="*"&&I()==="/")){R();}R();R();}function d(){var e=p("CLASS_REF");var t=R();if(q()==="{"){e.template=true;t+=R();while(q()&&q()!=="}"){t+=R();}if(q()!=="}"){throw Error("Unterminated class reference")}else {t+=R();}}else {while(n.isValidCSSClassChar(q())||q()==="\\"){if(q()==="\\"){R();}t+=R();}}e.value=t;e.end=o;return e}function E(){var e=p("ATTRIBUTE_REF");var t=R();while(o<a.length&&q()!=="]"){t+=R();}if(q()==="]"){t+=R();}e.value=t;e.end=o;return e}function T(){var e=p("ATTRIBUTE_REF");var t=R();while(n.isValidCSSIDChar(q())){t+=R();}if(q()==="="){t+=R();if(q()==='"'||q()==="'"){let e=S();t+=e.value;}else if(n.isAlpha(q())||n.isNumeric(q())||n.isIdentifierChar(q())){let e=g();t+=e.value;}}e.value=t;e.end=o;return e}function y(){var e=p("STYLE_REF");var t=R();while(n.isAlpha(q())||q()==="-"){t+=R();}e.value=t;e.end=o;return e}function k(){var e=p("ID_REF");var t=R();if(q()==="{"){e.template=true;t+=R();while(q()&&q()!=="}"){t+=R();}if(q()!=="}"){throw Error("Unterminated id reference")}else {R();}}else {while(n.isValidCSSIDChar(q())){t+=R();}}e.value=t;e.end=o;return e}function x(){var e=p("IDENTIFIER");var t=R();var r=t==="\\";if(r){t="";}while(n.isAlpha(q())||n.isNumeric(q())||n.isIdentifierChar(q())||q()==="\\"||q()==="{"||q()==="}"){if(q()==="$"&&r===false){break}else if(q()==="\\"){r=true;R();}else {r=false;t+=R();}}if(q()==="!"&&t==="beep"){t+=R();}e.value=t;e.end=o;return e}function g(){var e=p("IDENTIFIER");var t=R();while(n.isAlpha(q())||n.isNumeric(q())||n.isIdentifierChar(q())){t+=R();}if(q()==="!"&&t==="beep"){t+=R();}e.value=t;e.end=o;return e}function b(){var e=p("NUMBER");var t=R();while(n.isNumeric(q())){t+=R();}if(q()==="."&&n.isNumeric(I())){t+=R();}while(n.isNumeric(q())){t+=R();}if(q()==="e"||q()==="E"){if(n.isNumeric(I())){t+=R();}else if(I()==="-"){t+=R();t+=R();}}while(n.isNumeric(q())){t+=R();}e.value=t;e.end=o;return e}function w(){var e=m();var t=R();while(q()&&n.OP_TABLE[t+q()]){t+=R();}e.type=n.OP_TABLE[t];e.value=t;e.end=o;return e}function S(){var e=p("STRING");var t=R();e.template=t==="`";var r="";while(q()&&q()!==t){if(q()==="\\"){R();let t=R();if(t==="b"){r+="\b";}else if(t==="f"){r+="\f";}else if(t==="n"){r+="\n";}else if(t==="r"){r+="\r";}else if(t==="t"){r+="\t";}else if(t==="v"){r+="\v";}else if(e.template&&t==="$"){r+="\\$";}else if(t==="x"){const t=N();if(Number.isNaN(t)){throw Error("Invalid hexadecimal escape at "+n.positionString(e))}r+=String.fromCharCode(t);}else {r+=t;}}else {r+=R();}}if(q()!==t){throw Error("Unterminated string at "+n.positionString(e))}else {R();}e.value=r;e.end=o;return e}function N(){const e=16;if(!q()){return NaN}let t=e*Number.parseInt(R(),e);if(!q()){return NaN}t+=Number.parseInt(R(),e);return t}function q(){return a.charAt(o)}function I(){return a.charAt(o+1)}function C(e=1){return a.charAt(o+e)}function R(){l=q();o++;s++;return l}function A(){return n.isAlpha(l)||n.isNumeric(l)||l===")"||l==='"'||l==="'"||l==="`"||l==="}"||l==="]"}function L(){var e=p("WHITESPACE");var t="";while(q()&&n.isWhitespace(q())){if(n.isNewline(q())){s=0;u++;}t+=R();}e.value=t;e.end=o;return e}}tokenize(e,t){return n.tokenize(e,t)}}class i{constructor(e,t,r){this.tokens=e;this.consumed=t;this.source=r;this.consumeWhitespace();}get list(){return this.tokens}_lastConsumed=null;consumeWhitespace(){while(this.token(0,true).type==="WHITESPACE"){this.consumed.push(this.tokens.shift());}}raiseError(e,t){a.raiseParseError(e,t);}requireOpToken(e){var t=this.matchOpToken(e);if(t){return t}else {this.raiseError(this,"Expected '"+e+"' but found '"+this.currentToken().value+"'");}}matchAnyOpToken(e,t,r){for(var n=0;n<arguments.length;n++){var i=arguments[n];var a=this.matchOpToken(i);if(a){return a}}}matchAnyToken(e,t,r){for(var n=0;n<arguments.length;n++){var i=arguments[n];var a=this.matchToken(i);if(a){return a}}}matchOpToken(e){if(this.currentToken()&&this.currentToken().op&&this.currentToken().value===e){return this.consumeToken()}}requireTokenType(e,t,r,n){var i=this.matchTokenType(e,t,r,n);if(i){return i}else {this.raiseError(this,"Expected one of "+JSON.stringify([e,t,r]));}}matchTokenType(e,t,r,n){if(this.currentToken()&&this.currentToken().type&&[e,t,r,n].indexOf(this.currentToken().type)>=0){return this.consumeToken()}}requireToken(e,t){var r=this.matchToken(e,t);if(r){return r}else {this.raiseError(this,"Expected '"+e+"' but found '"+this.currentToken().value+"'");}}peekToken(e,t,r){t=t||0;r=r||"IDENTIFIER";if(this.tokens[t]&&this.tokens[t].value===e&&this.tokens[t].type===r){return this.tokens[t]}}matchToken(e,t){if(this.follows.indexOf(e)!==-1){return}t=t||"IDENTIFIER";if(this.currentToken()&&this.currentToken().value===e&&this.currentToken().type===t){return this.consumeToken()}}consumeToken(){var e=this.tokens.shift();this.consumed.push(e);this._lastConsumed=e;this.consumeWhitespace();return e}consumeUntil(e,t){var r=[];var n=this.token(0,true);while((t==null||n.type!==t)&&(e==null||n.value!==e)&&n.type!=="EOF"){var i=this.tokens.shift();this.consumed.push(i);r.push(n);n=this.token(0,true);}this.consumeWhitespace();return r}lastWhitespace(){if(this.consumed[this.consumed.length-1]&&this.consumed[this.consumed.length-1].type==="WHITESPACE"){return this.consumed[this.consumed.length-1].value}else {return ""}}consumeUntilWhitespace(){return this.consumeUntil(null,"WHITESPACE")}hasMore(){return this.tokens.length>0}token(e,t){var r;var n=0;do{if(!t){while(this.tokens[n]&&this.tokens[n].type==="WHITESPACE"){n++;}}r=this.tokens[n];e--;n++;}while(e>-1);if(r){return r}else {return {type:"EOF",value:"<<<EOF>>>"}}}currentToken(){return this.token(0)}lastMatch(){return this._lastConsumed}static sourceFor=function(){return this.programSource.substring(this.startToken.start,this.endToken.end)};static lineFor=function(){return this.programSource.split("\n")[this.startToken.line-1]};follows=[];pushFollow(e){this.follows.push(e);}popFollow(){this.follows.pop();}clearFollows(){var e=this.follows;this.follows=[];return e}restoreFollows(e){this.follows=e;}}class a{constructor(e){this.runtime=e;this.possessivesDisabled=false;this.addGrammarElement("feature",(function(e,t,r){if(r.matchOpToken("(")){var n=e.requireElement("feature",r);r.requireOpToken(")");return n}var i=e.FEATURES[r.currentToken().value||""];if(i){return i(e,t,r)}}));this.addGrammarElement("command",(function(e,t,r){if(r.matchOpToken("(")){const t=e.requireElement("command",r);r.requireOpToken(")");return t}var n=e.COMMANDS[r.currentToken().value||""];let i;if(n){i=n(e,t,r);}else if(r.currentToken().type==="IDENTIFIER"){i=e.parseElement("pseudoCommand",r);}if(i){return e.parseElement("indirectStatement",r,i)}return i}));this.addGrammarElement("commandList",(function(e,t,r){if(r.hasMore()){var n=e.parseElement("command",r);if(n){r.matchToken("then");const t=e.parseElement("commandList",r);if(t)n.next=t;return n}}return {type:"emptyCommandListCommand",op:function(e){return t.findNext(this,e)},execute:function(e){return t.unifiedExec(this,e)}}}));this.addGrammarElement("leaf",(function(e,t,r){var n=e.parseAnyOf(e.LEAF_EXPRESSIONS,r);if(n==null){return e.parseElement("symbol",r)}return n}));this.addGrammarElement("indirectExpression",(function(e,t,r,n){for(var i=0;i<e.INDIRECT_EXPRESSIONS.length;i++){var a=e.INDIRECT_EXPRESSIONS[i];n.endToken=r.lastMatch();var o=e.parseElement(a,r,n);if(o){return o}}return n}));this.addGrammarElement("indirectStatement",(function(e,t,r,n){if(r.matchToken("unless")){n.endToken=r.lastMatch();var i=e.requireElement("expression",r);var a={type:"unlessStatementModifier",args:[i],op:function(e,t){if(t){return this.next}else {return n}},execute:function(e){return t.unifiedExec(this,e)}};n.parent=a;return a}return n}));this.addGrammarElement("primaryExpression",(function(e,t,r){var n=e.parseElement("leaf",r);if(n){return e.parseElement("indirectExpression",r,n)}e.raiseParseError(r,"Unexpected value: "+r.currentToken().value);}));}use(e){e(this);return this}GRAMMAR={};COMMANDS={};FEATURES={};LEAF_EXPRESSIONS=[];INDIRECT_EXPRESSIONS=[];initElt(e,t,r){e.startToken=t;e.sourceFor=i.sourceFor;e.lineFor=i.lineFor;e.programSource=r.source;}parseElement(e,t,r=undefined){var n=this.GRAMMAR[e];if(n){var i=t.currentToken();var a=n(this,this.runtime,t,r);if(a){this.initElt(a,i,t);a.endToken=a.endToken||t.lastMatch();var r=a.root;while(r!=null){this.initElt(r,i,t);r=r.root;}}return a}}requireElement(e,t,r,n){var i=this.parseElement(e,t,n);if(!i)a.raiseParseError(t,r||"Expected "+e);return i}parseAnyOf(e,t){for(var r=0;r<e.length;r++){var n=e[r];var i=this.parseElement(n,t);if(i){return i}}}addGrammarElement(e,t){this.GRAMMAR[e]=t;}addCommand(e,t){var r=e+"Command";var n=function(e,n,i){const a=t(e,n,i);if(a){a.type=r;a.execute=function(e){e.meta.command=a;return n.unifiedExec(this,e)};return a}};this.GRAMMAR[r]=n;this.COMMANDS[e]=n;}addFeature(e,t){var r=e+"Feature";var n=function(n,i,a){var o=t(n,i,a);if(o){o.isFeature=true;o.keyword=e;o.type=r;return o}};this.GRAMMAR[r]=n;this.FEATURES[e]=n;}addLeafExpression(e,t){this.LEAF_EXPRESSIONS.push(e);this.addGrammarElement(e,t);}addIndirectExpression(e,t){this.INDIRECT_EXPRESSIONS.push(e);this.addGrammarElement(e,t);}static createParserContext(e){var t=e.currentToken();var r=e.source;var n=r.split("\n");var i=t&&t.line?t.line-1:n.length-1;var a=n[i];var o=t&&t.line?t.column:a.length-1;return a+"\n"+" ".repeat(o)+"^^\n\n"}static raiseParseError(e,t){t=(t||"Unexpected Token : "+e.currentToken().value)+"\n\n"+a.createParserContext(e);var r=new Error(t);r["tokens"]=e;throw r}raiseParseError(e,t){a.raiseParseError(e,t);}parseHyperScript(e){var t=this.parseElement("hyperscript",e);if(e.hasMore())this.raiseParseError(e);if(t)return t}setParent(e,t){if(typeof e==="object"){e.parent=t;if(typeof t==="object"){t.children=t.children||new Set;t.children.add(e);}this.setParent(e.next,t);}}commandStart(e){return this.COMMANDS[e.value||""]}featureStart(e){return this.FEATURES[e.value||""]}commandBoundary(e){if(e.value=="end"||e.value=="then"||e.value=="else"||e.value=="otherwise"||e.value==")"||this.commandStart(e)||this.featureStart(e)||e.type=="EOF"){return true}return false}parseStringTemplate(e){var t=[""];do{t.push(e.lastWhitespace());if(e.currentToken().value==="$"){e.consumeToken();var r=e.matchOpToken("{");t.push(this.requireElement("expression",e));if(r){e.requireOpToken("}");}t.push("");}else if(e.currentToken().value==="\\"){e.consumeToken();e.consumeToken();}else {var n=e.consumeToken();t[t.length-1]+=n?n.value:"";}}while(e.hasMore());t.push(e.lastWhitespace());return t}ensureTerminated(e){const t=this.runtime;var r={type:"implicitReturn",op:function(e){e.meta.returned=true;if(e.meta.resolve){e.meta.resolve();}return t.HALT},execute:function(e){}};var n=e;while(n.next){n=n.next;}n.next=r;}}class o{constructor(e,t){this.lexer=e??new n;this.parser=t??new a(this).use(T).use(y);this.parser.runtime=this;}matchesSelector(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}makeEvent(t,r){var n;if(e.Event&&typeof e.Event==="function"){n=new Event(t,{bubbles:true,cancelable:true,composed:true});n["detail"]=r;}else {n=document.createEvent("CustomEvent");n.initCustomEvent(t,true,true,r);}return n}triggerEvent(e,t,r,n){r=r||{};r["sender"]=n;var i=this.makeEvent(t,r);var a=e.dispatchEvent(i);return a}isArrayLike(e){return Array.isArray(e)||typeof NodeList!=="undefined"&&(e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList)}isIterable(e){return typeof e==="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]==="function"}shouldAutoIterate(e){return e!=null&&e[p]||this.isArrayLike(e)}forEach(e,t){if(e==null);else if(this.isIterable(e)){for(const r of e){t(r);}}else if(this.isArrayLike(e)){for(var r=0;r<e.length;r++){t(e[r]);}}else {t(e);}}implicitLoop(e,t){if(this.shouldAutoIterate(e)){for(const r of e)t(r);}else {t(e);}}wrapArrays(e){var t=[];for(var r=0;r<e.length;r++){var n=e[r];if(Array.isArray(n)){t.push(Promise.all(n));}else {t.push(n);}}return t}unwrapAsyncs(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.asyncWrapper){e[t]=r.value;}if(Array.isArray(r)){for(var n=0;n<r.length;n++){var i=r[n];if(i.asyncWrapper){r[n]=i.value;}}}}}static HALT={};HALT=o.HALT;unifiedExec(e,t){while(true){try{var r=this.unifiedEval(e,t);}catch(n){if(t.meta.handlingFinally){console.error(" Exception in finally block: ",n);r=o.HALT;}else {this.registerHyperTrace(t,n);if(t.meta.errorHandler&&!t.meta.handlingError){t.meta.handlingError=true;t.locals[t.meta.errorSymbol]=n;e=t.meta.errorHandler;continue}else {t.meta.currentException=n;r=o.HALT;}}}if(r==null){console.error(e," did not return a next element to execute! context: ",t);return}else if(r.then){r.then((e=>{this.unifiedExec(e,t);})).catch((e=>{this.unifiedExec({op:function(){throw e}},t);}));return}else if(r===o.HALT){if(t.meta.finallyHandler&&!t.meta.handlingFinally){t.meta.handlingFinally=true;e=t.meta.finallyHandler;}else {if(t.meta.onHalt){t.meta.onHalt();}if(t.meta.currentException){if(t.meta.reject){t.meta.reject(t.meta.currentException);return}else {throw t.meta.currentException}}else {return}}}else {e=r;}}}unifiedEval(e,t,r){var n=[t];var i=false;var a=false;if(e.args){for(var o=0;o<e.args.length;o++){var s=e.args[o];if(s==null){n.push(null);}else if(Array.isArray(s)){var u=[];for(var l=0;l<s.length;l++){var c=s[l];var f=c?c.evaluate(t):null;if(f){if(f.then){i=true;}else if(f.asyncWrapper){a=true;}}u.push(f);}n.push(u);}else if(s.evaluate){var f=s.evaluate(t);if(f){if(f.then){i=true;}else if(f.asyncWrapper){a=true;}}n.push(f);if(f){if(r===true){break}}else {if(r===false){break}}}else {n.push(s);}}}if(i){return new Promise(((t,r)=>{n=this.wrapArrays(n);Promise.all(n).then((function(n){if(a){this.unwrapAsyncs(n);}try{var i=e.op.apply(e,n);t(i);}catch(e){r(e);}})).catch((function(e){r(e);}));}))}else {if(a){this.unwrapAsyncs(n);}return e.op.apply(e,n)}}_scriptAttrs=null;getScriptAttributes(){if(this._scriptAttrs==null){this._scriptAttrs=r.attributes.replace(/ /g,"").split(",");}return this._scriptAttrs}getScript(e){for(var t=0;t<this.getScriptAttributes().length;t++){var r=this.getScriptAttributes()[t];if(e.hasAttribute&&e.hasAttribute(r)){return e.getAttribute(r)}}if(e instanceof HTMLScriptElement&&e.type==="text/hyperscript"){return e.innerText}return null}hyperscriptFeaturesMap=new WeakMap;getHyperscriptFeatures(e){var t=this.hyperscriptFeaturesMap.get(e);if(typeof t==="undefined"){if(e){this.hyperscriptFeaturesMap.set(e,t={});}}return t}addFeatures(e,t){if(e){Object.assign(t.locals,this.getHyperscriptFeatures(e));this.addFeatures(e.parentElement,t);}}makeContext(e,t,r,n){return new f(e,t,r,n,this)}getScriptSelector(){return this.getScriptAttributes().map((function(e){return "["+e+"]"})).join(", ")}convertValue(e,r){var n=t.dynamicResolvers;for(var i=0;i<n.length;i++){var a=n[i];var o=a(r,e);if(o!==undefined){return o}}if(e==null){return null}var s=t[r];if(s){return s(e)}throw "Unknown conversion : "+r}parse(e){const t=this.lexer,r=this.parser;var n=t.tokenize(e);if(this.parser.commandStart(n.currentToken())){var i=r.requireElement("commandList",n);if(n.hasMore())r.raiseParseError(n);r.ensureTerminated(i);return i}else if(r.featureStart(n.currentToken())){var a=r.requireElement("hyperscript",n);if(n.hasMore())r.raiseParseError(n);return a}else {var o=r.requireElement("expression",n);if(n.hasMore())r.raiseParseError(n);return o}}evaluateNoPromise(e,t){let r=e.evaluate(t);if(r.next){throw new Error(i.sourceFor.call(e)+" returned a Promise in a context that they are not allowed.")}return r}evaluate(t,r,n){class i extends EventTarget{constructor(e){super();this.module=e;}toString(){return this.module.id}}var a="document"in e?e.document.body:new i(n&&n.module);r=Object.assign(this.makeContext(a,null,a,null),r||{});var o=this.parse(t);if(o.execute){o.execute(r);if(typeof r.meta.returnValue!=="undefined"){return r.meta.returnValue}else {return r.result}}else if(o.apply){o.apply(a,a,n);return this.getHyperscriptFeatures(a)}else {return o.evaluate(r)}}processNode(e){var t=this.getScriptSelector();if(this.matchesSelector(e,t)){this.initElement(e,e);}if(e instanceof HTMLScriptElement&&e.type==="text/hyperscript"){this.initElement(e,document.body);}if(e.querySelectorAll){this.forEach(e.querySelectorAll(t+", [type='text/hyperscript']"),(e=>{this.initElement(e,e instanceof HTMLScriptElement&&e.type==="text/hyperscript"?document.body:e);}));}}initElement(e,t){if(e.closest&&e.closest(r.disableSelector)){return}var n=this.getInternalData(e);if(!n.initialized){var i=this.getScript(e);if(i){try{n.initialized=true;n.script=i;const r=this.lexer,s=this.parser;var a=r.tokenize(i);var o=s.parseHyperScript(a);if(!o)return;o.apply(t||e,e);setTimeout((()=>{this.triggerEvent(t||e,"load",{hyperscript:true});}),1);}catch(t){this.triggerEvent(e,"exception",{error:t});console.error("hyperscript errors were found on the following element:",e,"\n\n",t.message,t.stack);}}}}internalDataMap=new WeakMap;getInternalData(e){var t=this.internalDataMap.get(e);if(typeof t==="undefined"){this.internalDataMap.set(e,t={});}return t}typeCheck(e,t,r){if(e==null&&r){return true}var n=Object.prototype.toString.call(e).slice(8,-1);return n===t}getElementScope(e){var t=e.meta&&e.meta.owner;if(t){var r=this.getInternalData(t);var n="elementScope";if(e.meta.feature&&e.meta.feature.behavior){n=e.meta.feature.behavior+"Scope";}var i=h(r,n);return i}else {return {}}}isReservedWord(e){return ["meta","it","result","locals","event","target","detail","sender","body"].includes(e)}isHyperscriptContext(e){return e instanceof f}resolveSymbol(t,r,n){if(t==="me"||t==="my"||t==="I"){return r.me}if(t==="it"||t==="its"||t==="result"){return r.result}if(t==="you"||t==="your"||t==="yourself"){return r.you}else {if(n==="global"){return e[t]}else if(n==="element"){var i=this.getElementScope(r);return i[t]}else if(n==="local"){return r.locals[t]}else {if(r.meta&&r.meta.context){var a=r.meta.context[t];if(typeof a!=="undefined"){return a}if(r.meta.context.detail){a=r.meta.context.detail[t];if(typeof a!=="undefined"){return a}}}if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)){var o=r.locals[t];}else {var o=r[t];}if(typeof o!=="undefined"){return o}else {var i=this.getElementScope(r);o=i[t];if(typeof o!=="undefined"){return o}else {return e[t]}}}}}setSymbol(t,r,n,i){if(n==="global"){e[t]=i;}else if(n==="element"){var a=this.getElementScope(r);a[t]=i;}else if(n==="local"){r.locals[t]=i;}else {if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)&&typeof r.locals[t]!=="undefined"){r.locals[t]=i;}else {var a=this.getElementScope(r);var o=a[t];if(typeof o!=="undefined"){a[t]=i;}else {if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)){r.locals[t]=i;}else {r[t]=i;}}}}}findNext(e,t){if(e){if(e.resolveNext){return e.resolveNext(t)}else if(e.next){return e.next}else {return this.findNext(e.parent,t)}}}flatGet(e,t,r){if(e!=null){var n=r(e,t);if(typeof n!=="undefined"){return n}if(this.shouldAutoIterate(e)){var i=[];for(var a of e){var o=r(a,t);i.push(o);}return i}}}resolveProperty(e,t){return this.flatGet(e,t,((e,t)=>e[t]))}resolveAttribute(e,t){return this.flatGet(e,t,((e,t)=>e.getAttribute&&e.getAttribute(t)))}resolveStyle(e,t){return this.flatGet(e,t,((e,t)=>e.style&&e.style[t]))}resolveComputedStyle(e,t){return this.flatGet(e,t,((e,t)=>getComputedStyle(e).getPropertyValue(t)))}assignToNamespace(t,r,n,i){let a;if(typeof document!=="undefined"&&t===document.body){a=e;}else {a=this.getHyperscriptFeatures(t);}var o;while((o=r.shift())!==undefined){var s=a[o];if(s==null){s={};a[o]=s;}a=s;}a[n]=i;}getHyperTrace(e,t){var r=[];var n=e;while(n.meta.caller){n=n.meta.caller;}if(n.meta.traceMap){return n.meta.traceMap.get(t,r)}}registerHyperTrace(e,t){var r=[];var n=null;while(e!=null){r.push(e);n=e;e=e.meta.caller;}if(n.meta.traceMap==null){n.meta.traceMap=new Map;}if(!n.meta.traceMap.get(t)){var i={trace:r,print:function(e){e=e||console.error;e("hypertrace /// ");var t=0;for(var n=0;n<r.length;n++){t=Math.max(t,r[n].meta.feature.displayName.length);}for(var n=0;n<r.length;n++){var i=r[n];e(" ->",i.meta.feature.displayName.padEnd(t+2),"-",i.meta.owner);}}};n.meta.traceMap.set(t,i);}}escapeSelector(e){return e.replace(/[:&()\[\]\/]/g,(function(e){return "\\"+e}))}nullCheck(e,t){if(e==null){throw new Error("'"+t.sourceFor()+"' is null")}}isEmpty(e){return e==undefined||e.length===0}doesExist(e){if(e==null){return false}if(this.shouldAutoIterate(e)){for(const t of e){return true}return false}return true}getRootNode(e){if(e&&e instanceof Node){var t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document}getEventQueueFor(e,t){let r=this.getInternalData(e);var n=r.eventQueues;if(n==null){n=new Map;r.eventQueues=n;}var i=n.get(t);if(i==null){i={queue:[],executing:false};n.set(t,i);}return i}beepValueToConsole(e,t,r){if(this.triggerEvent(e,"hyperscript:beep",{element:e,expression:t,value:r})){var n;if(r){if(r instanceof m){n="ElementCollection";}else if(r.constructor){n=r.constructor.name;}else {n="unknown";}}else {n="object (null)";}var a=r;if(n==="String"){a='"'+a+'"';}else if(r instanceof m){a=Array.from(r);}console.log("///_ BEEP! The expression ("+i.sourceFor.call(t).replace("beep! ","")+") evaluates to:",a,"of type "+n);}}hyperscriptUrl="document"in e&&document.currentScript?document.currentScript.src:null}function s(){let e=document.cookie.split("; ").map((e=>{let t=e.split("=");return {name:t[0],value:decodeURIComponent(t[1])}}));return e}function u(e){document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";}function l(){for(const e of s()){u(e.name);}}const c=new Proxy({},{get(e,t){if(t==="then"||t==="asyncWrapper"){return null}else if(t==="length"){return s().length}else if(t==="clear"){return u}else if(t==="clearAll"){return l}else if(typeof t==="string"){if(!isNaN(t)){return s()[parseInt(t)]}else {let e=document.cookie.split("; ").find((e=>e.startsWith(t+"=")))?.split("=")[1];if(e){return decodeURIComponent(e)}}}else if(t===Symbol.iterator){return s()[t]}},set(e,t,r){var n=null;if("string"===typeof r){n=encodeURIComponent(r);n+=";samesite=lax";}else {n=encodeURIComponent(r.value);if(r.expires){n+=";expires="+r.maxAge;}if(r.maxAge){n+=";max-age="+r.maxAge;}if(r.partitioned){n+=";partitioned="+r.partitioned;}if(r.path){n+=";path="+r.path;}if(r.samesite){n+=";samesite="+r.path;}if(r.secure){n+=";secure="+r.path;}}document.cookie=t+"="+n;return true}});class f{constructor(t,r,n,i,a){this.meta={parser:a.parser,lexer:a.lexer,runtime:a,owner:t,feature:r,iterators:{},ctx:this};this.locals={cookies:c};this.me=n,this.you=undefined;this.result=undefined;this.event=i;this.target=i?i.target:null;this.detail=i?i.detail:null;this.sender=i?i.detail?i.detail.sender:null:null;this.body="document"in e?document.body:null;a.addFeatures(t,this);}}class m{constructor(e,t,r){this._css=e;this.relativeToElement=t;this.escape=r;this[p]=true;}get css(){if(this.escape){return o.prototype.escapeSelector(this._css)}else {return this._css}}get className(){return this._css.substr(1)}get id(){return this.className()}contains(e){for(let t of this){if(t.contains(e)){return true}}return false}get length(){return this.selectMatches().length}[Symbol.iterator](){let e=this.selectMatches();return e[Symbol.iterator]()}selectMatches(){let e=o.prototype.getRootNode(this.relativeToElement).querySelectorAll(this.css);return e}}const p=Symbol();function h(e,t){var r=e[t];if(r){return r}else {var n={};e[t]=n;return n}}function v(e){try{return JSON.parse(e)}catch(e){d(e);return null}}function d(e){if(console.error){console.error(e);}else if(console.log){console.log("ERROR: ",e);}}function E(e,t){return new(e.bind.apply(e,[e].concat(t)))}function T(t){t.addLeafExpression("parenthesized",(function(e,t,r){if(r.matchOpToken("(")){var n=r.clearFollows();try{var i=e.requireElement("expression",r);}finally{r.restoreFollows(n);}r.requireOpToken(")");return i}}));t.addLeafExpression("string",(function(e,t,r){var i=r.matchTokenType("STRING");if(!i)return;var a=i.value;var o;if(i.template){var s=n.tokenize(a,true);o=e.parseStringTemplate(s);}else {o=[];}return {type:"string",token:i,args:o,op:function(e){var t="";for(var r=1;r<arguments.length;r++){var n=arguments[r];if(n!==undefined){t+=n;}}return t},evaluate:function(e){if(o.length===0){return a}else {return t.unifiedEval(this,e)}}}}));t.addGrammarElement("nakedString",(function(e,t,r){if(r.hasMore()){var n=r.consumeUntilWhitespace();r.matchTokenType("WHITESPACE");return {type:"nakedString",tokens:n,evaluate:function(e){return n.map((function(e){return e.value})).join("")}}}}));t.addLeafExpression("number",(function(e,t,r){var n=r.matchTokenType("NUMBER");if(!n)return;var i=n;var a=parseFloat(n.value);return {type:"number",value:a,numberToken:i,evaluate:function(){return a}}}));t.addLeafExpression("idRef",(function(e,t,r){var i=r.matchTokenType("ID_REF");if(!i)return;if(!i.value)return;if(i.template){var a=i.value.substring(2);var o=n.tokenize(a);var s=e.requireElement("expression",o);return {type:"idRefTemplate",args:[s],op:function(e,r){return t.getRootNode(e.me).getElementById(r)},evaluate:function(e){return t.unifiedEval(this,e)}}}else {const e=i.value.substring(1);return {type:"idRef",css:i.value,value:e,evaluate:function(r){return t.getRootNode(r.me).getElementById(e)}}}}));t.addLeafExpression("classRef",(function(e,t,r){var i=r.matchTokenType("CLASS_REF");if(!i)return;if(!i.value)return;if(i.template){var a=i.value.substring(2);var o=n.tokenize(a);var s=e.requireElement("expression",o);return {type:"classRefTemplate",args:[s],op:function(e,t){return new m("."+t,e.me,true)},evaluate:function(e){return t.unifiedEval(this,e)}}}else {const e=i.value;return {type:"classRef",css:e,evaluate:function(t){return new m(e,t.me,true)}}}}));class r extends m{constructor(e,t,r){super(e,t);this.templateParts=r;this.elements=r.filter((e=>e instanceof Element));}get css(){let e="",t=0;for(const r of this.templateParts){if(r instanceof Element){e+="[data-hs-query-id='"+t+++"']";}else e+=r;}return e}[Symbol.iterator](){this.elements.forEach(((e,t)=>e.dataset.hsQueryId=t));const e=super[Symbol.iterator]();this.elements.forEach((e=>e.removeAttribute("data-hs-query-id")));return e}}t.addLeafExpression("queryRef",(function(e,t,i){var a=i.matchOpToken("<");if(!a)return;var o=i.consumeUntil("/");i.requireOpToken("/");i.requireOpToken(">");var s=o.map((function(e){if(e.type==="STRING"){return '"'+e.value+'"'}else {return e.value}})).join("");var u,l,c;if(/\$[^=]/.test(s)){u=true;l=n.tokenize(s,true);c=e.parseStringTemplate(l);}return {type:"queryRef",css:s,args:c,op:function(e,...t){if(u){return new r(s,e.me,t)}else {return new m(s,e.me)}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("attributeRef",(function(e,t,r){var n=r.matchTokenType("ATTRIBUTE_REF");if(!n)return;if(!n.value)return;var i=n.value;if(i.indexOf("[")===0){var a=i.substring(2,i.length-1);}else {var a=i.substring(1);}var o="["+a+"]";var s=a.split("=");var u=s[0];var l=s[1];if(l){if(l.indexOf('"')===0){l=l.substring(1,l.length-1);}}return {type:"attributeRef",name:u,css:o,value:l,op:function(e){var t=e.you||e.me;if(t){return t.getAttribute(u)}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("styleRef",(function(e,t,r){var n=r.matchTokenType("STYLE_REF");if(!n)return;if(!n.value)return;var i=n.value.substr(1);if(i.startsWith("computed-")){i=i.substr("computed-".length);return {type:"computedStyleRef",name:i,op:function(e){var r=e.you||e.me;if(r){return t.resolveComputedStyle(r,i)}},evaluate:function(e){return t.unifiedEval(this,e)}}}else {return {type:"styleRef",name:i,op:function(e){var r=e.you||e.me;if(r){return t.resolveStyle(r,i)}},evaluate:function(e){return t.unifiedEval(this,e)}}}}));t.addGrammarElement("objectKey",(function(e,t,r){var n;if(n=r.matchTokenType("STRING")){return {type:"objectKey",key:n.value,evaluate:function(){return n.value}}}else if(r.matchOpToken("[")){var i=e.parseElement("expression",r);r.requireOpToken("]");return {type:"objectKey",expr:i,args:[i],op:function(e,t){return t},evaluate:function(e){return t.unifiedEval(this,e)}}}else {var a="";do{n=r.matchTokenType("IDENTIFIER")||r.matchOpToken("-");if(n)a+=n.value;}while(n);return {type:"objectKey",key:a,evaluate:function(){return a}}}}));t.addLeafExpression("objectLiteral",(function(e,t,r){if(!r.matchOpToken("{"))return;var n=[];var i=[];if(!r.matchOpToken("}")){do{var a=e.requireElement("objectKey",r);r.requireOpToken(":");var o=e.requireElement("expression",r);i.push(o);n.push(a);}while(r.matchOpToken(",")&&!r.peekToken("}",0,"R_BRACE"));r.requireOpToken("}");}return {type:"objectLiteral",args:[n,i],op:function(e,t,r){var n={};for(var i=0;i<t.length;i++){n[t[i]]=r[i];}return n},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("nakedNamedArgumentList",(function(e,t,r){var n=[];var i=[];if(r.currentToken().type==="IDENTIFIER"){do{var a=r.requireTokenType("IDENTIFIER");r.requireOpToken(":");var o=e.requireElement("expression",r);i.push(o);n.push({name:a,value:o});}while(r.matchOpToken(","))}return {type:"namedArgumentList",fields:n,args:[i],op:function(e,t){var r={_namedArgList_:true};for(var i=0;i<t.length;i++){var a=n[i];r[a.name.value]=t[i];}return r},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("namedArgumentList",(function(e,t,r){if(!r.matchOpToken("("))return;var n=e.requireElement("nakedNamedArgumentList",r);r.requireOpToken(")");return n}));t.addGrammarElement("symbol",(function(e,t,r){var n="default";if(r.matchToken("global")){n="global";}else if(r.matchToken("element")||r.matchToken("module")){n="element";if(r.matchOpToken("'")){r.requireToken("s");}}else if(r.matchToken("local")){n="local";}let i=r.matchOpToken(":");let a=r.matchTokenType("IDENTIFIER");if(a&&a.value){var o=a.value;if(i){o=":"+o;}if(n==="default"){if(o.indexOf("$")===0){n="global";}if(o.indexOf(":")===0){n="element";}}return {type:"symbol",token:a,scope:n,name:o,evaluate:function(e){return t.resolveSymbol(o,e,n)}}}}));t.addGrammarElement("implicitMeTarget",(function(e,t,r){return {type:"implicitMeTarget",evaluate:function(e){return e.you||e.me}}}));t.addLeafExpression("boolean",(function(e,t,r){var n=r.matchToken("true")||r.matchToken("false");if(!n)return;const i=n.value==="true";return {type:"boolean",evaluate:function(e){return i}}}));t.addLeafExpression("null",(function(e,t,r){if(r.matchToken("null")){return {type:"null",evaluate:function(e){return null}}}}));t.addLeafExpression("arrayLiteral",(function(e,t,r){if(!r.matchOpToken("["))return;var n=[];if(!r.matchOpToken("]")){do{var i=e.requireElement("expression",r);n.push(i);}while(r.matchOpToken(","));r.requireOpToken("]");}return {type:"arrayLiteral",values:n,args:[n],op:function(e,t){return t},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("blockLiteral",(function(e,t,r){if(!r.matchOpToken("\\"))return;var n=[];var i=r.matchTokenType("IDENTIFIER");if(i){n.push(i);while(r.matchOpToken(",")){n.push(r.requireTokenType("IDENTIFIER"));}}r.requireOpToken("-");r.requireOpToken(">");var a=e.requireElement("expression",r);return {type:"blockLiteral",args:n,expr:a,evaluate:function(e){var t=function(){for(var t=0;t<n.length;t++){e.locals[n[t].value]=arguments[t];}return a.evaluate(e)};return t}}}));t.addIndirectExpression("propertyAccess",(function(e,t,r,n){if(!r.matchOpToken("."))return;var i=r.requireTokenType("IDENTIFIER");var a={type:"propertyAccess",root:n,prop:i,args:[n],op:function(e,r){var n=t.resolveProperty(r,i.value);return n},evaluate:function(e){return t.unifiedEval(this,e)}};return e.parseElement("indirectExpression",r,a)}));t.addIndirectExpression("of",(function(e,t,r,n){if(!r.matchToken("of"))return;var i=e.requireElement("unaryExpression",r);var a=null;var o=n;while(o.root){a=o;o=o.root;}if(o.type!=="symbol"&&o.type!=="attributeRef"&&o.type!=="styleRef"&&o.type!=="computedStyleRef"){e.raiseParseError(r,"Cannot take a property of a non-symbol: "+o.type);}var s=o.type==="attributeRef";var u=o.type==="styleRef"||o.type==="computedStyleRef";if(s||u){var l=o;}var c=o.name;var f={type:"ofExpression",prop:o.token,root:i,attribute:l,expression:n,args:[i],op:function(e,r){if(s){return t.resolveAttribute(r,c)}else if(u){if(o.type==="computedStyleRef"){return t.resolveComputedStyle(r,c)}else {return t.resolveStyle(r,c)}}else {return t.resolveProperty(r,c)}},evaluate:function(e){return t.unifiedEval(this,e)}};if(o.type==="attributeRef"){f.attribute=o;}if(a){a.root=f;a.args=[f];}else {n=f;}return e.parseElement("indirectExpression",r,n)}));t.addIndirectExpression("possessive",(function(e,t,r,n){if(e.possessivesDisabled){return}var i=r.matchOpToken("'");if(i||n.type==="symbol"&&(n.name==="my"||n.name==="its"||n.name==="your")&&(r.currentToken().type==="IDENTIFIER"||r.currentToken().type==="ATTRIBUTE_REF"||r.currentToken().type==="STYLE_REF")){if(i){r.requireToken("s");}var a,o,s;a=e.parseElement("attributeRef",r);if(a==null){o=e.parseElement("styleRef",r);if(o==null){s=r.requireTokenType("IDENTIFIER");}}var u={type:"possessive",root:n,attribute:a||o,prop:s,args:[n],op:function(e,r){if(a){var n=t.resolveAttribute(r,a.name);}else if(o){var n;if(o.type==="computedStyleRef"){n=t.resolveComputedStyle(r,o["name"]);}else {n=t.resolveStyle(r,o["name"]);}}else {var n=t.resolveProperty(r,s.value);}return n},evaluate:function(e){return t.unifiedEval(this,e)}};return e.parseElement("indirectExpression",r,u)}}));t.addIndirectExpression("inExpression",(function(e,t,r,n){if(!r.matchToken("in"))return;var i=e.requireElement("unaryExpression",r);var a={type:"inExpression",root:n,args:[n,i],op:function(e,r,n){var i=[];if(r.css){t.implicitLoop(n,(function(e){var t=e.querySelectorAll(r.css);for(var n=0;n<t.length;n++){i.push(t[n]);}}));}else if(r instanceof Element){var a=false;t.implicitLoop(n,(function(e){if(e.contains(r)){a=true;}}));if(a){return r}}else {t.implicitLoop(r,(function(e){t.implicitLoop(n,(function(t){if(e===t){i.push(e);}}));}));}return i},evaluate:function(e){return t.unifiedEval(this,e)}};return e.parseElement("indirectExpression",r,a)}));t.addIndirectExpression("asExpression",(function(e,t,r,n){if(!r.matchToken("as"))return;r.matchToken("a")||r.matchToken("an");var i=e.requireElement("dotOrColonPath",r).evaluate();var a={type:"asExpression",root:n,args:[n],op:function(e,r){return t.convertValue(r,i)},evaluate:function(e){return t.unifiedEval(this,e)}};return e.parseElement("indirectExpression",r,a)}));t.addIndirectExpression("functionCall",(function(e,t,r,n){if(!r.matchOpToken("("))return;var i=[];if(!r.matchOpToken(")")){do{i.push(e.requireElement("expression",r));}while(r.matchOpToken(","));r.requireOpToken(")");}if(n.root){var a={type:"functionCall",root:n,argExressions:i,args:[n.root,i],op:function(e,r,i){t.nullCheck(r,n.root);var a=r[n.prop.value];t.nullCheck(a,n);if(a.hyperfunc){i.push(e);}return a.apply(r,i)},evaluate:function(e){return t.unifiedEval(this,e)}};}else {var a={type:"functionCall",root:n,argExressions:i,args:[n,i],op:function(e,r,i){t.nullCheck(r,n);if(r.hyperfunc){i.push(e);}var a=r.apply(null,i);return a},evaluate:function(e){return t.unifiedEval(this,e)}};}return e.parseElement("indirectExpression",r,a)}));t.addIndirectExpression("attributeRefAccess",(function(e,t,r,n){var i=e.parseElement("attributeRef",r);if(!i)return;var a={type:"attributeRefAccess",root:n,attribute:i,args:[n],op:function(e,r){var n=t.resolveAttribute(r,i.name);return n},evaluate:function(e){return t.unifiedEval(this,e)}};return a}));t.addIndirectExpression("arrayIndex",(function(e,t,r,n){if(!r.matchOpToken("["))return;var i=false;var a=false;var o=null;var s=null;if(r.matchOpToken("..")){i=true;o=e.requireElement("expression",r);}else {o=e.requireElement("expression",r);if(r.matchOpToken("..")){a=true;var u=r.currentToken();if(u.type!=="R_BRACKET"){s=e.parseElement("expression",r);}}}r.requireOpToken("]");var l={type:"arrayIndex",root:n,prop:o,firstIndex:o,secondIndex:s,args:[n,o,s],op:function(e,t,r,n){if(t==null){return null}if(i){if(r<0){r=t.length+r;}return t.slice(0,r+1)}else if(a){if(n!=null){if(n<0){n=t.length+n;}return t.slice(r,n+1)}else {return t.slice(r)}}else {return t[r]}},evaluate:function(e){return t.unifiedEval(this,e)}};return e.parseElement("indirectExpression",r,l)}));var a=["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","pc","pt","px"];t.addGrammarElement("postfixExpression",(function(e,t,r){var n=e.parseElement("negativeNumber",r);let i=r.matchAnyToken.apply(r,a)||r.matchOpToken("%");if(i){return {type:"stringPostfix",postfix:i.value,args:[n],op:function(e,t){return ""+t+i.value},evaluate:function(e){return t.unifiedEval(this,e)}}}var o=null;if(r.matchToken("s")||r.matchToken("seconds")){o=1e3;}else if(r.matchToken("ms")||r.matchToken("milliseconds")){o=1;}if(o){return {type:"timeExpression",time:n,factor:o,args:[n],op:function(e,t){return t*o},evaluate:function(e){return t.unifiedEval(this,e)}}}if(r.matchOpToken(":")){var s=r.requireTokenType("IDENTIFIER");if(!s.value)return;var u=!r.matchOpToken("!");return {type:"typeCheck",typeName:s,nullOk:u,args:[n],op:function(e,r){var n=t.typeCheck(r,this.typeName.value,u);if(n){return r}else {throw new Error("Typecheck failed! Expected: "+s.value)}},evaluate:function(e){return t.unifiedEval(this,e)}}}else {return n}}));t.addGrammarElement("logicalNot",(function(e,t,r){if(!r.matchToken("not"))return;var n=e.requireElement("unaryExpression",r);return {type:"logicalNot",root:n,args:[n],op:function(e,t){return !t},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("noExpression",(function(e,t,r){if(!r.matchToken("no"))return;var n=e.requireElement("unaryExpression",r);return {type:"noExpression",root:n,args:[n],op:function(e,r){return t.isEmpty(r)},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("some",(function(e,t,r){if(!r.matchToken("some"))return;var n=e.requireElement("expression",r);return {type:"noExpression",root:n,args:[n],op:function(e,r){return !t.isEmpty(r)},evaluate(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("negativeNumber",(function(e,t,r){if(r.matchOpToken("-")){var n=e.requireElement("negativeNumber",r);return {type:"negativeNumber",root:n,args:[n],op:function(e,t){return -1*t},evaluate:function(e){return t.unifiedEval(this,e)}}}else {return e.requireElement("primaryExpression",r)}}));t.addGrammarElement("unaryExpression",(function(e,t,r){r.matchToken("the");return e.parseAnyOf(["beepExpression","logicalNot","relativePositionalExpression","positionalExpression","noExpression","postfixExpression"],r)}));t.addGrammarElement("beepExpression",(function(e,t,r){if(!r.matchToken("beep!"))return;var n=e.parseElement("unaryExpression",r);if(n){n["booped"]=true;var i=n.evaluate;n.evaluate=function(e){let r=i.apply(n,arguments);let a=e.me;t.beepValueToConsole(a,n,r);return r};return n}}));var s=function(e,t,r,n){var i=t.querySelectorAll(r);for(var a=0;a<i.length;a++){var o=i[a];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING){return o}}if(n){return i[0]}};var u=function(e,t,r,n){var i=t.querySelectorAll(r);for(var a=i.length-1;a>=0;a--){var o=i[a];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}if(n){return i[i.length-1]}};var l=function(e,t,r,n){var i=[];o.prototype.forEach(t,(function(t){if(t.matches(r)||t===e){i.push(t);}}));for(var a=0;a<i.length-1;a++){var s=i[a];if(s===e){return i[a+1]}}if(n){var u=i[0];if(u&&u.matches(r)){return u}}};var c=function(e,t,r,n){return l(e,Array.from(t).reverse(),r,n)};t.addGrammarElement("relativePositionalExpression",(function(e,t,r){var n=r.matchAnyToken("next","previous");if(!n)return;var a=n.value==="next";var o=e.parseElement("expression",r);if(r.matchToken("from")){r.pushFollow("in");try{var f=e.requireElement("unaryExpression",r);}finally{r.popFollow();}}else {var f=e.requireElement("implicitMeTarget",r);}var m=false;var p;if(r.matchToken("in")){m=true;var h=e.requireElement("unaryExpression",r);}else if(r.matchToken("within")){p=e.requireElement("unaryExpression",r);}else {p=document.body;}var v=false;if(r.matchToken("with")){r.requireToken("wrapping");v=true;}return {type:"relativePositionalExpression",from:f,forwardSearch:a,inSearch:m,wrapping:v,inElt:h,withinElt:p,operator:n.value,args:[o,f,h,p],op:function(e,t,r,n,f){var p=t.css;if(p==null){throw "Expected a CSS value to be returned by "+i.sourceFor.apply(o)}if(m){if(n){if(a){return l(r,n,p,v)}else {return c(r,n,p,v)}}}else {if(f){if(a){return s(r,f,p,v)}else {return u(r,f,p,v)}}}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("positionalExpression",(function(e,t,r){var n=r.matchAnyToken("first","last","random");if(!n)return;r.matchAnyToken("in","from","of");var i=e.requireElement("unaryExpression",r);const a=n.value;return {type:"positionalExpression",rhs:i,operator:n.value,args:[i],op:function(e,t){if(t&&!Array.isArray(t)){if(t.children){t=t.children;}else {t=Array.from(t);}}if(t){if(a==="first"){return t[0]}else if(a==="last"){return t[t.length-1]}else if(a==="random"){return t[Math.floor(Math.random()*t.length)]}}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addGrammarElement("mathOperator",(function(e,t,r){var n=e.parseElement("unaryExpression",r);var i,a=null;i=r.matchAnyOpToken("+","-","*","/")||r.matchToken("mod");while(i){a=a||i;var o=i.value;if(a.value!==o){e.raiseParseError(r,"You must parenthesize math operations with different operators");}var s=e.parseElement("unaryExpression",r);n={type:"mathOperator",lhs:n,rhs:s,operator:o,args:[n,s],op:function(e,t,r){if(o==="+"){return t+r}else if(o==="-"){return t-r}else if(o==="*"){return t*r}else if(o==="/"){return t/r}else if(o==="mod"){return t%r}},evaluate:function(e){return t.unifiedEval(this,e)}};i=r.matchAnyOpToken("+","-","*","/")||r.matchToken("mod");}return n}));t.addGrammarElement("mathExpression",(function(e,t,r){return e.parseAnyOf(["mathOperator","unaryExpression"],r)}));function f(e,t,r){if(t["contains"]){return t.contains(r)}else if(t["includes"]){return t.includes(r)}else {throw Error("The value of "+e.sourceFor()+" does not have a contains or includes method on it")}}function p(e,t,r){if(t["match"]){return !!t.match(r)}else if(t["matches"]){return t.matches(r)}else {throw Error("The value of "+e.sourceFor()+" does not have a match or matches method on it")}}t.addGrammarElement("comparisonOperator",(function(e,t,r){var n=e.parseElement("mathExpression",r);var i=r.matchAnyOpToken("<",">","<=",">=","==","===","!=","!==");var a=i?i.value:null;var o=true;var s=false;if(a==null){if(r.matchToken("is")||r.matchToken("am")){if(r.matchToken("not")){if(r.matchToken("in")){a="not in";}else if(r.matchToken("a")||r.matchToken("an")){a="not a";s=true;}else if(r.matchToken("empty")){a="not empty";o=false;}else {if(r.matchToken("really")){a="!==";}else {a="!=";}if(r.matchToken("equal")){r.matchToken("to");}}}else if(r.matchToken("in")){a="in";}else if(r.matchToken("a")||r.matchToken("an")){a="a";s=true;}else if(r.matchToken("empty")){a="empty";o=false;}else if(r.matchToken("less")){r.requireToken("than");if(r.matchToken("or")){r.requireToken("equal");r.requireToken("to");a="<=";}else {a="<";}}else if(r.matchToken("greater")){r.requireToken("than");if(r.matchToken("or")){r.requireToken("equal");r.requireToken("to");a=">=";}else {a=">";}}else {if(r.matchToken("really")){a="===";}else {a="==";}if(r.matchToken("equal")){r.matchToken("to");}}}else if(r.matchToken("equals")){a="==";}else if(r.matchToken("really")){r.requireToken("equals");a="===";}else if(r.matchToken("exist")||r.matchToken("exists")){a="exist";o=false;}else if(r.matchToken("matches")||r.matchToken("match")){a="match";}else if(r.matchToken("contains")||r.matchToken("contain")){a="contain";}else if(r.matchToken("includes")||r.matchToken("include")){a="include";}else if(r.matchToken("do")||r.matchToken("does")){r.requireToken("not");if(r.matchToken("matches")||r.matchToken("match")){a="not match";}else if(r.matchToken("contains")||r.matchToken("contain")){a="not contain";}else if(r.matchToken("exist")||r.matchToken("exist")){a="not exist";o=false;}else if(r.matchToken("include")){a="not include";}else {e.raiseParseError(r,"Expected matches or contains");}}}if(a){var u,l,c;if(s){u=r.requireTokenType("IDENTIFIER");l=!r.matchOpToken("!");}else if(o){c=e.requireElement("mathExpression",r);if(a==="match"||a==="not match"){c=c.css?c.css:c;}}var m=n;n={type:"comparisonOperator",operator:a,typeName:u,nullOk:l,lhs:n,rhs:c,args:[n,c],op:function(e,r,n){if(a==="=="){return r==n}else if(a==="!="){return r!=n}if(a==="==="){return r===n}else if(a==="!=="){return r!==n}if(a==="match"){return r!=null&&p(m,r,n)}if(a==="not match"){return r==null||!p(m,r,n)}if(a==="in"){return n!=null&&f(c,n,r)}if(a==="not in"){return n==null||!f(c,n,r)}if(a==="contain"){return r!=null&&f(m,r,n)}if(a==="not contain"){return r==null||!f(m,r,n)}if(a==="include"){return r!=null&&f(m,r,n)}if(a==="not include"){return r==null||!f(m,r,n)}if(a==="==="){return r===n}else if(a==="!=="){return r!==n}else if(a==="<"){return r<n}else if(a===">"){return r>n}else if(a==="<="){return r<=n}else if(a===">="){return r>=n}else if(a==="empty"){return t.isEmpty(r)}else if(a==="not empty"){return !t.isEmpty(r)}else if(a==="exist"){return t.doesExist(r)}else if(a==="not exist"){return !t.doesExist(r)}else if(a==="a"){return t.typeCheck(r,u.value,l)}else if(a==="not a"){return !t.typeCheck(r,u.value,l)}else {throw "Unknown comparison : "+a}},evaluate:function(e){return t.unifiedEval(this,e)}};}return n}));t.addGrammarElement("comparisonExpression",(function(e,t,r){return e.parseAnyOf(["comparisonOperator","mathExpression"],r)}));t.addGrammarElement("logicalOperator",(function(e,t,r){var n=e.parseElement("comparisonExpression",r);var i,a=null;i=r.matchToken("and")||r.matchToken("or");while(i){a=a||i;if(a.value!==i.value){e.raiseParseError(r,"You must parenthesize logical operations with different operators");}var o=e.requireElement("comparisonExpression",r);const s=i.value;n={type:"logicalOperator",operator:s,lhs:n,rhs:o,args:[n,o],op:function(e,t,r){if(s==="and"){return t&&r}else {return t||r}},evaluate:function(e){return t.unifiedEval(this,e,s==="or")}};i=r.matchToken("and")||r.matchToken("or");}return n}));t.addGrammarElement("logicalExpression",(function(e,t,r){return e.parseAnyOf(["logicalOperator","mathExpression"],r)}));t.addGrammarElement("asyncExpression",(function(e,t,r){if(r.matchToken("async")){var n=e.requireElement("logicalExpression",r);var i={type:"asyncExpression",value:n,evaluate:function(e){return {asyncWrapper:true,value:this.value.evaluate(e)}}};return i}else {return e.parseElement("logicalExpression",r)}}));t.addGrammarElement("expression",(function(e,t,r){r.matchToken("the");return e.parseElement("asyncExpression",r)}));t.addGrammarElement("assignableExpression",(function(e,t,r){r.matchToken("the");var n=e.parseElement("primaryExpression",r);if(n&&(n.type==="symbol"||n.type==="ofExpression"||n.type==="propertyAccess"||n.type==="attributeRefAccess"||n.type==="attributeRef"||n.type==="styleRef"||n.type==="arrayIndex"||n.type==="possessive")){return n}else {e.raiseParseError(r,"A target expression must be writable. The expression type '"+(n&&n.type)+"' is not.");}return n}));t.addGrammarElement("hyperscript",(function(e,t,r){var n=[];if(r.hasMore()){while(e.featureStart(r.currentToken())||r.currentToken().value==="("){var i=e.requireElement("feature",r);n.push(i);r.matchToken("end");}}return {type:"hyperscript",features:n,apply:function(e,t,r){for(const i of n){i.install(e,t,r);}}}}));var v=function(e){var t=[];if(e.token(0).value==="("&&(e.token(1).value===")"||e.token(2).value===","||e.token(2).value===")")){e.matchOpToken("(");do{t.push(e.requireTokenType("IDENTIFIER"));}while(e.matchOpToken(","));e.requireOpToken(")");}return t};t.addFeature("on",(function(e,t,r){if(!r.matchToken("on"))return;var n=false;if(r.matchToken("every")){n=true;}var i=[];var a=null;do{var o=e.requireElement("eventName",r,"Expected event name");var s=o.evaluate();if(a){a=a+" or "+s;}else {a="on "+s;}var u=v(r);var l=null;if(r.matchOpToken("[")){l=e.requireElement("expression",r);r.requireOpToken("]");}var c,f,m;if(r.currentToken().type==="NUMBER"){var p=r.consumeToken();if(!p.value)return;c=parseInt(p.value);if(r.matchToken("to")){var h=r.consumeToken();if(!h.value)return;f=parseInt(h.value);}else if(r.matchToken("and")){m=true;r.requireToken("on");}}var d,E;if(s==="intersection"){d={};if(r.matchToken("with")){d["with"]=e.requireElement("expression",r).evaluate();}if(r.matchToken("having")){do{if(r.matchToken("margin")){d["rootMargin"]=e.requireElement("stringLike",r).evaluate();}else if(r.matchToken("threshold")){d["threshold"]=e.requireElement("expression",r).evaluate();}else {e.raiseParseError(r,"Unknown intersection config specification");}}while(r.matchToken("and"))}}else if(s==="mutation"){E={};if(r.matchToken("of")){do{if(r.matchToken("anything")){E["attributes"]=true;E["subtree"]=true;E["characterData"]=true;E["childList"]=true;}else if(r.matchToken("childList")){E["childList"]=true;}else if(r.matchToken("attributes")){E["attributes"]=true;E["attributeOldValue"]=true;}else if(r.matchToken("subtree")){E["subtree"]=true;}else if(r.matchToken("characterData")){E["characterData"]=true;E["characterDataOldValue"]=true;}else if(r.currentToken().type==="ATTRIBUTE_REF"){var T=r.consumeToken();if(E["attributeFilter"]==null){E["attributeFilter"]=[];}if(T.value.indexOf("@")==0){E["attributeFilter"].push(T.value.substring(1));}else {e.raiseParseError(r,"Only shorthand attribute references are allowed here");}}else {e.raiseParseError(r,"Unknown mutation config specification");}}while(r.matchToken("or"))}else {E["attributes"]=true;E["characterData"]=true;E["childList"]=true;}}var y=null;var k=false;if(r.matchToken("from")){if(r.matchToken("elsewhere")){k=true;}else {r.pushFollow("or");try{y=e.requireElement("expression",r);}finally{r.popFollow();}if(!y){e.raiseParseError(r,'Expected either target value or "elsewhere".');}}}if(y===null&&k===false&&r.matchToken("elsewhere")){k=true;}if(r.matchToken("in")){var x=e.parseElement("unaryExpression",r);}if(r.matchToken("debounced")){r.requireToken("at");var g=e.requireElement("unaryExpression",r);var b=g.evaluate({});}else if(r.matchToken("throttled")){r.requireToken("at");var g=e.requireElement("unaryExpression",r);var w=g.evaluate({});}i.push({execCount:0,every:n,on:s,args:u,filter:l,from:y,inExpr:x,elsewhere:k,startCount:c,endCount:f,unbounded:m,debounceTime:b,throttleTime:w,mutationSpec:E,intersectionSpec:d,debounced:undefined,lastExec:undefined});}while(r.matchToken("or"));var S=true;if(!n){if(r.matchToken("queue")){if(r.matchToken("all")){var S=false;}else if(r.matchToken("first")){var q=true;}else if(r.matchToken("none")){var I=true;}else {r.requireToken("last");}}}var C=e.requireElement("commandList",r);e.ensureTerminated(C);var R,A;if(r.matchToken("catch")){R=r.requireTokenType("IDENTIFIER").value;A=e.requireElement("commandList",r);e.ensureTerminated(A);}if(r.matchToken("finally")){var L=e.requireElement("commandList",r);e.ensureTerminated(L);}var O={displayName:a,events:i,start:C,every:n,execCount:0,errorHandler:A,errorSymbol:R,execute:function(e){let r=t.getEventQueueFor(e.me,O);if(r.executing&&n===false){if(I||q&&r.queue.length>0){return}if(S){r.queue.length=0;}r.queue.push(e);return}O.execCount++;r.executing=true;e.meta.onHalt=function(){r.executing=false;var e=r.queue.shift();if(e){setTimeout((function(){O.execute(e);}),1);}};e.meta.reject=function(r){console.error(r.message?r.message:r);var n=t.getHyperTrace(e,r);if(n){n.print();}t.triggerEvent(e.me,"exception",{error:r});};C.execute(e);},install:function(e,r){for(const r of O.events){var n;if(r.elsewhere){n=[document];}else if(r.from){n=r.from.evaluate(t.makeContext(e,O,e,null));}else {n=[e];}t.implicitLoop(n,(function(n){var i=r.on;if(n==null){console.warn("'%s' feature ignored because target does not exists:",a,e);return}if(r.mutationSpec){i="hyperscript:mutation";const e=new MutationObserver((function(e,r){if(!O.executing){t.triggerEvent(n,i,{mutationList:e,observer:r});}}));e.observe(n,r.mutationSpec);}if(r.intersectionSpec){i="hyperscript:intersection";const e=new IntersectionObserver((function(r){for(const o of r){var a={observer:e};a=Object.assign(a,o);a["intersecting"]=o.isIntersecting;t.triggerEvent(n,i,a);}}),r.intersectionSpec);e.observe(n);}var o=n.addEventListener||n.on;o.call(n,i,(function a(o){if(typeof Node!=="undefined"&&e instanceof Node&&n!==e&&!e.isConnected){n.removeEventListener(i,a);return}var s=t.makeContext(e,O,e,o);if(r.elsewhere&&e.contains(o.target)){return}if(r.from){s.result=n;}for(const e of r.args){let t=s.event[e.value];if(t!==undefined){s.locals[e.value]=t;}else if("detail"in s.event){s.locals[e.value]=s.event["detail"][e.value];}}s.meta.errorHandler=A;s.meta.errorSymbol=R;s.meta.finallyHandler=L;if(r.filter){var u=s.meta.context;s.meta.context=s.event;try{var l=r.filter.evaluate(s);if(l){}else {return}}finally{s.meta.context=u;}}if(r.inExpr){var c=o.target;while(true){if(c.matches&&c.matches(r.inExpr.css)){s.result=c;break}else {c=c.parentElement;if(c==null){return}}}}r.execCount++;if(r.startCount){if(r.endCount){if(r.execCount<r.startCount||r.execCount>r.endCount){return}}else if(r.unbounded){if(r.execCount<r.startCount){return}}else if(r.execCount!==r.startCount){return}}if(r.debounceTime){if(r.debounced){clearTimeout(r.debounced);}r.debounced=setTimeout((function(){O.execute(s);}),r.debounceTime);return}if(r.throttleTime){if(r.lastExec&&Date.now()<r.lastExec+r.throttleTime){return}else {r.lastExec=Date.now();}}O.execute(s);}));}));}}};e.setParent(C,O);return O}));t.addFeature("def",(function(e,t,r){if(!r.matchToken("def"))return;var n=e.requireElement("dotOrColonPath",r);var i=n.evaluate();var a=i.split(".");var o=a.pop();var s=[];if(r.matchOpToken("(")){if(r.matchOpToken(")"));else {do{s.push(r.requireTokenType("IDENTIFIER"));}while(r.matchOpToken(","));r.requireOpToken(")");}}var u=e.requireElement("commandList",r);var l,c;if(r.matchToken("catch")){l=r.requireTokenType("IDENTIFIER").value;c=e.parseElement("commandList",r);}if(r.matchToken("finally")){var f=e.requireElement("commandList",r);e.ensureTerminated(f);}var m={displayName:o+"("+s.map((function(e){return e.value})).join(", ")+")",name:o,args:s,start:u,errorHandler:c,errorSymbol:l,finallyHandler:f,install:function(e,r){var n=function(){var n=t.makeContext(r,m,e,null);n.meta.errorHandler=c;n.meta.errorSymbol=l;n.meta.finallyHandler=f;for(var i=0;i<s.length;i++){var a=s[i];var o=arguments[i];if(a){n.locals[a.value]=o;}}n.meta.caller=arguments[s.length];if(n.meta.caller){n.meta.callingCommand=n.meta.caller.meta.command;}var p,h=null;var v=new Promise((function(e,t){p=e;h=t;}));u.execute(n);if(n.meta.returned){return n.meta.returnValue}else {n.meta.resolve=p;n.meta.reject=h;return v}};n.hyperfunc=true;n.hypername=i;t.assignToNamespace(e,a,o,n);}};e.ensureTerminated(u);if(c){e.ensureTerminated(c);}e.setParent(u,m);return m}));t.addFeature("set",(function(e,t,r){let n=e.parseElement("setCommand",r);if(n){if(n.target.scope!=="element"){e.raiseParseError(r,"variables declared at the feature level must be element scoped.");}let i={start:n,install:function(e,r){n&&n.execute(t.makeContext(e,i,e,null));}};e.ensureTerminated(n);return i}}));t.addFeature("init",(function(e,t,r){if(!r.matchToken("init"))return;var n=r.matchToken("immediately");var i=e.requireElement("commandList",r);var a={start:i,install:function(e,r){let o=function(){i&&i.execute(t.makeContext(e,a,e,null));};if(n){o();}else {setTimeout(o,0);}}};e.ensureTerminated(i);e.setParent(i,a);return a}));t.addFeature("worker",(function(e,t,r){if(r.matchToken("worker")){e.raiseParseError(r,"In order to use the 'worker' feature, include "+"the _hyperscript worker plugin. See "+"https://hyperscript.org/features/worker/ for "+"more info.");return undefined}}));t.addFeature("behavior",(function(t,r,n){if(!n.matchToken("behavior"))return;var i=t.requireElement("dotOrColonPath",n).evaluate();var a=i.split(".");var o=a.pop();var s=[];if(n.matchOpToken("(")&&!n.matchOpToken(")")){do{s.push(n.requireTokenType("IDENTIFIER").value);}while(n.matchOpToken(","));n.requireOpToken(")");}var u=t.requireElement("hyperscript",n);for(var l=0;l<u.features.length;l++){var c=u.features[l];c.behavior=i;}return {install:function(t,n){r.assignToNamespace(e.document&&e.document.body,a,o,(function(e,t,n){var a=r.getInternalData(e);var o=h(a,i+"Scope");for(var l=0;l<s.length;l++){o[s[l]]=n[s[l]];}u.apply(e,t);}));}}}));t.addFeature("install",(function(t,r,n){if(!n.matchToken("install"))return;var i=t.requireElement("dotOrColonPath",n).evaluate();var a=i.split(".");var o=t.parseElement("namedArgumentList",n);var s;return s={install:function(t,n){r.unifiedEval({args:[o],op:function(r,o){var s=e;for(var u=0;u<a.length;u++){s=s[a[u]];if(typeof s!=="object"&&typeof s!=="function")throw new Error("No such behavior defined as "+i)}if(!(s instanceof Function))throw new Error(i+" is not a behavior");s(t,n,o);}},r.makeContext(t,s,t,null));}}}));t.addGrammarElement("jsBody",(function(e,t,r){var n=r.currentToken().start;var i=r.currentToken();var a=[];var o="";var s=false;while(r.hasMore()){i=r.consumeToken();var u=r.token(0,true);if(u.type==="IDENTIFIER"&&u.value==="end"){break}if(s){if(i.type==="IDENTIFIER"||i.type==="NUMBER"){o+=i.value;}else {if(o!=="")a.push(o);o="";s=false;}}else if(i.type==="IDENTIFIER"&&i.value==="function"){s=true;}}var l=i.end+1;return {type:"jsBody",exposedFunctionNames:a,jsSource:r.source.substring(n,l)}}));t.addFeature("js",(function(t,r,n){if(!n.matchToken("js"))return;var i=t.requireElement("jsBody",n);var a=i.jsSource+"\nreturn { "+i.exposedFunctionNames.map((function(e){return e+":"+e})).join(",")+" } ";var o=new Function(a);return {jsSource:a,function:o,exposedFunctionNames:i.exposedFunctionNames,install:function(){Object.assign(e,o());}}}));t.addCommand("js",(function(t,r,n){if(!n.matchToken("js"))return;var i=[];if(n.matchOpToken("(")){if(n.matchOpToken(")"));else {do{var a=n.requireTokenType("IDENTIFIER");i.push(a.value);}while(n.matchOpToken(","));n.requireOpToken(")");}}var o=t.requireElement("jsBody",n);n.matchToken("end");var s=E(Function,i.concat([o.jsSource]));var u={jsSource:o.jsSource,function:s,inputs:i,op:function(t){var n=[];i.forEach((function(e){n.push(r.resolveSymbol(e,t,"default"));}));var a=s.apply(e,n);if(a&&typeof a.then==="function"){return new Promise((function(e){a.then((function(n){t.result=n;e(r.findNext(this,t));}));}))}else {t.result=a;return r.findNext(this,t)}}};return u}));t.addCommand("async",(function(e,t,r){if(!r.matchToken("async"))return;if(r.matchToken("do")){var n=e.requireElement("commandList",r);var i=n;while(i.next)i=i.next;i.next=t.HALT;r.requireToken("end");}else {var n=e.requireElement("command",r);}var a={body:n,op:function(e){setTimeout((function(){n.execute(e);}));return t.findNext(this,e)}};e.setParent(n,a);return a}));t.addCommand("tell",(function(e,t,r){var n=r.currentToken();if(!r.matchToken("tell"))return;var i=e.requireElement("expression",r);var a=e.requireElement("commandList",r);if(r.hasMore()&&!e.featureStart(r.currentToken())){r.requireToken("end");}var o="tell_"+n.start;var s={value:i,body:a,args:[i],resolveNext:function(e){var r=e.meta.iterators[o];if(r.index<r.value.length){e.you=r.value[r.index++];return a}else {e.you=r.originalYou;if(this.next){return this.next}else {return t.findNext(this.parent,e)}}},op:function(e,t){if(t==null){t=[];}else if(!(Array.isArray(t)||t instanceof NodeList)){t=[t];}e.meta.iterators[o]={originalYou:e.you,index:0,value:t};return this.resolveNext(e)}};e.setParent(a,s);return s}));t.addCommand("wait",(function(e,t,r){if(!r.matchToken("wait"))return;var n;if(r.matchToken("for")){r.matchToken("a");var i=[];do{var a=r.token(0);if(a.type==="NUMBER"||a.type==="L_PAREN"){i.push({time:e.requireElement("expression",r).evaluate()});}else {i.push({name:e.requireElement("dotOrColonPath",r,"Expected event name").evaluate(),args:v(r)});}}while(r.matchToken("or"));if(r.matchToken("from")){var o=e.requireElement("expression",r);}n={event:i,on:o,args:[o],op:function(e,r){var n=r?r:e.me;if(!(n instanceof EventTarget))throw new Error("Not a valid event target: "+this.on.sourceFor());return new Promise((r=>{var a=false;for(const s of i){var o=n=>{e.result=n;if(s.args){for(const t of s.args){e.locals[t.value]=n[t.value]||(n.detail?n.detail[t.value]:null);}}if(!a){a=true;r(t.findNext(this,e));}};if(s.name){n.addEventListener(s.name,o,{once:true});}else if(s.time!=null){setTimeout(o,s.time,s.time);}}}))}};return n}else {var s;if(r.matchToken("a")){r.requireToken("tick");s=0;}else {s=e.requireElement("expression",r);}n={type:"waitCmd",time:s,args:[s],op:function(e,r){return new Promise((n=>{setTimeout((()=>{n(t.findNext(this,e));}),r);}))},execute:function(e){return t.unifiedExec(this,e)}};return n}}));t.addGrammarElement("dotOrColonPath",(function(e,t,r){var n=r.matchTokenType("IDENTIFIER");if(n){var i=[n.value];var a=r.matchOpToken(".")||r.matchOpToken(":");if(a){do{i.push(r.requireTokenType("IDENTIFIER","NUMBER").value);}while(r.matchOpToken(a.value))}return {type:"dotOrColonPath",path:i,evaluate:function(){return i.join(a?a.value:"")}}}}));t.addGrammarElement("eventName",(function(e,t,r){var n;if(n=r.matchTokenType("STRING")){return {evaluate:function(){return n.value}}}return e.parseElement("dotOrColonPath",r)}));function d(e,t,r,n){var i=t.requireElement("eventName",n);var a=t.parseElement("namedArgumentList",n);if(e==="send"&&n.matchToken("to")||e==="trigger"&&n.matchToken("on")){var o=t.requireElement("expression",n);}else {var o=t.requireElement("implicitMeTarget",n);}var s={eventName:i,details:a,to:o,args:[o,i,a],op:function(e,t,n,i){r.nullCheck(t,o);r.implicitLoop(t,(function(t){r.triggerEvent(t,n,i,e.me);}));return r.findNext(s,e)}};return s}t.addCommand("trigger",(function(e,t,r){if(r.matchToken("trigger")){return d("trigger",e,t,r)}}));t.addCommand("send",(function(e,t,r){if(r.matchToken("send")){return d("send",e,t,r)}}));var T=function(e,t,r,n){if(n){if(e.commandBoundary(r.currentToken())){e.raiseParseError(r,"'return' commands must return a value. If you do not wish to return a value, use 'exit' instead.");}else {var i=e.requireElement("expression",r);}}var a={value:i,args:[i],op:function(e,r){var n=e.meta.resolve;e.meta.returned=true;e.meta.returnValue=r;if(n){if(r){n(r);}else {n();}}return t.HALT}};return a};t.addCommand("return",(function(e,t,r){if(r.matchToken("return")){return T(e,t,r,true)}}));t.addCommand("exit",(function(e,t,r){if(r.matchToken("exit")){return T(e,t,r,false)}}));t.addCommand("halt",(function(e,t,r){if(r.matchToken("halt")){if(r.matchToken("the")){r.requireToken("event");if(r.matchOpToken("'")){r.requireToken("s");}var n=true;}if(r.matchToken("bubbling")){var i=true;}else if(r.matchToken("default")){var a=true;}var o=T(e,t,r,false);var s={keepExecuting:true,bubbling:i,haltDefault:a,exit:o,op:function(e){if(e.event){if(i){e.event.stopPropagation();}else if(a){e.event.preventDefault();}else {e.event.stopPropagation();e.event.preventDefault();}if(n){return t.findNext(this,e)}else {return o}}}};return s}}));t.addCommand("log",(function(e,t,r){if(!r.matchToken("log"))return;var n=[e.parseElement("expression",r)];while(r.matchOpToken(",")){n.push(e.requireElement("expression",r));}if(r.matchToken("with")){var i=e.requireElement("expression",r);}var a={exprs:n,withExpr:i,args:[i,n],op:function(e,r,n){if(r){r.apply(null,n);}else {console.log.apply(null,n);}return t.findNext(this,e)}};return a}));t.addCommand("beep!",(function(e,t,r){if(!r.matchToken("beep!"))return;var n=[e.parseElement("expression",r)];while(r.matchOpToken(",")){n.push(e.requireElement("expression",r));}var i={exprs:n,args:[n],op:function(e,r){for(let i=0;i<n.length;i++){const a=n[i];const o=r[i];t.beepValueToConsole(e.me,a,o);}return t.findNext(this,e)}};return i}));t.addCommand("throw",(function(e,t,r){if(!r.matchToken("throw"))return;var n=e.requireElement("expression",r);var i={expr:n,args:[n],op:function(e,r){t.registerHyperTrace(e,r);throw r}};return i}));var y=function(e,t,r){var n=e.requireElement("expression",r);var i={expr:n,args:[n],op:function(e,r){e.result=r;return t.findNext(i,e)}};return i};t.addCommand("call",(function(e,t,r){if(!r.matchToken("call"))return;var n=y(e,t,r);if(n.expr&&n.expr.type!=="functionCall"){e.raiseParseError(r,"Must be a function invocation");}return n}));t.addCommand("get",(function(e,t,r){if(r.matchToken("get")){return y(e,t,r)}}));t.addCommand("make",(function(e,t,r){if(!r.matchToken("make"))return;r.matchToken("a")||r.matchToken("an");var n=e.requireElement("expression",r);var i=[];if(n.type!=="queryRef"&&r.matchToken("from")){do{i.push(e.requireElement("expression",r));}while(r.matchOpToken(","))}if(r.matchToken("called")){var a=e.requireElement("symbol",r);}var o;if(n.type==="queryRef"){o={op:function(e){var r,i="div",o,s=[];var u=/(?:(^|#|\.)([^#\. ]+))/g;while(r=u.exec(n.css)){if(r[1]==="")i=r[2].trim();else if(r[1]==="#")o=r[2].trim();else s.push(r[2].trim());}var l=document.createElement(i);if(o!==undefined)l.id=o;for(var c=0;c<s.length;c++){var f=s[c];l.classList.add(f);}e.result=l;if(a){t.setSymbol(a.name,e,a.scope,l);}return t.findNext(this,e)}};return o}else {o={args:[n,i],op:function(e,r,n){e.result=E(r,n);if(a){t.setSymbol(a.name,e,a.scope,e.result);}return t.findNext(this,e)}};return o}}));t.addGrammarElement("pseudoCommand",(function(e,t,r){let n=r.token(1);if(!(n&&n.op&&(n.value==="."||n.value==="("))){return null}var i=e.requireElement("primaryExpression",r);var a=i.root;var o=i;while(a.root!=null){o=o.root;a=a.root;}if(i.type!=="functionCall"){e.raiseParseError(r,"Pseudo-commands must be function calls");}if(o.type==="functionCall"&&o.root.root==null){if(r.matchAnyToken("the","to","on","with","into","from","at")){var s=e.requireElement("expression",r);}else if(r.matchToken("me")){var s=e.requireElement("implicitMeTarget",r);}}var u;if(s){u={type:"pseudoCommand",root:s,argExressions:o.argExressions,args:[s,o.argExressions],op:function(e,r,n){t.nullCheck(r,s);var i=r[o.root.name];t.nullCheck(i,o);if(i.hyperfunc){n.push(e);}e.result=i.apply(r,n);return t.findNext(u,e)},execute:function(e){return t.unifiedExec(this,e)}};}else {u={type:"pseudoCommand",expr:i,args:[i],op:function(e,r){e.result=r;return t.findNext(u,e)},execute:function(e){return t.unifiedExec(this,e)}};}return u}));var k=function(e,t,r,n,i){var a=n.type==="symbol";var o=n.type==="attributeRef";var s=n.type==="styleRef";var u=n.type==="arrayIndex";if(!(o||s||a)&&n.root==null){e.raiseParseError(r,"Can only put directly into symbols, not references");}var l=null;var c=null;if(a);else if(o||s){l=e.requireElement("implicitMeTarget",r);var f=n;}else if(u){c=n.firstIndex;l=n.root;}else {c=n.prop?n.prop.value:null;var f=n.attribute;l=n.root;}var m={target:n,symbolWrite:a,value:i,args:[l,c,i],op:function(e,r,i,o){if(a){t.setSymbol(n.name,e,n.scope,o);}else {t.nullCheck(r,l);if(u){r[i]=o;}else {t.implicitLoop(r,(function(e){if(f){if(f.type==="attributeRef"){if(o==null){e.removeAttribute(f.name);}else {e.setAttribute(f.name,o);}}else {e.style[f.name]=o;}}else {e[i]=o;}}));}}return t.findNext(this,e)}};return m};t.addCommand("default",(function(e,t,r){if(!r.matchToken("default"))return;var n=e.requireElement("assignableExpression",r);r.requireToken("to");var i=e.requireElement("expression",r);var a=k(e,t,r,n,i);var o={target:n,value:i,setter:a,args:[n],op:function(e,r){if(r){return t.findNext(this,e)}else {return a}}};a.parent=o;return o}));t.addCommand("set",(function(e,t,r){if(!r.matchToken("set"))return;if(r.currentToken().type==="L_BRACE"){var n=e.requireElement("objectLiteral",r);r.requireToken("on");var i=e.requireElement("expression",r);var a={objectLiteral:n,target:i,args:[n,i],op:function(e,r,n){Object.assign(n,r);return t.findNext(this,e)}};return a}try{r.pushFollow("to");var i=e.requireElement("assignableExpression",r);}finally{r.popFollow();}r.requireToken("to");var o=e.requireElement("expression",r);return k(e,t,r,i,o)}));t.addCommand("if",(function(e,t,r){if(!r.matchToken("if"))return;var n=e.requireElement("expression",r);r.matchToken("then");var i=e.parseElement("commandList",r);var a=false;let o=r.matchToken("else")||r.matchToken("otherwise");if(o){let t=r.peekToken("if");a=t!=null&&t.line===o.line;if(a){var s=e.parseElement("command",r);}else {var s=e.parseElement("commandList",r);}}if(r.hasMore()&&!a){r.requireToken("end");}var u={expr:n,trueBranch:i,falseBranch:s,args:[n],op:function(e,r){if(r){return i}else if(s){return s}else {return t.findNext(this,e)}}};e.setParent(i,u);e.setParent(s,u);return u}));var x=function(e,t,r,n){var i=t.currentToken();var a;if(t.matchToken("for")||n){var o=t.requireTokenType("IDENTIFIER");a=o.value;t.requireToken("in");var s=e.requireElement("expression",t);}else if(t.matchToken("in")){a="it";var s=e.requireElement("expression",t);}else if(t.matchToken("while")){var u=e.requireElement("expression",t);}else if(t.matchToken("until")){var l=true;if(t.matchToken("event")){var c=e.requireElement("dotOrColonPath",t,"Expected event name");if(t.matchToken("from")){var f=e.requireElement("expression",t);}}else {var u=e.requireElement("expression",t);}}else {if(!e.commandBoundary(t.currentToken())&&t.currentToken().value!=="forever"){var m=e.requireElement("expression",t);t.requireToken("times");}else {t.matchToken("forever");var p=true;}}if(t.matchToken("index")){var o=t.requireTokenType("IDENTIFIER");var h=o.value;}else if(t.matchToken("indexed")){t.requireToken("by");var o=t.requireTokenType("IDENTIFIER");var h=o.value;}var v=e.parseElement("commandList",t);if(v&&c){var d=v;while(d.next){d=d.next;}var E={type:"waitATick",op:function(){return new Promise((function(e){setTimeout((function(){e(r.findNext(E));}),0);}))}};d.next=E;}if(t.hasMore()){t.requireToken("end");}if(a==null){a="_implicit_repeat_"+i.start;var T=a;}else {var T=a+"_"+i.start;}var y={identifier:a,indexIdentifier:h,slot:T,expression:s,forever:p,times:m,until:l,event:c,on:f,whileExpr:u,resolveNext:function(){return this},loop:v,args:[u,m],op:function(e,t,n){var i=e.meta.iterators[T];var o=false;var s=null;if(this.forever){o=true;}else if(this.until){if(c){o=e.meta.iterators[T].eventFired===false;}else {o=t!==true;}}else if(u){o=t;}else if(n){o=i.index<n;}else {var l=i.iterator.next();o=!l.done;s=l.value;}if(o){if(i.value){e.result=e.locals[a]=s;}else {e.result=i.index;}if(h){e.locals[h]=i.index;}i.index++;return v}else {e.meta.iterators[T]=null;return r.findNext(this.parent,e)}}};e.setParent(v,y);var k={name:"repeatInit",args:[s,c,f],op:function(e,t,r,n){var i={index:0,value:t,eventFired:false};e.meta.iterators[T]=i;if(t&&t[Symbol.iterator]){i.iterator=t[Symbol.iterator]();}if(c){var a=n||e.me;a.addEventListener(r,(function(t){e.meta.iterators[T].eventFired=true;}),{once:true});}return y},execute:function(e){return r.unifiedExec(this,e)}};e.setParent(y,k);return k};t.addCommand("repeat",(function(e,t,r){if(r.matchToken("repeat")){return x(e,r,t,false)}}));t.addCommand("for",(function(e,t,r){if(r.matchToken("for")){return x(e,r,t,true)}}));t.addCommand("continue",(function(e,t,r){if(!r.matchToken("continue"))return;var n={op:function(t){for(var n=this.parent;true;n=n.parent){if(n==undefined){e.raiseParseError(r,"Command `continue` cannot be used outside of a `repeat` loop.");}if(n.loop!=undefined){return n.resolveNext(t)}}}};return n}));t.addCommand("break",(function(e,t,r){if(!r.matchToken("break"))return;var n={op:function(n){for(var i=this.parent;true;i=i.parent){if(i==undefined){e.raiseParseError(r,"Command `continue` cannot be used outside of a `repeat` loop.");}if(i.loop!=undefined){return t.findNext(i.parent,n)}}}};return n}));t.addGrammarElement("stringLike",(function(e,t,r){return e.parseAnyOf(["string","nakedString"],r)}));t.addCommand("append",(function(e,t,r){if(!r.matchToken("append"))return;var n=null;var i=e.requireElement("expression",r);var a={type:"symbol",evaluate:function(e){return t.resolveSymbol("result",e)}};if(r.matchToken("to")){n=e.requireElement("expression",r);}else {n=a;}var o=null;if(n.type==="symbol"||n.type==="attributeRef"||n.root!=null){o=k(e,t,r,n,a);}var s={value:i,target:n,args:[n,i],op:function(e,r,n){if(Array.isArray(r)){r.push(n);return t.findNext(this,e)}else if(r instanceof Element){if(n instanceof Element){r.insertAdjacentElement("beforeend",n);}else {r.insertAdjacentHTML("beforeend",n);}t.processNode(r);return t.findNext(this,e)}else if(o){e.result=(r||"")+n;return o}else {throw Error("Unable to append a value!")}},execute:function(e){return t.unifiedExec(this,e)}};if(o!=null){o.parent=s;}return s}));function g(e,t,r){r.matchToken("at")||r.matchToken("from");const n={includeStart:true,includeEnd:false};n.from=r.matchToken("start")?0:e.requireElement("expression",r);if(r.matchToken("to")||r.matchOpToken("..")){if(r.matchToken("end")){n.toEnd=true;}else {n.to=e.requireElement("expression",r);}}if(r.matchToken("inclusive"))n.includeEnd=true;else if(r.matchToken("exclusive"))n.includeStart=false;return n}class b{constructor(e,t){this.re=e;this.str=t;}next(){const e=this.re.exec(this.str);if(e===null)return {done:true};else return {value:e}}}class w{constructor(e,t,r){this.re=e;this.flags=t;this.str=r;}[Symbol.iterator](){return new b(new RegExp(this.re,this.flags),this.str)}}t.addCommand("pick",((e,t,r)=>{if(!r.matchToken("pick"))return;r.matchToken("the");if(r.matchToken("item")||r.matchToken("items")||r.matchToken("character")||r.matchToken("characters")){const n=g(e,t,r);r.requireToken("from");const i=e.requireElement("expression",r);return {args:[i,n.from,n.to],op(e,r,i,a){if(n.toEnd)a=r.length;if(!n.includeStart)i++;if(n.includeEnd)a++;if(a==null||a==undefined)a=i+1;e.result=r.slice(i,a);return t.findNext(this,e)}}}if(r.matchToken("match")){r.matchToken("of");const n=e.parseElement("expression",r);let i="";if(r.matchOpToken("|")){i=r.requireTokenType("IDENTIFIER").value;}r.requireToken("from");const a=e.parseElement("expression",r);return {args:[a,n],op(e,r,n){e.result=new RegExp(n,i).exec(r);return t.findNext(this,e)}}}if(r.matchToken("matches")){r.matchToken("of");const n=e.parseElement("expression",r);let i="gu";if(r.matchOpToken("|")){i="g"+r.requireTokenType("IDENTIFIER").value.replace("g","");}r.requireToken("from");const a=e.parseElement("expression",r);return {args:[a,n],op(e,r,n){e.result=new w(n,i,r);return t.findNext(this,e)}}}}));t.addCommand("increment",(function(e,t,r){if(!r.matchToken("increment"))return;var n;var i=e.parseElement("assignableExpression",r);if(r.matchToken("by")){n=e.requireElement("expression",r);}var a={type:"implicitIncrementOp",target:i,args:[i,n],op:function(e,t,r){t=t?parseFloat(t):0;r=n?parseFloat(r):1;var i=t+r;e.result=i;return i},evaluate:function(e){return t.unifiedEval(this,e)}};return k(e,t,r,i,a)}));t.addCommand("decrement",(function(e,t,r){if(!r.matchToken("decrement"))return;var n;var i=e.parseElement("assignableExpression",r);if(r.matchToken("by")){n=e.requireElement("expression",r);}var a={type:"implicitDecrementOp",target:i,args:[i,n],op:function(e,t,r){t=t?parseFloat(t):0;r=n?parseFloat(r):1;var i=t-r;e.result=i;return i},evaluate:function(e){return t.unifiedEval(this,e)}};return k(e,t,r,i,a)}));function S(e,t){var r="text";var n;e.matchToken("a")||e.matchToken("an");if(e.matchToken("json")||e.matchToken("Object")){r="json";}else if(e.matchToken("response")){r="response";}else if(e.matchToken("html")){r="html";}else if(e.matchToken("text"));else {n=t.requireElement("dotOrColonPath",e).evaluate();}return {type:r,conversion:n}}t.addCommand("fetch",(function(e,t,r){if(!r.matchToken("fetch"))return;var n=e.requireElement("stringLike",r);if(r.matchToken("as")){var i=S(r,e);}if(r.matchToken("with")&&r.currentToken().value!=="{"){var a=e.parseElement("nakedNamedArgumentList",r);}else {var a=e.parseElement("objectLiteral",r);}if(i==null&&r.matchToken("as")){i=S(r,e);}var o=i?i.type:"text";var s=i?i.conversion:null;var u={url:n,argExpressions:a,args:[n,a],op:function(e,r,n){var i=n||{};i["sender"]=e.me;i["headers"]=i["headers"]||{};var a=new AbortController;let l=e.me.addEventListener("fetch:abort",(function(){a.abort();}),{once:true});i["signal"]=a.signal;t.triggerEvent(e.me,"hyperscript:beforeFetch",i);t.triggerEvent(e.me,"fetch:beforeRequest",i);n=i;var c=false;if(n.timeout){setTimeout((function(){if(!c){a.abort();}}),n.timeout);}return fetch(r,n).then((function(r){let n={response:r};t.triggerEvent(e.me,"fetch:afterResponse",n);r=n.response;if(o==="response"){e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}if(o==="json"){return r.json().then((function(r){e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}))}return r.text().then((function(r){if(s)r=t.convertValue(r,s);if(o==="html")r=t.convertValue(r,"Fragment");e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}))})).catch((function(r){t.triggerEvent(e.me,"fetch:error",{reason:r});throw r})).finally((function(){e.me.removeEventListener("fetch:abort",l);}))}};return u}));}function y(e){e.addCommand("settle",(function(e,t,r){if(r.matchToken("settle")){if(!e.commandBoundary(r.currentToken())){var n=e.requireElement("expression",r);}else {var n=e.requireElement("implicitMeTarget",r);}var i={type:"settleCmd",args:[n],op:function(e,r){t.nullCheck(r,n);var a=null;var s=false;var u=new Promise((function(e){a=e;}));r.addEventListener("transitionstart",(function(){s=true;}),{once:true});setTimeout((function(){if(!s&&true){a(t.findNext(i,e));}}),500);r.addEventListener("transitionend",(function(){{a(t.findNext(i,e));}}),{once:true});return u},execute:function(e){return t.unifiedExec(this,e)}};return i}}));e.addCommand("add",(function(e,t,r){if(r.matchToken("add")){var n=e.parseElement("classRef",r);var i=null;var a=null;if(n==null){i=e.parseElement("attributeRef",r);if(i==null){a=e.parseElement("styleLiteral",r);if(a==null){e.raiseParseError(r,"Expected either a class reference or attribute expression");}}}else {var o=[n];while(n=e.parseElement("classRef",r)){o.push(n);}}if(r.matchToken("to")){var s=e.requireElement("expression",r);}else {var s=e.requireElement("implicitMeTarget",r);}if(r.matchToken("when")){if(a){e.raiseParseError(r,"Only class and properties are supported with a when clause");}var u=e.requireElement("expression",r);}if(o){return {classRefs:o,to:s,args:[s,o],op:function(e,r,n){t.nullCheck(r,s);t.forEach(n,(function(n){t.implicitLoop(r,(function(r){if(u){e.result=r;let i=t.evaluateNoPromise(u,e);if(i){if(r instanceof Element)r.classList.add(n.className);}else {if(r instanceof Element)r.classList.remove(n.className);}e.result=null;}else {if(r instanceof Element)r.classList.add(n.className);}}));}));return t.findNext(this,e)}}}else if(i){return {type:"addCmd",attributeRef:i,to:s,args:[s],op:function(e,r,n){t.nullCheck(r,s);t.implicitLoop(r,(function(r){if(u){e.result=r;let n=t.evaluateNoPromise(u,e);if(n){r.setAttribute(i.name,i.value);}else {r.removeAttribute(i.name);}e.result=null;}else {r.setAttribute(i.name,i.value);}}));return t.findNext(this,e)},execute:function(e){return t.unifiedExec(this,e)}}}else {return {type:"addCmd",cssDeclaration:a,to:s,args:[s,a],op:function(e,r,n){t.nullCheck(r,s);t.implicitLoop(r,(function(e){e.style.cssText+=n;}));return t.findNext(this,e)},execute:function(e){return t.unifiedExec(this,e)}}}}}));e.addGrammarElement("styleLiteral",(function(e,t,r){if(!r.matchOpToken("{"))return;var n=[""];var i=[];while(r.hasMore()){if(r.matchOpToken("\\")){r.consumeToken();}else if(r.matchOpToken("}")){break}else if(r.matchToken("$")){var a=r.matchOpToken("{");var o=e.parseElement("expression",r);if(a)r.requireOpToken("}");i.push(o);n.push("");}else {var s=r.consumeToken();n[n.length-1]+=r.source.substring(s.start,s.end);}n[n.length-1]+=r.lastWhitespace();}return {type:"styleLiteral",args:[i],op:function(e,t){var r="";n.forEach((function(e,n){r+=e;if(n in t)r+=t[n];}));return r},evaluate:function(e){return t.unifiedEval(this,e)}}}));e.addCommand("remove",(function(e,t,r){if(r.matchToken("remove")){var n=e.parseElement("classRef",r);var i=null;var a=null;if(n==null){i=e.parseElement("attributeRef",r);if(i==null){a=e.parseElement("expression",r);if(a==null){e.raiseParseError(r,"Expected either a class reference, attribute expression or value expression");}}}else {var o=[n];while(n=e.parseElement("classRef",r)){o.push(n);}}if(r.matchToken("from")){var s=e.requireElement("expression",r);}else {if(a==null){var s=e.requireElement("implicitMeTarget",r);}}if(a){return {elementExpr:a,from:s,args:[a,s],op:function(e,r,n){t.nullCheck(r,a);t.implicitLoop(r,(function(e){if(e.parentElement&&(n==null||n.contains(e))){e.parentElement.removeChild(e);}}));return t.findNext(this,e)}}}else {return {classRefs:o,attributeRef:i,elementExpr:a,from:s,args:[o,s],op:function(e,r,n){t.nullCheck(n,s);if(r){t.forEach(r,(function(e){t.implicitLoop(n,(function(t){t.classList.remove(e.className);}));}));}else {t.implicitLoop(n,(function(e){e.removeAttribute(i.name);}));}return t.findNext(this,e)}}}}}));e.addCommand("toggle",(function(e,t,r){if(r.matchToken("toggle")){r.matchAnyToken("the","my");if(r.currentToken().type==="STYLE_REF"){let t=r.consumeToken();var n=t.value.substr(1);var a=true;var o=i(e,r,n);if(r.matchToken("of")){r.pushFollow("with");try{var s=e.requireElement("expression",r);}finally{r.popFollow();}}else {var s=e.requireElement("implicitMeTarget",r);}}else if(r.matchToken("between")){var u=true;var l=e.parseElement("classRef",r);r.requireToken("and");var c=e.requireElement("classRef",r);}else {var l=e.parseElement("classRef",r);var f=null;if(l==null){f=e.parseElement("attributeRef",r);if(f==null){e.raiseParseError(r,"Expected either a class reference or attribute expression");}}else {var m=[l];while(l=e.parseElement("classRef",r)){m.push(l);}}}if(a!==true){if(r.matchToken("on")){var s=e.requireElement("expression",r);}else {var s=e.requireElement("implicitMeTarget",r);}}if(r.matchToken("for")){var p=e.requireElement("expression",r);}else if(r.matchToken("until")){var h=e.requireElement("dotOrColonPath",r,"Expected event name");if(r.matchToken("from")){var v=e.requireElement("expression",r);}}var d={classRef:l,classRef2:c,classRefs:m,attributeRef:f,on:s,time:p,evt:h,from:v,toggle:function(e,r,n,i){t.nullCheck(e,s);if(a){t.implicitLoop(e,(function(e){o("toggle",e);}));}else if(u){t.implicitLoop(e,(function(e){if(e.classList.contains(r.className)){e.classList.remove(r.className);e.classList.add(n.className);}else {e.classList.add(r.className);e.classList.remove(n.className);}}));}else if(i){t.forEach(i,(function(r){t.implicitLoop(e,(function(e){e.classList.toggle(r.className);}));}));}else {t.implicitLoop(e,(function(e){if(e.hasAttribute(f.name)){e.removeAttribute(f.name);}else {e.setAttribute(f.name,f.value);}}));}},args:[s,p,h,v,l,c,m],op:function(e,r,n,i,a,o,s,u){if(n){return new Promise((function(i){d.toggle(r,o,s,u);setTimeout((function(){d.toggle(r,o,s,u);i(t.findNext(d,e));}),n);}))}else if(i){return new Promise((function(n){var l=a||e.me;l.addEventListener(i,(function(){d.toggle(r,o,s,u);n(t.findNext(d,e));}),{once:true});d.toggle(r,o,s,u);}))}else {this.toggle(r,o,s,u);return t.findNext(d,e)}}};return d}}));var t={display:function(r,n,i){if(i){n.style.display=i;}else if(r==="toggle"){if(getComputedStyle(n).display==="none"){t.display("show",n,i);}else {t.display("hide",n,i);}}else if(r==="hide"){const t=e.runtime.getInternalData(n);if(t.originalDisplay==null){t.originalDisplay=n.style.display;}n.style.display="none";}else {const t=e.runtime.getInternalData(n);if(t.originalDisplay&&t.originalDisplay!=="none"){n.style.display=t.originalDisplay;}else {n.style.removeProperty("display");}}},visibility:function(e,r,n){if(n){r.style.visibility=n;}else if(e==="toggle"){if(getComputedStyle(r).visibility==="hidden"){t.visibility("show",r,n);}else {t.visibility("hide",r,n);}}else if(e==="hide"){r.style.visibility="hidden";}else {r.style.visibility="visible";}},opacity:function(e,r,n){if(n){r.style.opacity=n;}else if(e==="toggle"){if(getComputedStyle(r).opacity==="0"){t.opacity("show",r,n);}else {t.opacity("hide",r,n);}}else if(e==="hide"){r.style.opacity="0";}else {r.style.opacity="1";}}};var n=function(e,t,r){var n;var i=r.currentToken();if(i.value==="when"||i.value==="with"||e.commandBoundary(i)){n=e.parseElement("implicitMeTarget",r);}else {n=e.parseElement("expression",r);}return n};var i=function(e,n,i){var a=r.defaultHideShowStrategy;var o=t;if(r.hideShowStrategies){o=Object.assign(o,r.hideShowStrategies);}i=i||a||"display";var s=o[i];if(s==null){e.raiseParseError(n,"Unknown show/hide strategy : "+i);}return s};e.addCommand("hide",(function(e,t,r){if(r.matchToken("hide")){var a=n(e,t,r);var o=null;if(r.matchToken("with")){o=r.requireTokenType("IDENTIFIER","STYLE_REF").value;if(o.indexOf("*")===0){o=o.substr(1);}}var s=i(e,r,o);return {target:a,args:[a],op:function(e,r){t.nullCheck(r,a);t.implicitLoop(r,(function(e){s("hide",e);}));return t.findNext(this,e)}}}}));e.addCommand("show",(function(e,t,r){if(r.matchToken("show")){var a=n(e,t,r);var o=null;if(r.matchToken("with")){o=r.requireTokenType("IDENTIFIER","STYLE_REF").value;if(o.indexOf("*")===0){o=o.substr(1);}}var s=null;if(r.matchOpToken(":")){var u=r.consumeUntilWhitespace();r.matchTokenType("WHITESPACE");s=u.map((function(e){return e.value})).join("");}if(r.matchToken("when")){var l=e.requireElement("expression",r);}var c=i(e,r,o);return {target:a,when:l,args:[a],op:function(e,r){t.nullCheck(r,a);t.implicitLoop(r,(function(r){if(l){e.result=r;let n=t.evaluateNoPromise(l,e);if(n){c("show",r,s);}else {c("hide",r);}e.result=null;}else {c("show",r,s);}}));return t.findNext(this,e)}}}}));e.addCommand("take",(function(e,t,r){if(r.matchToken("take")){let u=null;let l=[];while(u=e.parseElement("classRef",r)){l.push(u);}var n=null;var i=null;let c=l.length>0;if(!c){n=e.parseElement("attributeRef",r);if(n==null){e.raiseParseError(r,"Expected either a class reference or attribute expression");}if(r.matchToken("with")){i=e.requireElement("expression",r);}}if(r.matchToken("from")){var a=e.requireElement("expression",r);}if(r.matchToken("for")){var o=e.requireElement("expression",r);}else {var o=e.requireElement("implicitMeTarget",r);}if(c){var s={classRefs:l,from:a,forElt:o,args:[l,a,o],op:function(e,r,n,i){t.nullCheck(i,o);t.implicitLoop(r,(function(e){var r=e.className;if(n){t.implicitLoop(n,(function(e){e.classList.remove(r);}));}else {t.implicitLoop(e,(function(e){e.classList.remove(r);}));}t.implicitLoop(i,(function(e){e.classList.add(r);}));}));return t.findNext(this,e)}};return s}else {var s={attributeRef:n,from:a,forElt:o,args:[a,o,i],op:function(e,r,i,s){t.nullCheck(r,a);t.nullCheck(i,o);t.implicitLoop(r,(function(e){if(!s){e.removeAttribute(n.name);}else {e.setAttribute(n.name,s);}}));t.implicitLoop(i,(function(e){e.setAttribute(n.name,n.value||"");}));return t.findNext(this,e)}};return s}}}));function a(t,r,n,i){if(n!=null){var a=t.resolveSymbol(n,r);}else {var a=r;}if(a instanceof Element||a instanceof HTMLDocument){while(a.firstChild)a.removeChild(a.firstChild);a.append(e.runtime.convertValue(i,"Fragment"));t.processNode(a);}else {if(n!=null){t.setSymbol(n,r,null,i);}else {throw "Don't know how to put a value into "+typeof r}}}e.addCommand("put",(function(e,t,r){if(r.matchToken("put")){var n=e.requireElement("expression",r);var i=r.matchAnyToken("into","before","after");if(i==null&&r.matchToken("at")){r.matchToken("the");i=r.matchAnyToken("start","end");r.requireToken("of");}if(i==null){e.raiseParseError(r,"Expected one of 'into', 'before', 'at start of', 'at end of', 'after'");}var o=e.requireElement("expression",r);var s=i.value;var u=false;var l=false;var c=null;var f=null;if(o.type==="arrayIndex"&&s==="into"){u=true;f=o.prop;c=o.root;}else if(o.prop&&o.root&&s==="into"){f=o.prop.value;c=o.root;}else if(o.type==="symbol"&&s==="into"){l=true;f=o.name;}else if(o.type==="attributeRef"&&s==="into"){var m=true;f=o.name;c=e.requireElement("implicitMeTarget",r);}else if(o.type==="styleRef"&&s==="into"){var p=true;f=o.name;c=e.requireElement("implicitMeTarget",r);}else if(o.attribute&&s==="into"){var m=o.attribute.type==="attributeRef";var p=o.attribute.type==="styleRef";f=o.attribute.name;c=o.root;}else {c=o;}var h={target:o,operation:s,symbolWrite:l,value:n,args:[c,f,n],op:function(e,r,n,i){if(l){a(t,e,n,i);}else {t.nullCheck(r,c);if(s==="into"){if(m){t.implicitLoop(r,(function(e){e.setAttribute(n,i);}));}else if(p){t.implicitLoop(r,(function(e){e.style[n]=i;}));}else if(u){r[n]=i;}else {t.implicitLoop(r,(function(e){a(t,e,n,i);}));}}else {var o=s==="before"?Element.prototype.before:s==="after"?Element.prototype.after:s==="start"?Element.prototype.prepend:s==="end"?Element.prototype.append:Element.prototype.append;t.implicitLoop(r,(function(e){o.call(e,i instanceof Node?i:t.convertValue(i,"Fragment"));if(e.parentElement){t.processNode(e.parentElement);}else {t.processNode(e);}}));}}return t.findNext(this,e)}};return h}}));function o(e,t,r){var n;if(r.matchToken("the")||r.matchToken("element")||r.matchToken("elements")||r.currentToken().type==="CLASS_REF"||r.currentToken().type==="ID_REF"||r.currentToken().op&&r.currentToken().value==="<"){e.possessivesDisabled=true;try{n=e.parseElement("expression",r);}finally{delete e.possessivesDisabled;}if(r.matchOpToken("'")){r.requireToken("s");}}else if(r.currentToken().type==="IDENTIFIER"&&r.currentToken().value==="its"){var i=r.matchToken("its");n={type:"pseudopossessiveIts",token:i,name:i.value,evaluate:function(e){return t.resolveSymbol("it",e)}};}else {r.matchToken("my")||r.matchToken("me");n=e.parseElement("implicitMeTarget",r);}return n}e.addCommand("transition",(function(e,t,n){if(n.matchToken("transition")){var i=o(e,t,n);var a=[];var s=[];var u=[];var l=n.currentToken();while(!e.commandBoundary(l)&&l.value!=="over"&&l.value!=="using"){if(n.currentToken().type==="STYLE_REF"){let e=n.consumeToken();let t=e.value.substr(1);a.push({type:"styleRefValue",evaluate:function(){return t}});}else {a.push(e.requireElement("stringLike",n));}if(n.matchToken("from")){s.push(e.requireElement("expression",n));}else {s.push(null);}n.requireToken("to");if(n.matchToken("initial")){u.push({type:"initial_literal",evaluate:function(){return "initial"}});}else {u.push(e.requireElement("expression",n));}l=n.currentToken();}if(n.matchToken("over")){var c=e.requireElement("expression",n);}else if(n.matchToken("using")){var f=e.requireElement("expression",n);}var m={to:u,args:[i,a,s,u,f,c],op:function(e,n,a,o,s,u,l){t.nullCheck(n,i);var c=[];t.implicitLoop(n,(function(e){var n=new Promise((function(n,i){var c=e.style.transition;if(l){e.style.transition="all "+l+"ms ease-in";}else if(u){e.style.transition=u;}else {e.style.transition=r.defaultTransition;}var f=t.getInternalData(e);var m=getComputedStyle(e);var p={};for(var h=0;h<m.length;h++){var v=m[h];var d=m[v];p[v]=d;}if(!f.initialStyles){f.initialStyles=p;}for(var h=0;h<a.length;h++){var E=a[h];var T=o[h];if(T==="computed"||T==null){e.style[E]=p[E];}else {e.style[E]=T;}}var y=false;var k=false;e.addEventListener("transitionend",(function(){if(!k){e.style.transition=c;k=true;n();}}),{once:true});e.addEventListener("transitionstart",(function(){y=true;}),{once:true});setTimeout((function(){if(!k&&!y){e.style.transition=c;k=true;n();}}),100);setTimeout((function(){for(var r=0;r<a.length;r++){var n=a[r];var i=s[r];if(i==="initial"){var o=f.initialStyles[n];e.style[n]=o;}else {e.style[n]=i;}}}),0);}));c.push(n);}));return Promise.all(c).then((function(){return t.findNext(m,e)}))}};return m}}));e.addCommand("measure",(function(e,t,r){if(!r.matchToken("measure"))return;var n=o(e,t,r);var i=[];if(!e.commandBoundary(r.currentToken()))do{i.push(r.matchTokenType("IDENTIFIER").value);}while(r.matchOpToken(","));return {properties:i,args:[n],op:function(e,r){t.nullCheck(r,n);if(0 in r)r=r[0];var a=r.getBoundingClientRect();var o={top:r.scrollTop,left:r.scrollLeft,topMax:r.scrollTopMax,leftMax:r.scrollLeftMax,height:r.scrollHeight,width:r.scrollWidth};e.result={x:a.x,y:a.y,left:a.left,top:a.top,right:a.right,bottom:a.bottom,width:a.width,height:a.height,bounds:a,scrollLeft:o.left,scrollTop:o.top,scrollLeftMax:o.leftMax,scrollTopMax:o.topMax,scrollWidth:o.width,scrollHeight:o.height,scroll:o};t.forEach(i,(function(t){if(t in e.result)e.locals[t]=e.result[t];else throw "No such measurement as "+t}));return t.findNext(this,e)}}}));e.addLeafExpression("closestExpr",(function(e,t,r){if(r.matchToken("closest")){if(r.matchToken("parent")){var n=true;}var i=null;if(r.currentToken().type==="ATTRIBUTE_REF"){var a=e.requireElement("attributeRefAccess",r,null);i="["+a.attribute.name+"]";}if(i==null){var o=e.requireElement("expression",r);if(o.css==null){e.raiseParseError(r,"Expected a CSS expression");}else {i=o.css;}}if(r.matchToken("to")){var s=e.parseElement("expression",r);}else {var s=e.parseElement("implicitMeTarget",r);}var u={type:"closestExpr",parentSearch:n,expr:o,css:i,to:s,args:[s],op:function(e,r){if(r==null){return null}else {let e=[];t.implicitLoop(r,(function(t){if(n){e.push(t.parentElement?t.parentElement.closest(i):null);}else {e.push(t.closest(i));}}));if(t.shouldAutoIterate(r)){return e}else {return e[0]}}},evaluate:function(e){return t.unifiedEval(this,e)}};if(a){a.root=u;a.args=[u];return a}else {return u}}}));e.addCommand("go",(function(e,t,r){if(r.matchToken("go")){if(r.matchToken("back")){var n=true;}else {r.matchToken("to");if(r.matchToken("url")){var i=e.requireElement("stringLike",r);var a=true;if(r.matchToken("in")){r.requireToken("new");r.requireToken("window");var o=true;}}else {r.matchToken("the");var s=r.matchAnyToken("top","middle","bottom");var u=r.matchAnyToken("left","center","right");if(s||u){r.requireToken("of");}var i=e.requireElement("unaryExpression",r);var l=r.matchAnyOpToken("+","-");if(l){r.pushFollow("px");try{var c=e.requireElement("expression",r);}finally{r.popFollow();}}r.matchToken("px");var f=r.matchAnyToken("smoothly","instantly");var m={block:"start",inline:"nearest"};if(s){if(s.value==="top"){m.block="start";}else if(s.value==="bottom"){m.block="end";}else if(s.value==="middle"){m.block="center";}}if(u){if(u.value==="left"){m.inline="start";}else if(u.value==="center"){m.inline="center";}else if(u.value==="right"){m.inline="end";}}if(f){if(f.value==="smoothly"){m.behavior="smooth";}else if(f.value==="instantly"){m.behavior="instant";}}}}var p={target:i,args:[i,c],op:function(e,r,i){if(n){window.history.back();}else if(a){if(r){if(o){window.open(r);}else {window.location.href=r;}}}else {t.implicitLoop(r,(function(e){if(e===window){e=document.body;}if(l){let t=e.getBoundingClientRect();let r=document.createElement("div");let n=l.value==="+"?i:i*-1;let a=m.inline=="start"||m.inline=="end"?n:0;let o=m.block=="start"||m.block=="end"?n:0;r.style.position="absolute";r.style.top=t.top+window.scrollY+o+"px";r.style.left=t.left+window.scrollX+a+"px";r.style.height=t.height+"px";r.style.width=t.width+"px";r.style.zIndex=""+Number.MIN_SAFE_INTEGER;r.style.opacity="0";document.body.appendChild(r);setTimeout((function(){document.body.removeChild(r);}),100);e=r;}e.scrollIntoView(m);}));}return t.findNext(p,e)}};return p}}));r.conversions.dynamicResolvers.push((function(t,r){if(!(t==="Values"||t.indexOf("Values:")===0)){return}var n=t.split(":")[1];var i={};var a=e.runtime.implicitLoop.bind(e.runtime);a(r,(function(e){var t=s(e);if(t!==undefined){i[t.name]=t.value;return}if(e.querySelectorAll!=undefined){var r=e.querySelectorAll("input,select,textarea");r.forEach(o);}}));if(n){if(n==="JSON"){return JSON.stringify(i)}else if(n==="Form"){return new URLSearchParams(i).toString()}else {throw "Unknown conversion: "+n}}else {return i}function o(e){var t=s(e);if(t==undefined){return}if(i[t.name]==undefined){i[t.name]=t.value;return}if(Array.isArray(i[t.name])&&Array.isArray(t.value)){i[t.name]=[].concat(i[t.name],t.value);return}}function s(e){try{var t={name:e.name,value:e.value};if(t.name==undefined||t.value==undefined){return undefined}if(e.type=="radio"&&e.checked==false){return undefined}if(e.type=="checkbox"){if(e.checked==false){t.value=undefined;}else if(typeof t.value==="string"){t.value=[t.value];}}if(e.type=="select-multiple"){var r=e.querySelectorAll("option[selected]");t.value=[];for(var n=0;n<r.length;n++){t.value.push(r[n].value);}}return t}catch(e){return undefined}}}));r.conversions["HTML"]=function(e){var t=function(e){if(e instanceof Array){return e.map((function(e){return t(e)})).join("")}if(e instanceof HTMLElement){return e.outerHTML}if(e instanceof NodeList){var r="";for(var n=0;n<e.length;n++){var i=e[n];if(i instanceof HTMLElement){r+=i.outerHTML;}}return r}if(e.toString){return e.toString()}return ""};return t(e)};r.conversions["Fragment"]=function(t){var r=document.createDocumentFragment();e.runtime.implicitLoop(t,(function(e){if(e instanceof Node)r.append(e);else {var t=document.createElement("template");t.innerHTML=e;r.append(t.content);}}));return r};}const k=new o,x=k.lexer,g=k.parser;function b(e,t){return k.evaluate(e,t)}function w(){var t=Array.from(e.document.querySelectorAll("script[type='text/hyperscript'][src]"));Promise.all(t.map((function(e){return fetch(e.src).then((function(e){return e.text()}))}))).then((e=>e.forEach((e=>S(e))))).then((()=>n((function(){a();k.processNode(document.documentElement);document.dispatchEvent(new Event("hyperscript:ready"));e.document.addEventListener("htmx:load",(function(e){k.processNode(e.detail.elt);}));}))));function n(e){if(document.readyState!=="loading"){setTimeout(e);}else {document.addEventListener("DOMContentLoaded",e);}}function i(){var e=document.querySelector('meta[name="htmx-config"]');if(e){return v(e.content)}else {return null}}function a(){var e=i();if(e){Object.assign(r,e);}}}const S=Object.assign(b,{config:r,use(e){e(S);},internals:{lexer:x,parser:g,runtime:k,Lexer:n,Tokens:i,Parser:a,Runtime:o},ElementCollection:m,addFeature:g.addFeature.bind(g),addCommand:g.addCommand.bind(g),addLeafExpression:g.addLeafExpression.bind(g),addIndirectExpression:g.addIndirectExpression.bind(g),evaluate:k.evaluate.bind(k),parse:k.parse.bind(k),processNode:k.processNode.bind(k),version:"0.9.14",browserInit:w});return S}));
} (_hyperscript_min$1, _hyperscript_min$1.exports));
return _hyperscript_min$1.exports;
}
var _hyperscript_minExports = require_hyperscript_min();
/**!
* hotkeys-js v3.13.9
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2024 kenny wong <wowohoo@qq.com>
* https://github.com/jaywcjlove/hotkeys-js.git
*
* @website: https://jaywcjlove.github.io/hotkeys-js
* Licensed under the MIT license
*/
const isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false;
// 绑定事件
function addEvent(object, event, method, useCapture) {
if (object.addEventListener) {
object.addEventListener(event, method, useCapture);
} else if (object.attachEvent) {
object.attachEvent("on".concat(event), method);
}
}
function removeEvent(object, event, method, useCapture) {
if (object.removeEventListener) {
object.removeEventListener(event, method, useCapture);
} else if (object.detachEvent) {
object.detachEvent("on".concat(event), method);
}
}
// 修饰键转换成对应的键码
function getMods(modifier, key) {
const mods = key.slice(0, key.length - 1);
for (let i = 0; i < mods.length; i++) mods[i] = modifier[mods[i].toLowerCase()];
return mods;
}
// 处理传的key字符串转换成数组
function getKeys(key) {
if (typeof key !== 'string') key = '';
key = key.replace(/\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等
const keys = key.split(','); // 同时设置多个快捷键,以','分割
let index = keys.lastIndexOf('');
// 快捷键可能包含',',需特殊处理
for (; index >= 0;) {
keys[index - 1] += ',';
keys.splice(index, 1);
index = keys.lastIndexOf('');
}
return keys;
}
// 比较修饰键的数组
function compareArray(a1, a2) {
const arr1 = a1.length >= a2.length ? a1 : a2;
const arr2 = a1.length >= a2.length ? a2 : a1;
let isIndex = true;
for (let i = 0; i < arr1.length; i++) {
if (arr2.indexOf(arr1[i]) === -1) isIndex = false;
}
return isIndex;
}
// Special Keys
const _keyMap = {
backspace: 8,
'⌫': 8,
tab: 9,
clear: 12,
enter: 13,
'↩': 13,
return: 13,
esc: 27,
escape: 27,
space: 32,
left: 37,
up: 38,
right: 39,
down: 40,
del: 46,
delete: 46,
ins: 45,
insert: 45,
home: 36,
end: 35,
pageup: 33,
pagedown: 34,
capslock: 20,
num_0: 96,
num_1: 97,
num_2: 98,
num_3: 99,
num_4: 100,
num_5: 101,
num_6: 102,
num_7: 103,
num_8: 104,
num_9: 105,
num_multiply: 106,
num_add: 107,
num_enter: 108,
num_subtract: 109,
num_decimal: 110,
num_divide: 111,
'⇪': 20,
',': 188,
'.': 190,
'/': 191,
'`': 192,
'-': isff ? 173 : 189,
'=': isff ? 61 : 187,
';': isff ? 59 : 186,
'\'': 222,
'[': 219,
']': 221,
'\\': 220
};
// Modifier Keys
const _modifier = {
// shiftKey
'⇧': 16,
shift: 16,
// altKey
'⌥': 18,
alt: 18,
option: 18,
// ctrlKey
'⌃': 17,
ctrl: 17,
control: 17,
// metaKey
'⌘': 91,
cmd: 91,
command: 91
};
const modifierMap = {
16: 'shiftKey',
18: 'altKey',
17: 'ctrlKey',
91: 'metaKey',
shiftKey: 16,
ctrlKey: 17,
altKey: 18,
metaKey: 91
};
const _mods = {
16: false,
18: false,
17: false,
91: false
};
const _handlers = {};
// F1~F12 special key
for (let k = 1; k < 20; k++) {
_keyMap["f".concat(k)] = 111 + k;
}
let _downKeys = []; // 记录摁下的绑定键
let winListendFocus = null; // window是否已经监听了focus事件
let _scope = 'all'; // 默认热键范围
const elementEventMap = new Map(); // 已绑定事件的节点记录
// 返回键码
const code = x => _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
const getKey = x => Object.keys(_keyMap).find(k => _keyMap[k] === x);
const getModifier = x => Object.keys(_modifier).find(k => _modifier[k] === x);
// 设置获取当前范围(默认为'所有'
function setScope(scope) {
_scope = scope || 'all';
}
// 获取当前范围
function getScope() {
return _scope || 'all';
}
// 获取摁下绑定键的键值
function getPressedKeyCodes() {
return _downKeys.slice(0);
}
function getPressedKeyString() {
return _downKeys.map(c => getKey(c) || getModifier(c) || String.fromCharCode(c));
}
function getAllKeyCodes() {
const result = [];
Object.keys(_handlers).forEach(k => {
_handlers[k].forEach(_ref => {
let {
key,
scope,
mods,
shortcut
} = _ref;
result.push({
scope,
shortcut,
mods,
keys: key.split('+').map(v => code(v))
});
});
});
return result;
}
// 表单控件控件判断 返回 Boolean
// hotkey is effective only when filter return true
function filter(event) {
const target = event.target || event.srcElement;
const {
tagName
} = target;
let flag = true;
const isInput = tagName === 'INPUT' && !['checkbox', 'radio', 'range', 'button', 'file', 'reset', 'submit', 'color'].includes(target.type);
// ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
if (target.isContentEditable || (isInput || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
flag = false;
}
return flag;
}
// 判断摁下的键是否为某个键返回true或者false
function isPressed(keyCode) {
if (typeof keyCode === 'string') {
keyCode = code(keyCode); // 转换成键码
}
return _downKeys.indexOf(keyCode) !== -1;
}
// 循环删除handlers中的所有 scope(范围)
function deleteScope(scope, newScope) {
let handlers;
let i;
// 没有指定scope获取scope
if (!scope) scope = getScope();
for (const key in _handlers) {
if (Object.prototype.hasOwnProperty.call(_handlers, key)) {
handlers = _handlers[key];
for (i = 0; i < handlers.length;) {
if (handlers[i].scope === scope) {
const deleteItems = handlers.splice(i, 1);
deleteItems.forEach(_ref2 => {
let {
element
} = _ref2;
return removeKeyEvent(element);
});
} else {
i++;
}
}
}
}
// 如果scope被删除将scope重置为all
if (getScope() === scope) setScope(newScope || 'all');
}
// 清除修饰键
function clearModifier(event) {
let key = event.keyCode || event.which || event.charCode;
const i = _downKeys.indexOf(key);
// 从列表中清除按压过的键
if (i >= 0) {
_downKeys.splice(i, 1);
}
// 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
if (event.key && event.key.toLowerCase() === 'meta') {
_downKeys.splice(0, _downKeys.length);
}
// 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除
if (key === 93 || key === 224) key = 91;
if (key in _mods) {
_mods[key] = false;
// 将修饰键重置为false
for (const k in _modifier) if (_modifier[k] === key) hotkeys[k] = false;
}
}
function unbind(keysInfo) {
// unbind(), unbind all keys
if (typeof keysInfo === 'undefined') {
Object.keys(_handlers).forEach(key => {
Array.isArray(_handlers[key]) && _handlers[key].forEach(info => eachUnbind(info));
delete _handlers[key];
});
removeKeyEvent(null);
} else if (Array.isArray(keysInfo)) {
// support like : unbind([{key: 'ctrl+a', scope: 's1'}, {key: 'ctrl-a', scope: 's2', splitKey: '-'}])
keysInfo.forEach(info => {
if (info.key) eachUnbind(info);
});
} else if (typeof keysInfo === 'object') {
// support like unbind({key: 'ctrl+a, ctrl+b', scope:'abc'})
if (keysInfo.key) eachUnbind(keysInfo);
} else if (typeof keysInfo === 'string') {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// support old method
// eslint-disable-line
let [scope, method] = args;
if (typeof scope === 'function') {
method = scope;
scope = '';
}
eachUnbind({
key: keysInfo,
scope,
method,
splitKey: '+'
});
}
}
// 解除绑定某个范围的快捷键
const eachUnbind = _ref3 => {
let {
key,
scope,
method,
splitKey = '+'
} = _ref3;
const multipleKeys = getKeys(key);
multipleKeys.forEach(originKey => {
const unbindKeys = originKey.split(splitKey);
const len = unbindKeys.length;
const lastKey = unbindKeys[len - 1];
const keyCode = lastKey === '*' ? '*' : code(lastKey);
if (!_handlers[keyCode]) return;
// 判断是否传入范围,没有就获取范围
if (!scope) scope = getScope();
const mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
const unbindElements = [];
_handlers[keyCode] = _handlers[keyCode].filter(record => {
// 通过函数判断,是否解除绑定,函数相等直接返回
const isMatchingMethod = method ? record.method === method : true;
const isUnbind = isMatchingMethod && record.scope === scope && compareArray(record.mods, mods);
if (isUnbind) unbindElements.push(record.element);
return !isUnbind;
});
unbindElements.forEach(element => removeKeyEvent(element));
});
};
// 对监听对应快捷键的回调函数进行处理
function eventHandler(event, handler, scope, element) {
if (handler.element !== element) {
return;
}
let modifiersMatch;
// 看它是否在当前范围
if (handler.scope === scope || handler.scope === 'all') {
// 检查是否匹配修饰符如果有返回true
modifiersMatch = handler.mods.length > 0;
for (const y in _mods) {
if (Object.prototype.hasOwnProperty.call(_mods, y)) {
if (!_mods[y] && handler.mods.indexOf(+y) > -1 || _mods[y] && handler.mods.indexOf(+y) === -1) {
modifiersMatch = false;
}
}
}
// 调用处理程序,如果是修饰键不做处理
if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
handler.keys = [];
handler.keys = handler.keys.concat(_downKeys);
if (handler.method(event, handler) === false) {
if (event.preventDefault) event.preventDefault();else event.returnValue = false;
if (event.stopPropagation) event.stopPropagation();
if (event.cancelBubble) event.cancelBubble = true;
}
}
}
}
// 处理keydown事件
function dispatch(event, element) {
const asterisk = _handlers['*'];
let key = event.keyCode || event.which || event.charCode;
// 表单控件过滤 默认表单控件不触发快捷键
if (!hotkeys.filter.call(this, event)) return;
// Gecko(Firefox)的command键值224在Webkit(Chrome)中保持一致
// Webkit左右 command 键值不一样
if (key === 93 || key === 224) key = 91;
/**
* Collect bound keys
* If an Input Method Editor is processing key input and the event is keydown, return 229.
* https://stackoverflow.com/questions/25043934/is-it-ok-to-ignore-keydown-events-with-keycode-229
* http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
*/
if (_downKeys.indexOf(key) === -1 && key !== 229) _downKeys.push(key);
/**
* Jest test cases are required.
* ===============================
*/
['metaKey', 'ctrlKey', 'altKey', 'shiftKey'].forEach(keyName => {
const keyNum = modifierMap[keyName];
if (event[keyName] && _downKeys.indexOf(keyNum) === -1) {
_downKeys.push(keyNum);
} else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
_downKeys.splice(_downKeys.indexOf(keyNum), 1);
} else if (keyName === 'metaKey' && event[keyName]) {
// 如果command被按下那就清空所有除event按键外的非装饰键。
// 因为command被按下的情况下非装饰键的keyup永远都不会触发。这是已知的浏览器限制。
// If command key is pressed, clear all non-decorating keys except for key in event.
// This is because keyup for a non-decorating key will NEVER be triggered when command is pressed.
// This is a known browser limitation.
_downKeys = _downKeys.filter(k => k in modifierMap || k === key);
}
});
/**
* -------------------------------
*/
if (key in _mods) {
_mods[key] = true;
// 将特殊字符的key注册到 hotkeys 上
for (const k in _modifier) {
if (_modifier[k] === key) hotkeys[k] = true;
}
if (!asterisk) return;
}
// 将 modifierMap 里面的修饰键绑定到 event 中
for (const e in _mods) {
if (Object.prototype.hasOwnProperty.call(_mods, e)) {
_mods[e] = event[modifierMap[e]];
}
}
/**
* https://github.com/jaywcjlove/hotkeys/pull/129
* This solves the issue in Firefox on Windows where hotkeys corresponding to special characters would not trigger.
* An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
* Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
*/
if (event.getModifierState && !(event.altKey && !event.ctrlKey) && event.getModifierState('AltGraph')) {
if (_downKeys.indexOf(17) === -1) {
_downKeys.push(17);
}
if (_downKeys.indexOf(18) === -1) {
_downKeys.push(18);
}
_mods[17] = true;
_mods[18] = true;
}
// 获取范围 默认为 `all`
const scope = getScope();
// 对任何快捷键都需要做的处理
if (asterisk) {
for (let i = 0; i < asterisk.length; i++) {
if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
eventHandler(event, asterisk[i], scope, element);
}
}
}
// key 不在 _handlers 中返回
if (!(key in _handlers)) return;
const handlerKey = _handlers[key];
const keyLen = handlerKey.length;
for (let i = 0; i < keyLen; i++) {
if (event.type === 'keydown' && handlerKey[i].keydown || event.type === 'keyup' && handlerKey[i].keyup) {
if (handlerKey[i].key) {
const record = handlerKey[i];
const {
splitKey
} = record;
const keyShortcut = record.key.split(splitKey);
const _downKeysCurrent = []; // 记录当前按键键值
for (let a = 0; a < keyShortcut.length; a++) {
_downKeysCurrent.push(code(keyShortcut[a]));
}
if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
// 找到处理内容
eventHandler(event, record, scope, element);
}
}
}
}
}
function hotkeys(key, option, method) {
_downKeys = [];
const keys = getKeys(key); // 需要处理的快捷键列表
let mods = [];
let scope = 'all'; // scope默认为all所有范围都有效
let element = document; // 快捷键事件绑定节点
let i = 0;
let keyup = false;
let keydown = true;
let splitKey = '+';
let capture = false;
let single = false; // 单个callback
// 对为设定范围的判断
if (method === undefined && typeof option === 'function') {
method = option;
}
if (Object.prototype.toString.call(option) === '[object Object]') {
if (option.scope) scope = option.scope; // eslint-disable-line
if (option.element) element = option.element; // eslint-disable-line
if (option.keyup) keyup = option.keyup; // eslint-disable-line
if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
if (option.capture !== undefined) capture = option.capture; // eslint-disable-line
if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
if (option.single === true) single = true; // eslint-disable-line
}
if (typeof option === 'string') scope = option;
// 如果只允许单个callback先unbind
if (single) unbind(key, scope);
// 对于每个快捷键进行处理
for (; i < keys.length; i++) {
key = keys[i].split(splitKey); // 按键列表
mods = [];
// 如果是组合快捷键取得组合快捷键
if (key.length > 1) mods = getMods(_modifier, key);
// 将非修饰键转化为键码
key = key[key.length - 1];
key = key === '*' ? '*' : code(key); // *表示匹配所有快捷键
// 判断key是否在_handlers中不在就赋一个空数组
if (!(key in _handlers)) _handlers[key] = [];
_handlers[key].push({
keyup,
keydown,
scope,
mods,
shortcut: keys[i],
method,
key: keys[i],
splitKey,
element
});
}
// 在全局document上设置快捷键
if (typeof element !== 'undefined' && window) {
if (!elementEventMap.has(element)) {
const keydownListener = function () {
let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
return dispatch(event, element);
};
const keyupListenr = function () {
let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
dispatch(event, element);
clearModifier(event);
};
elementEventMap.set(element, {
keydownListener,
keyupListenr,
capture
});
addEvent(element, 'keydown', keydownListener, capture);
addEvent(element, 'keyup', keyupListenr, capture);
}
if (!winListendFocus) {
const listener = () => {
_downKeys = [];
};
winListendFocus = {
listener,
capture
};
addEvent(window, 'focus', listener, capture);
}
}
}
function trigger(shortcut) {
let scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
Object.keys(_handlers).forEach(key => {
const dataList = _handlers[key].filter(item => item.scope === scope && item.shortcut === shortcut);
dataList.forEach(data => {
if (data && data.method) {
data.method();
}
});
});
}
// 销毁事件,unbind之后判断element上是否还有键盘快捷键如果没有移除监听
function removeKeyEvent(element) {
const values = Object.values(_handlers).flat();
const findindex = values.findIndex(_ref4 => {
let {
element: el
} = _ref4;
return el === element;
});
if (findindex < 0) {
const {
keydownListener,
keyupListenr,
capture
} = elementEventMap.get(element) || {};
if (keydownListener && keyupListenr) {
removeEvent(element, 'keyup', keyupListenr, capture);
removeEvent(element, 'keydown', keydownListener, capture);
elementEventMap.delete(element);
}
}
if (values.length <= 0 || elementEventMap.size <= 0) {
// 移除所有的元素上的监听
const eventKeys = Object.keys(elementEventMap);
eventKeys.forEach(el => {
const {
keydownListener,
keyupListenr,
capture
} = elementEventMap.get(el) || {};
if (keydownListener && keyupListenr) {
removeEvent(el, 'keyup', keyupListenr, capture);
removeEvent(el, 'keydown', keydownListener, capture);
elementEventMap.delete(el);
}
});
// 清空 elementEventMap
elementEventMap.clear();
// 清空 _handlers
Object.keys(_handlers).forEach(key => delete _handlers[key]);
// 移除window上的focus监听
if (winListendFocus) {
const {
listener,
capture
} = winListendFocus;
removeEvent(window, 'focus', listener, capture);
winListendFocus = null;
}
}
}
const _api = {
getPressedKeyString,
setScope,
getScope,
deleteScope,
getPressedKeyCodes,
getAllKeyCodes,
isPressed,
filter,
trigger,
unbind,
keyMap: _keyMap,
modifier: _modifier,
modifierMap
};
for (const a in _api) {
if (Object.prototype.hasOwnProperty.call(_api, a)) {
hotkeys[a] = _api[a];
}
}
if (typeof window !== 'undefined') {
const _hotkeys = window.hotkeys;
hotkeys.noConflict = deep => {
if (deep && window.hotkeys === hotkeys) {
window.hotkeys = _hotkeys;
}
return hotkeys;
};
window.hotkeys = hotkeys;
}
var SUPPORTED_THEMES = ["taskwarrior-dark", "taskwarrior-light"];
var THEME_ICONS = ["⚹", "☽", "🌣"];
var STORAGE_THEME_KEY = "TWK_THEME";
var DOM_THEME_KEY = "data-theme";
function getThemeStorage() {
var theme = localStorage.getItem(STORAGE_THEME_KEY);
return theme;
}
function getThemeDom() {
var theme = document.getElementsByTagName('html')[0].getAttribute(DOM_THEME_KEY);
return theme;
}
function getTheme() {
var themeStorage = getThemeStorage();
var themeDom = getThemeDom();
return themeDom === null ? themeStorage : themeDom;
}
function setTheme(theme) {
var _a;
if (theme === null) {
localStorage.removeItem(STORAGE_THEME_KEY);
document.getElementsByTagName('html')[0].removeAttribute(DOM_THEME_KEY);
}
else {
localStorage.setItem(STORAGE_THEME_KEY, theme);
document.getElementsByTagName('html')[0].setAttribute(DOM_THEME_KEY, theme);
}
var themeIndex = -1;
if (theme != null) {
themeIndex = SUPPORTED_THEMES.indexOf(theme);
}
var iconIndex = themeIndex + 1;
(_a = document.getElementById('theme-switcher')) === null || _a === void 0 ? void 0 : _a.innerText = THEME_ICONS.at(iconIndex);
return true;
}
function switchTheme() {
var currentTheme = getTheme();
var themeIndex = -1;
if (currentTheme != null) {
themeIndex = SUPPORTED_THEMES.indexOf(currentTheme);
}
themeIndex = themeIndex + 1;
if (themeIndex >= SUPPORTED_THEMES.length) {
themeIndex = -1;
}
if (themeIndex >= 0) {
setTheme(SUPPORTED_THEMES.at(themeIndex));
}
else {
setTheme(null);
}
}
function init() {
// Ensure, that the icon is set correctly.
var themeDom = getThemeDom();
setTheme(themeDom);
// Check if there is anything different.
// Local storage is overriding DOM on initial read.
var theme = getThemeStorage();
if (theme != null) {
setTheme(theme);
}
}
_hyperscript_minExports.browserInit();
var doing_something = function () {
console.log("Hello world");
};
hotkeys.filter = function (event) {
// @ts-ignore
var tagName = event.target.tagName;
hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');
return true;
};
function focusTextInput(event) {
var ss = document.getElementById('task-details-inp');
if (ss !== null) {
event.preventDefault();
ss.focus();
}
else {
document.getElementById('cmd-inp').focus();
}
}
hotkeys('esc', function (event, handler) {
// Prevent the default refresh event under WINDOWS system
if (event.target != document.getElementById('tag-inp')) {
console.log("not processing");
return;
}
event.preventDefault();
var tag_selector = document.getElementById('cmd-inp');
document.querySelector('#tags_map_drawer').classList.toggle('hidden');
if (tag_selector.checkVisibility()) {
tag_selector.focus();
}
return false;
});
hotkeys('t', function (event, handler) {
// Prevent the default refresh event under WINDOWS system
if (event.target != document.getElementById('cmd-inp')) {
console.log("not processing");
return;
}
event.preventDefault();
window['toggleTagPanel']();
});
hotkeys('ctrl+shift+K', function (event, handler) {
// Prevent the default refresh event under WINDOWS system
event.preventDefault();
focusTextInput(event);
return false;
});
window['toggleTagPanel'] = function () {
var tagSelector = document.getElementById('tag-inp');
document.querySelector('#tags_map_drawer').classList.toggle('hidden');
if (tagSelector.checkVisibility()) {
tagSelector.focus();
}
return false;
};
document.addEventListener('click', function (event) {
var element = document.getElementsByTagName('html')[0];
switch (event.target) {
case element:
focusTextInput(event);
break;
case document.getElementById('theme-switcher'):
event.preventDefault();
switchTheme();
break;
}
return;
});
document.addEventListener("DOMContentLoaded", function () {
init();
setInterval(function () {
var whichOne = 0;
var dd = document.getElementById('active-timer');
if (dd === undefined || dd === null) {
return;
}
var timeBox = dd.children[1].children[whichOne];
var s = timeBox.textContent.split(":");
var second = parseInt(s.pop());
var minute = parseInt(s.pop());
if (isNaN(minute)) {
minute = 0;
}
var hour = parseInt(s.pop());
if (isNaN(hour)) {
hour = 0;
}
second += 1;
if (second >= 60) {
second = 0;
minute += 1;
if (minute > 60) {
hour += 1;
}
}
timeBox.textContent = hour.toString()
// @ts-ignore
.padStart(2, "0") + ":" +
minute.toString()
// @ts-ignore
.padStart(2, "0") + ":" +
second.toString()
// @ts-ignore
.padStart(2, "0");
}, 1000);
setInterval(function () {
var dd = document.getElementById('time_of_the_day');
if (dd === undefined || dd === null) {
return;
}
// <progress id="time_of_the_day" class="fill-amber-200 bg-blue-900 w-full shadow-inner shadow-blue-950" max="100" value=""></progress>
var now = new Date();
var total_minutes_passed = now.getMinutes() + (now.getHours() * 60);
var total_minutes_in_day = 24 * 60;
var hours_left = 24 - now.getHours();
dd.style.width = total_minutes_passed * 100 / total_minutes_in_day + "%";
dd.children[0].children[0].innerHTML = hours_left + "h";
}, 1000);
});
export { doing_something };