htmx.org 1.9.3 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.5] - 2023-08-25
4
+
5
+ * Web sockets now properly pass the target id in the HEADERS struct
6
+ * A very rare loading state bug was fixed (see https://github.com/bigskysoftware/htmx/commit/93bd81b6d003bb7bc445f10192bdb8089fa3495d)
7
+ * `hx-on` will not evaluate if `allowEval` is set to false
8
+ * You can disable the interpretation of script tags with the new `htmx.config.allowScriptTags` config variable
9
+ * You can now disable htmx-based requests to non-origin hosts via the `htmx.config.selfRequestsOnly` config variable
10
+ * The [Security](https://htmx.org/docs#security) section has been expanded to help developers better understand how to
11
+ properly secure their htmx-based applications.
12
+
13
+ ## [1.9.4] - 2023-07-25
14
+
15
+ * This is a bug-fix release for the most part, w/a heavy dose of @telroshan
16
+ * The `HX-Trigger` response header now supports comma separated event names
17
+ * Submit buttons that use the `form` attribute now work correctly
18
+ * The `changed` modifier now uses the triggering element, rather than the element the `hx-trigger` is defined on
19
+ * `hx-disable` is now handled dynamically so it can be added and removed
20
+ * IE11 compatibility restored! (maybe, hard to test)
21
+ * Fixed bug with `hx-on` event handler cleanup
22
+ * Many smaller bug fixes, typo fixes and general improvements
23
+
3
24
  ## [1.9.3] - 2023-07-14
4
25
 
5
26
  * The `hx-on` attribute has been deprecated (sorry) in favor of `hx-on-<event name>` attributes. See [`hx-on`](/attributes/hx-on) for more information.
@@ -9,7 +30,7 @@
9
30
  behavior for now, but allowing people to fix it for their use cases by updating the `htmx.config.methodsThatUseUrlParams` config
10
31
  option. Thank you to Alex and Vincent for their feedback and work on this issue!
11
32
  * The `this` symbol is now available in event filter expressions, and refers to the element the `hx-trigger` is on
12
- * Fix bug where the `htmx:afterSettle` event was raised multiple times with oob swaps occured
33
+ * Fix bug where the `htmx:afterSettle` event was raised multiple times with oob swaps occurred
13
34
  * A large number of accessibility fixes were made in the docs (Thank you Denis & crew!)
14
35
  * Fixed bug w/ WebSocket extension initialization caused by "naked" `hx-trigger` feature
15
36
  * The `HX-Reselect` HTTP response header has been added to change the selection from the returned content
@@ -130,7 +151,7 @@
130
151
  to both of them without compromising the core file size of htmx. You are encouraged to move over to the new
131
152
  extensions, but `hx-sse` and `hx-ws` will continue to work indefinitely in htmx 1.x.
132
153
  * You can now mask out [attribute inheritance](/docs#inheritance) via the [`hx-disinherit`](https://htmx.org/attributes/hx-disinherit) attribute.
133
- * The `HX-Push` header can now have the `false` value, which will prevent a history snapshot from occuring.
154
+ * The `HX-Push` header can now have the `false` value, which will prevent a history snapshot from occurring.
134
155
  * Many new extensions, with a big thanks to all the contributors!
135
156
  * A new [`alpine-morph`](/extensions/alpine-morph) allows you to use Alpine's swapping engine, which preserves Alpine
136
157
  * A [restored](/extensions/restored) extension was added that will trigger a `restore` event on all elements in the DOM
package/README.md CHANGED
@@ -10,14 +10,14 @@
10
10
  ## introduction
11
11
 
12
12
  htmx allows you to access [AJAX](https://htmx.org/docs#ajax), [CSS Transitions](https://htmx.org/docs#css_transitions),
13
- [WebSockets](https://htmx.org/docs#websockets) and [Server Sent Events](https://htmx.org/docs#sse)
14
- directly in HTML, using [attributes](https://htmx.org/reference#attributes), so you can build
15
- [modern user interfaces](https://htmx.org/examples) with the [simplicity](https://en.wikipedia.org/wiki/HATEOAS) and
13
+ [WebSockets](https://htmx.org/docs#websockets) and [Server Sent Events](https://htmx.org/docs#sse)
14
+ directly in HTML, using [attributes](https://htmx.org/reference#attributes), so you can build
15
+ [modern user interfaces](https://htmx.org/examples) with the [simplicity](https://en.wikipedia.org/wiki/HATEOAS) and
16
16
  [power](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) of hypertext
17
17
 
18
- htmx is small ([~14k min.gz'd](https://unpkg.com/htmx.org/dist/)),
18
+ htmx is small ([~14k min.gz'd](https://unpkg.com/htmx.org/dist/)),
19
19
  [dependency-free](https://github.com/bigskysoftware/htmx/blob/master/package.json),
20
- [extendable](https://htmx.org/extensions) &
20
+ [extendable](https://htmx.org/extensions) &
21
21
  IE11 compatible
22
22
 
23
23
  ## motivation
@@ -27,13 +27,13 @@ IE11 compatible
27
27
  * Why should only GET & POST be available?
28
28
  * Why should you only be able to replace the *entire* screen?
29
29
 
30
- By removing these arbitrary constraints htmx completes HTML as a
30
+ By removing these arbitrary constraints htmx completes HTML as a
31
31
  [hypertext](https://en.wikipedia.org/wiki/Hypertext)
32
32
 
33
33
  ## quick start
34
34
 
35
35
  ```html
36
- <script src="https://unpkg.com/htmx.org@1.9.3"></script>
36
+ <script src="https://unpkg.com/htmx.org@1.9.5"></script>
37
37
  <!-- have a button POST a click via AJAX -->
38
38
  <button hx-post="/clicked" hx-swap="outerHTML">
39
39
  Click Me
@@ -63,11 +63,13 @@ Note there is an old broken package called `htmx`. This is `htmx.org`.
63
63
 
64
64
  ## contributing
65
65
 
66
- * please write code, including tests, in ES5 for [IE 11 compatibility](https://stackoverflow.com/questions/39902809/support-for-es6-in-internet-explorer-11)
67
- * please include test cases in [`/test`](https://github.com/bigskysoftware/htmx/tree/dev/test) and docs in [`/www`](https://github.com/bigskysoftware/htmx/tree/dev/www)
68
- * if you are adding a feature, consider doing it as an [extension](https://htmx.org/extensions) instead to
69
- keep the core htmx code tidy
70
- * development pull requests should be against the `dev` branch, docs fixes can be made directly against `master`
66
+ * All PRs should be made against the `dev` branch, except documentation PRs (`www/` directory) which can be made against `master`
67
+ * Please write code, including tests, in ES5 for [IE 11 compatibility](https://stackoverflow.com/questions/39902809/support-for-es6-in-internet-explorer-11)
68
+ * Please include test cases in [`/test`](https://github.com/bigskysoftware/htmx/tree/dev/test) and docs in [`/www`](https://github.com/bigskysoftware/htmx/tree/dev/www)
69
+ * Search the issues before proposing a feature to see if it is already under discussion
70
+ * If you are adding a feature, consider doing it as an [extension](https://htmx.org/extensions) instead to keep the core htmx code tidy
71
+ * Want to contribute but don't know where to start? Look for issues with the "help wanted" tag
72
+ * Refactors that do not make functional changes will be automatically closed, unless explicitly solicited (documentation typo fixes are fine)
71
73
  * No time? Then [become a sponsor](https://github.com/sponsors/bigskysoftware#sponsors)
72
74
 
73
75
  ### hacking guide
@@ -103,7 +105,7 @@ At this point you can modify `/src/htmx.js` to add features, and then add tests
103
105
  * `/test/ext` - extension tests
104
106
  * `/test/manual` - manual tests that cannot be automated
105
107
 
106
- htmx uses the [mocha](https://mochajs.org/) testing framework, the [chai](https://www.chaijs.com/) assertion framework
108
+ htmx uses the [mocha](https://mochajs.org/) testing framework, the [chai](https://www.chaijs.com/) assertion framework
107
109
  and [sinon](https://sinonjs.org/releases/v9/fake-xhr-and-server/) to mock out AJAX requests. They are all OK.
108
110
 
109
111
  ## haiku
@@ -96,7 +96,7 @@ htmx.defineExtension("preload", {
96
96
  // Apply the listener to the node
97
97
  node.addEventListener(on, function(evt) {
98
98
  if (node.preloadState === "PAUSE") { // Only add one event listener
99
- node.preloadState = "READY"; // Requred for the `load` function to trigger
99
+ node.preloadState = "READY"; // Required for the `load` function to trigger
100
100
 
101
101
  // Special handling for "mouseover" events. Wait 100ms before triggering load.
102
102
  if (on === "mouseover") {
@@ -3,43 +3,55 @@
3
3
  /** @type {import("../htmx").HtmxInternalApi} */
4
4
  var api;
5
5
 
6
- const targetAttrPrefix = 'hx-target-';
7
- const targetAttrMinLen = targetAttrPrefix.length - 1;
6
+ var attrPrefix = 'hx-target-';
8
7
 
9
8
  /**
10
9
  * @param {HTMLElement} elt
11
10
  * @param {number} respCode
12
11
  * @returns {HTMLElement | null}
13
12
  */
14
- function getRespCodeTarget(elt, respCode) {
15
- if (!elt || !respCode) return null;
13
+ function getRespCodeTarget(elt, respCodeNumber) {
14
+ if (!elt || !respCodeNumber) return null;
16
15
 
17
- var targetAttr = targetAttrPrefix + respCode;
18
- var targetStr = api.getClosestAttributeValue(elt, targetAttr);
16
+ var respCode = respCodeNumber.toString();
19
17
 
20
- if (targetStr) {
21
- if (targetStr === "this") {
22
- return api.findThisElement(elt, targetAttr);
23
- } else {
24
- return api.querySelectorExt(elt, targetStr);
25
- }
26
- } else {
27
- for (let l = targetAttr.length - 1; l > targetAttrMinLen; l--) {
28
- targetAttr = targetAttr.substring(0, l) + '*';
29
- targetStr = api.getClosestAttributeValue(elt, targetAttr);
30
- if (targetStr) break;
31
- }
32
- }
18
+ // '*' is the original syntax, as the obvious character for a wildcard.
19
+ // The 'x' alternative was added for maximum compatibility with HTML
20
+ // templating engines, due to ambiguity around which characters are
21
+ // supported in HTML attributes.
22
+ //
23
+ // Start with the most specific possible attribute and generalize from
24
+ // there.
25
+ var attrPossibilities = [
26
+ respCode,
27
+
28
+ respCode.substr(0, 2) + '*',
29
+ respCode.substr(0, 2) + 'x',
33
30
 
34
- if (targetStr) {
35
- if (targetStr === "this") {
36
- return api.findThisElement(elt, targetAttr);
37
- } else {
38
- return api.querySelectorExt(elt, targetStr);
31
+ respCode.substr(0, 1) + '*',
32
+ respCode.substr(0, 1) + 'x',
33
+ respCode.substr(0, 1) + '**',
34
+ respCode.substr(0, 1) + 'xx',
35
+
36
+ '*',
37
+ 'x',
38
+ '***',
39
+ 'xxx',
40
+ ];
41
+
42
+ for (var i = 0; i < attrPossibilities.length; i++) {
43
+ var attr = attrPrefix + attrPossibilities[i];
44
+ var attrValue = api.getClosestAttributeValue(elt, attr);
45
+ if (attrValue) {
46
+ if (attrValue === "this") {
47
+ return api.findThisElement(elt, attr);
48
+ } else {
49
+ return api.querySelectorExt(elt, attrValue);
50
+ }
39
51
  }
40
- } else {
41
- return null;
42
52
  }
53
+
54
+ return null;
43
55
  }
44
56
 
45
57
  /** @param {Event} evt */
@@ -83,7 +95,7 @@
83
95
  evt.detail.xhr.status !== 200) {
84
96
  if (evt.detail.target) {
85
97
  if (htmx.config.responseTargetPrefersExisting) {
86
- evt.detail.shoudSwap = true;
98
+ evt.detail.shouldSwap = true;
87
99
  handleErrorFlag(evt);
88
100
  return true;
89
101
  }
package/dist/ext/ws.js CHANGED
@@ -341,7 +341,7 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
341
341
 
342
342
  /** @type {WebSocketWrapper} */
343
343
  var socketWrapper = api.getInternalData(socketElt).webSocket;
344
- var headers = api.getHeaders(sendElt, socketElt);
344
+ var headers = api.getHeaders(sendElt, api.getTarget(sendElt));
345
345
  var results = api.getInputValues(sendElt, 'post');
346
346
  var errors = results.errors;
347
347
  var rawParameters = results.values;
package/dist/htmx.js CHANGED
@@ -60,6 +60,7 @@ return (function () {
60
60
  settlingClass:'htmx-settling',
61
61
  swappingClass:'htmx-swapping',
62
62
  allowEval:true,
63
+ allowScriptTags:true,
63
64
  inlineScriptNonce:'',
64
65
  attributesToSettle:["class", "style", "width", "height"],
65
66
  withCredentials:false,
@@ -73,6 +74,7 @@ return (function () {
73
74
  getCacheBusterParam: false,
74
75
  globalViewTransitions: false,
75
76
  methodsThatUseUrlParams: ["get"],
77
+ selfRequestsOnly: false
76
78
  },
77
79
  parseInterval:parseInterval,
78
80
  _:internalEval,
@@ -84,7 +86,7 @@ return (function () {
84
86
  sock.binaryType = htmx.config.wsBinaryType;
85
87
  return sock;
86
88
  },
87
- version: "1.9.3"
89
+ version: "1.9.5"
88
90
  };
89
91
 
90
92
  /** @type {import("./htmx").HtmxInternalApi} */
@@ -227,7 +229,7 @@ return (function () {
227
229
  * @returns {boolean}
228
230
  */
229
231
  function matches(elt, selector) {
230
- // @ts-ignore: non-standard properties for browser compatability
232
+ // @ts-ignore: non-standard properties for browser compatibility
231
233
  // noinspection JSUnresolvedVariable
232
234
  var matchesFunction = elt.matches || elt.matchesSelector || elt.msMatchesSelector || elt.mozMatchesSelector || elt.webkitMatchesSelector || elt.oMatchesSelector;
233
235
  return matchesFunction && matchesFunction.call(elt, selector);
@@ -285,7 +287,7 @@ return (function () {
285
287
  if (htmx.config.useTemplateFragments && partialResponse) {
286
288
  var documentFragment = parseHTML("<body><template>" + resp + "</template></body>", 0);
287
289
  // @ts-ignore type mismatch between DocumentFragment and Element.
288
- // TODO: Are these close enough for htmx to use interchangably?
290
+ // TODO: Are these close enough for htmx to use interchangeably?
289
291
  return documentFragment.querySelector('template').content;
290
292
  } else {
291
293
  var startTag = getStartTag(resp);
@@ -391,7 +393,7 @@ return (function () {
391
393
 
392
394
  function bodyContains(elt) {
393
395
  // IE Fix
394
- if (elt.getRootNode && elt.getRootNode() instanceof ShadowRoot) {
396
+ if (elt.getRootNode && elt.getRootNode() instanceof window.ShadowRoot) {
395
397
  return getDocument().body.contains(elt.getRootNode().host);
396
398
  } else {
397
399
  return getDocument().body.contains(elt);
@@ -593,6 +595,8 @@ return (function () {
593
595
  return [document];
594
596
  } else if (selector === 'window') {
595
597
  return [window];
598
+ } else if (selector === 'body') {
599
+ return [document.body];
596
600
  } else {
597
601
  return getDocument().querySelectorAll(normalizeSelector(selector));
598
602
  }
@@ -760,7 +764,7 @@ return (function () {
760
764
  * @returns
761
765
  */
762
766
  function oobSwap(oobValue, oobElement, settleInfo) {
763
- var selector = "#" + oobElement.id;
767
+ var selector = "#" + getRawAttribute(oobElement, "id");
764
768
  var swapStyle = "outerHTML";
765
769
  if (oobValue === "true") {
766
770
  // do nothing
@@ -841,8 +845,9 @@ return (function () {
841
845
 
842
846
  function handleAttributes(parentNode, fragment, settleInfo) {
843
847
  forEach(fragment.querySelectorAll("[id]"), function (newNode) {
844
- if (newNode.id && newNode.id.length > 0) {
845
- var normalizedId = newNode.id.replace("'", "\\'");
848
+ var id = getRawAttribute(newNode, "id")
849
+ if (id && id.length > 0) {
850
+ var normalizedId = id.replace("'", "\\'");
846
851
  var normalizedTag = newNode.tagName.replace(':', '\\:');
847
852
  var oldNode = parentNode.querySelector(normalizedTag + "[id='" + normalizedId + "']");
848
853
  if (oldNode && oldNode !== parentNode) {
@@ -916,7 +921,7 @@ return (function () {
916
921
  if (internalData.onHandlers) {
917
922
  for (let i = 0; i < internalData.onHandlers.length; i++) {
918
923
  const handlerInfo = internalData.onHandlers[i];
919
- elt.removeEventListener(handlerInfo.name, handlerInfo.handler);
924
+ elt.removeEventListener(handlerInfo.event, handlerInfo.listener);
920
925
  }
921
926
  delete internalData.onHandlers
922
927
  }
@@ -940,6 +945,9 @@ return (function () {
940
945
  }
941
946
  });
942
947
  }
948
+ if (internalData.initHash) {
949
+ internalData.initHash = null
950
+ }
943
951
  deInitOnHandlers(element);
944
952
  }
945
953
 
@@ -965,7 +973,7 @@ return (function () {
965
973
  newElt = eltBeforeNewContent.nextSibling;
966
974
  }
967
975
  getInternalData(target).replacedWith = newElt; // tuck away so we can fire events on it later
968
- settleInfo.elts = settleInfo.elts.filter(e => e != target);
976
+ settleInfo.elts = settleInfo.elts.filter(function(e) { return e != target });
969
977
  while(newElt && newElt !== target) {
970
978
  if (newElt.nodeType === Node.ELEMENT_NODE) {
971
979
  settleInfo.elts.push(newElt);
@@ -1110,7 +1118,10 @@ return (function () {
1110
1118
  }
1111
1119
  }
1112
1120
  } else {
1113
- triggerEvent(elt, triggerBody, []);
1121
+ var eventNames = triggerBody.split(",")
1122
+ for (var i = 0; i < eventNames.length; i++) {
1123
+ triggerEvent(elt, eventNames[i].trim(), []);
1124
+ }
1114
1125
  }
1115
1126
  }
1116
1127
 
@@ -1297,7 +1308,7 @@ return (function () {
1297
1308
  return triggerSpecs;
1298
1309
  } else if (matches(elt, 'form')) {
1299
1310
  return [{trigger: 'submit'}];
1300
- } else if (matches(elt, 'input[type="button"]')){
1311
+ } else if (matches(elt, 'input[type="button"], input[type="submit"]')){
1301
1312
  return [{trigger: 'click'}];
1302
1313
  } else if (matches(elt, INPUT_SELECTOR)) {
1303
1314
  return [{trigger: 'change'}];
@@ -1347,6 +1358,10 @@ return (function () {
1347
1358
  }
1348
1359
  triggerSpecs.forEach(function(triggerSpec) {
1349
1360
  addEventListener(elt, function(elt, evt) {
1361
+ if (closest(elt, htmx.config.disableSelector)) {
1362
+ cleanUpElement(elt)
1363
+ return
1364
+ }
1350
1365
  issueAjaxRequest(verb, path, elt, evt)
1351
1366
  }, nodeData, triggerSpec, true);
1352
1367
  });
@@ -1400,9 +1415,12 @@ return (function () {
1400
1415
  } else {
1401
1416
  eltsToListenOn = [elt];
1402
1417
  }
1403
- // store the initial value of the element so we can tell if it changes
1418
+ // store the initial values of the elements, so we can tell if they change
1404
1419
  if (triggerSpec.changed) {
1405
- elementData.lastValue = elt.value;
1420
+ eltsToListenOn.forEach(function (eltToListenOn) {
1421
+ var eltToListenOnData = getInternalData(eltToListenOn);
1422
+ eltToListenOnData.lastValue = eltToListenOn.value;
1423
+ })
1406
1424
  }
1407
1425
  forEach(eltsToListenOn, function (eltToListenOn) {
1408
1426
  var eventListener = function (evt) {
@@ -1442,11 +1460,11 @@ return (function () {
1442
1460
  }
1443
1461
  }
1444
1462
  if (triggerSpec.changed) {
1445
- if (elementData.lastValue === elt.value) {
1463
+ var eltToListenOnData = getInternalData(eltToListenOn)
1464
+ if (eltToListenOnData.lastValue === eltToListenOn.value) {
1446
1465
  return;
1447
- } else {
1448
- elementData.lastValue = elt.value;
1449
1466
  }
1467
+ eltToListenOnData.lastValue = eltToListenOn.value
1450
1468
  }
1451
1469
  if (elementData.delayed) {
1452
1470
  clearTimeout(elementData.delayed);
@@ -1756,6 +1774,10 @@ return (function () {
1756
1774
  nodeData.verb = verb;
1757
1775
  triggerSpecs.forEach(function(triggerSpec) {
1758
1776
  addTriggerHandler(elt, triggerSpec, nodeData, function (elt, evt) {
1777
+ if (closest(elt, htmx.config.disableSelector)) {
1778
+ cleanUpElement(elt)
1779
+ return
1780
+ }
1759
1781
  issueAjaxRequest(verb, path, elt, evt)
1760
1782
  })
1761
1783
  });
@@ -1803,7 +1825,7 @@ return (function () {
1803
1825
  }
1804
1826
 
1805
1827
  function evalScript(script) {
1806
- if (script.type === "text/javascript" || script.type === "module" || script.type === "") {
1828
+ if (htmx.config.allowScriptTags && (script.type === "text/javascript" || script.type === "module" || script.type === "") ) {
1807
1829
  var newScript = getDocument().createElement("script");
1808
1830
  forEach(script.attributes, function (attr) {
1809
1831
  newScript.setAttribute(attr.name, attr.value);
@@ -1853,8 +1875,8 @@ return (function () {
1853
1875
 
1854
1876
  function findElementsToProcess(elt) {
1855
1877
  if (elt.querySelectorAll) {
1856
- var boostedElts = hasChanceOfBeingBoosted() ? ", a, form" : "";
1857
- var results = elt.querySelectorAll(VERB_SELECTOR + boostedElts + ", [hx-sse], [data-hx-sse], [hx-ws]," +
1878
+ var boostedElts = hasChanceOfBeingBoosted() ? ", a" : "";
1879
+ var results = elt.querySelectorAll(VERB_SELECTOR + boostedElts + ", form, [type='submit'], [hx-sse], [data-hx-sse], [hx-ws]," +
1858
1880
  " [data-hx-ws], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger], [hx-on], [data-hx-on]");
1859
1881
  return results;
1860
1882
  } else {
@@ -1862,8 +1884,15 @@ return (function () {
1862
1884
  }
1863
1885
  }
1864
1886
 
1865
- function initButtonTracking(form){
1866
- var maybeSetLastButtonClicked = function(evt){
1887
+ function initButtonTracking(elt) {
1888
+ // Handle submit buttons/inputs that have the form attribute set
1889
+ // see https://developer.mozilla.org/docs/Web/HTML/Element/button
1890
+ var form = resolveTarget("#" + getRawAttribute(elt, "form")) || closest(elt, "form")
1891
+ if (!form) {
1892
+ return
1893
+ }
1894
+
1895
+ var maybeSetLastButtonClicked = function (evt) {
1867
1896
  var elt = closest(evt.target, "button, input[type='submit']");
1868
1897
  if (elt !== null) {
1869
1898
  var internalData = getInternalData(form);
@@ -1875,9 +1904,9 @@ return (function () {
1875
1904
  // focusin - in case someone tabs in to a button and hits the space bar
1876
1905
  // click - on OSX buttons do not focus on click see https://bugs.webkit.org/show_bug.cgi?id=13724
1877
1906
 
1878
- form.addEventListener('click', maybeSetLastButtonClicked)
1879
- form.addEventListener('focusin', maybeSetLastButtonClicked)
1880
- form.addEventListener('focusout', function(evt){
1907
+ elt.addEventListener('click', maybeSetLastButtonClicked)
1908
+ elt.addEventListener('focusin', maybeSetLastButtonClicked)
1909
+ elt.addEventListener('focusout', function(evt){
1881
1910
  var internalData = getInternalData(form);
1882
1911
  internalData.lastButtonClicked = null;
1883
1912
  })
@@ -1900,17 +1929,22 @@ return (function () {
1900
1929
  function addHxOnEventHandler(elt, eventName, code) {
1901
1930
  var nodeData = getInternalData(elt);
1902
1931
  nodeData.onHandlers = [];
1903
- var func = new Function("event", code + "; return;");
1904
- var listener = elt.addEventListener(eventName, function (e) {
1905
- return func.call(elt, e);
1906
- });
1932
+ var func;
1933
+ var listener = function (e) {
1934
+ return maybeEval(elt, function() {
1935
+ if (!func) {
1936
+ func = new Function("event", code);
1937
+ }
1938
+ func.call(elt, e);
1939
+ });
1940
+ };
1941
+ elt.addEventListener(eventName, listener);
1907
1942
  nodeData.onHandlers.push({event:eventName, listener:listener});
1908
- return {nodeData, code, func, listener};
1909
1943
  }
1910
1944
 
1911
1945
  function processHxOn(elt) {
1912
1946
  var hxOnValue = getAttributeValue(elt, 'hx-on');
1913
- if (hxOnValue && htmx.config.allowEval) {
1947
+ if (hxOnValue) {
1914
1948
  var handlers = {}
1915
1949
  var lines = hxOnValue.split("\n");
1916
1950
  var currentEvent = null;
@@ -1938,8 +1972,9 @@ return (function () {
1938
1972
  // wipe any previous on handlers so that this function takes precedence
1939
1973
  deInitOnHandlers(elt)
1940
1974
 
1941
- for (const attr of elt.attributes) {
1942
- const { name, value } = attr
1975
+ for (var i = 0; i < elt.attributes.length; i++) {
1976
+ var name = elt.attributes[i].name
1977
+ var value = elt.attributes[i].value
1943
1978
  if (name.startsWith("hx-on:") || name.startsWith("data-hx-on:")) {
1944
1979
  let eventName = name.slice(name.indexOf(":") + 1)
1945
1980
  // if the eventName starts with a colon, prepend "htmx" for shorthand support
@@ -1951,17 +1986,17 @@ return (function () {
1951
1986
  }
1952
1987
 
1953
1988
  function initNode(elt) {
1954
- if (elt.closest && elt.closest(htmx.config.disableSelector)) {
1989
+ if (closest(elt, htmx.config.disableSelector)) {
1990
+ cleanUpElement(elt)
1955
1991
  return;
1956
1992
  }
1957
1993
  var nodeData = getInternalData(elt);
1958
1994
  if (nodeData.initHash !== attributeHash(elt)) {
1959
-
1960
- nodeData.initHash = attributeHash(elt);
1961
-
1962
1995
  // clean up any previously processed info
1963
1996
  deInitNode(elt);
1964
1997
 
1998
+ nodeData.initHash = attributeHash(elt);
1999
+
1965
2000
  processHxOn(elt);
1966
2001
 
1967
2002
  triggerEvent(elt, "htmx:beforeProcessNode")
@@ -1985,8 +2020,10 @@ return (function () {
1985
2020
  }
1986
2021
  }
1987
2022
 
1988
- if (elt.tagName === "FORM") {
1989
- initButtonTracking(elt);
2023
+ // Handle submit buttons/inputs that have the form attribute set
2024
+ // see https://developer.mozilla.org/docs/Web/HTML/Element/button
2025
+ if (elt.tagName === "FORM" || (getRawAttribute(elt, "type") === "submit" && hasAttribute(elt, "form"))) {
2026
+ initButtonTracking(elt)
1990
2027
  }
1991
2028
 
1992
2029
  var sseInfo = getAttributeValue(elt, 'hx-sse');
@@ -2004,6 +2041,10 @@ return (function () {
2004
2041
 
2005
2042
  function processNode(elt) {
2006
2043
  elt = resolveTarget(elt);
2044
+ if (closest(elt, htmx.config.disableSelector)) {
2045
+ cleanUpElement(elt)
2046
+ return;
2047
+ }
2007
2048
  initNode(elt);
2008
2049
  forEach(findElementsToProcess(elt), function(child) { initNode(child) });
2009
2050
  // Because it happens second, the new way of adding onHandlers superseeds the old one
@@ -2313,6 +2354,29 @@ return (function () {
2313
2354
  return true;
2314
2355
  }
2315
2356
 
2357
+ function addValueToValues(name, value, values) {
2358
+ // This is a little ugly because both the current value of the named value in the form
2359
+ // and the new value could be arrays, so we have to handle all four cases :/
2360
+ if (name != null && value != null) {
2361
+ var current = values[name];
2362
+ if (current === undefined) {
2363
+ values[name] = value;
2364
+ } else if (Array.isArray(current)) {
2365
+ if (Array.isArray(value)) {
2366
+ values[name] = current.concat(value);
2367
+ } else {
2368
+ current.push(value);
2369
+ }
2370
+ } else {
2371
+ if (Array.isArray(value)) {
2372
+ values[name] = [current].concat(value);
2373
+ } else {
2374
+ values[name] = [current, value];
2375
+ }
2376
+ }
2377
+ }
2378
+ }
2379
+
2316
2380
  function processInputValue(processed, values, errors, elt, validate) {
2317
2381
  if (elt == null || haveSeenNode(processed, elt)) {
2318
2382
  return;
@@ -2329,28 +2393,7 @@ return (function () {
2329
2393
  if (elt.files) {
2330
2394
  value = toArray(elt.files);
2331
2395
  }
2332
- // This is a little ugly because both the current value of the named value in the form
2333
- // and the new value could be arrays, so we have to handle all four cases :/
2334
- if (name != null && value != null) {
2335
- var current = values[name];
2336
- if (current !== undefined) {
2337
- if (Array.isArray(current)) {
2338
- if (Array.isArray(value)) {
2339
- values[name] = current.concat(value);
2340
- } else {
2341
- current.push(value);
2342
- }
2343
- } else {
2344
- if (Array.isArray(value)) {
2345
- values[name] = [current].concat(value);
2346
- } else {
2347
- values[name] = [current, value];
2348
- }
2349
- }
2350
- } else {
2351
- values[name] = value;
2352
- }
2353
- }
2396
+ addValueToValues(name, value, values);
2354
2397
  if (validate) {
2355
2398
  validateElement(elt, errors);
2356
2399
  }
@@ -2400,11 +2443,11 @@ return (function () {
2400
2443
  processInputValue(processed, values, errors, elt, validate);
2401
2444
 
2402
2445
  // if a button or submit was clicked last, include its value
2403
- if (internalData.lastButtonClicked) {
2404
- var name = getRawAttribute(internalData.lastButtonClicked,"name");
2405
- if (name) {
2406
- values[name] = internalData.lastButtonClicked.value;
2407
- }
2446
+ if (internalData.lastButtonClicked || elt.tagName === "BUTTON" ||
2447
+ (elt.tagName === "INPUT" && getRawAttribute(elt, "type") === "submit")) {
2448
+ var button = internalData.lastButtonClicked || elt
2449
+ var name = getRawAttribute(button, "name")
2450
+ addValueToValues(name, button.value, formValues)
2408
2451
  }
2409
2452
 
2410
2453
  // include any explicit includes
@@ -2809,6 +2852,18 @@ return (function () {
2809
2852
  return arr;
2810
2853
  }
2811
2854
 
2855
+ function verifyPath(elt, path, requestConfig) {
2856
+ var url = new URL(path, document.location.href);
2857
+ var origin = document.location.origin;
2858
+ var sameHost = origin === url.origin;
2859
+ if (htmx.config.selfRequestsOnly) {
2860
+ if (!sameHost) {
2861
+ return false;
2862
+ }
2863
+ }
2864
+ return triggerEvent(elt, "htmx:validateUrl", mergeObjects({url: url, sameHost: sameHost}, requestConfig));
2865
+ }
2866
+
2812
2867
  function issueAjaxRequest(verb, path, elt, event, etc, confirmed) {
2813
2868
  var resolve = null;
2814
2869
  var reject = null;
@@ -3037,6 +3092,11 @@ return (function () {
3037
3092
  }
3038
3093
  }
3039
3094
 
3095
+ if (!verifyPath(elt, finalPath, requestConfig)) {
3096
+ triggerErrorEvent(elt, 'htmx:invalidPath', requestConfig)
3097
+ return;
3098
+ };
3099
+
3040
3100
  xhr.open(verb.toUpperCase(), finalPath, true);
3041
3101
  xhr.overrideMimeType("text/html");
3042
3102
  xhr.withCredentials = requestConfig.withCredentials;
@@ -3335,8 +3395,8 @@ return (function () {
3335
3395
 
3336
3396
  if (selectionInfo.elt &&
3337
3397
  !bodyContains(selectionInfo.elt) &&
3338
- selectionInfo.elt.id) {
3339
- var newActiveElt = document.getElementById(selectionInfo.elt.id);
3398
+ getRawAttribute(selectionInfo.elt, "id")) {
3399
+ var newActiveElt = document.getElementById(getRawAttribute(selectionInfo.elt, "id"));
3340
3400
  var focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !htmx.config.defaultFocusScroll };
3341
3401
  if (newActiveElt) {
3342
3402
  // @ts-ignore
@@ -3547,9 +3607,22 @@ return (function () {
3547
3607
  //====================================================================
3548
3608
  // Initialization
3549
3609
  //====================================================================
3610
+ var isReady = false
3611
+ getDocument().addEventListener('DOMContentLoaded', function() {
3612
+ isReady = true
3613
+ })
3550
3614
 
3615
+ /**
3616
+ * Execute a function now if DOMContentLoaded has fired, otherwise listen for it.
3617
+ *
3618
+ * This function uses isReady because there is no realiable way to ask the browswer whether
3619
+ * the DOMContentLoaded event has already been fired; there's a gap between DOMContentLoaded
3620
+ * firing and readystate=complete.
3621
+ */
3551
3622
  function ready(fn) {
3552
- if (getDocument().readyState !== 'loading') {
3623
+ // Checking readyState here is a failsafe in case the htmx script tag entered the DOM by
3624
+ // some means other than the initial page load.
3625
+ if (isReady || getDocument().readyState === 'complete') {
3553
3626
  fn();
3554
3627
  } else {
3555
3628
  getDocument().addEventListener('DOMContentLoaded', fn);
package/dist/htmx.min.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var G={onLoad:t,process:Nt,on:ue,off:fe,trigger:oe,ajax:mr,find:b,findAll:f,closest:d,values:function(e,t){var r=Qt(e,t||"post");return r.values},remove:B,addClass:V,removeClass:n,toggleClass:j,takeClass:W,defineExtension:Er,removeExtension:Cr,logAll:F,logNone:U,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,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get"]},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=G.config.wsBinaryType;return t},version:"1.9.3"};var C={addTriggerHandler:bt,bodyContains:re,canAccessLocalStorage:D,findThisElement:de,filterValues:ir,hasAttribute:q,getAttributeValue:Z,getClosestAttributeValue:Y,getClosestMatch:c,getExpressionVars:vr,getHeaders:nr,getInputValues:Qt,getInternalData:ee,getSwapSpecification:or,getTriggerSpecs:Ge,getTarget:ve,makeFragment:l,mergeObjects:ne,makeSettleInfo:S,oobSwap:xe,querySelectorExt:ie,selectAndSwap:Xe,settleImmediately:Wt,shouldCancel:Qe,triggerEvent:oe,triggerErrorEvent:ae,withExtensions:w};var R=["get","post","put","delete","patch"];var O=R.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function J(e,t){return e.getAttribute&&e.getAttribute(t)}function q(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function Z(e,t){return J(e,t)||J(e,"data-"+t)}function u(e){return e.parentElement}function K(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function T(e,t,r){var n=Z(t,r);var i=Z(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function Y(t,r){var n=null;c(t,function(e){return n=T(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function H(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function i(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=K().createDocumentFragment()}return i}function L(e){return e.match(/<body/)}function l(e){var t=!L(e);if(G.config.useTemplateFragments&&t){var r=i("<body><template>"+e+"</template></body>",0);return r.querySelector("template").content}else{var n=H(e);switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i("<table>"+e+"</table>",1);case"col":return i("<table><colgroup>"+e+"</colgroup></table>",2);case"tr":return i("<table><tbody>"+e+"</tbody></table>",2);case"td":case"th":return i("<table><tbody><tr>"+e+"</tr></tbody></table>",3);case"script":return i("<div>"+e+"</div>",1);default:return i(e,0)}}}function Q(e){if(e){e()}}function A(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function N(e){return A(e,"Function")}function I(e){return A(e,"Object")}function ee(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function k(e){var t=[];if(e){for(var r=0;r<e.length;r++){t.push(e[r])}}return t}function te(e,t){if(e){for(var r=0;r<e.length;r++){t(e[r])}}}function P(e){var t=e.getBoundingClientRect();var r=t.top;var n=t.bottom;return r<window.innerHeight&&n>=0}function re(e){if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){return K().body.contains(e.getRootNode().host)}else{return K().body.contains(e)}}function M(e){return e.trim().split(/\s+/)}function ne(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function y(e){try{return JSON.parse(e)}catch(e){x(e);return null}}function D(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function X(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!t.match("^/$")){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return cr(K().body,function(){return eval(e)})}function t(t){var e=G.on("htmx:load",function(e){t(e.detail.elt)});return e}function F(){G.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function U(){G.logger=null}function b(e,t){if(t){return e.querySelector(t)}else{return b(K(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(K(),e)}}function B(e,t){e=s(e);if(t){setTimeout(function(){B(e);e=null},t)}else{e.parentElement.removeChild(e)}}function V(e,t,r){e=s(e);if(r){setTimeout(function(){V(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=s(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function j(e,t){e=s(e);e.classList.toggle(t)}function W(e,t){e=s(e);te(e.parentElement.children,function(e){n(e,t)});V(e,t)}function d(e,t){e=s(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function r(e){var t=e.trim();if(t.startsWith("<")&&t.endsWith("/>")){return t.substring(1,t.length-2)}else{return t}}function _(e,t){if(t.indexOf("closest ")===0){return[d(e,r(t.substr(8)))]}else if(t.indexOf("find ")===0){return[b(e,r(t.substr(5)))]}else if(t.indexOf("next ")===0){return[z(e,r(t.substr(5)))]}else if(t.indexOf("previous ")===0){return[$(e,r(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else{return K().querySelectorAll(r(t))}}var z=function(e,t){var r=K().querySelectorAll(t);for(var n=0;n<r.length;n++){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING){return i}}};var $=function(e,t){var r=K().querySelectorAll(t);for(var n=r.length-1;n>=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ie(e,t){if(t){return _(e,t)[0]}else{return _(K().body,e)[0]}}function s(e){if(A(e,"String")){return b(e)}else{return e}}function le(e,t,r){if(N(t)){return{target:K().body,event:e,listener:t}}else{return{target:s(e),event:t,listener:r}}}function ue(t,r,n){Or(function(){var e=le(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=N(r);return e?r:n}function fe(t,r,n){Or(function(){var e=le(t,r,n);e.target.removeEventListener(e.event,e.listener)});return N(r)?r:n}var ce=K().createElement("output");function he(e,t){var r=Y(e,t);if(r){if(r==="this"){return[de(e,t)]}else{var n=_(e,r);if(n.length===0){x('The selector "'+r+'" on '+t+" returned no matches!");return[ce]}else{return n}}}}function de(e,t){return c(e,function(e){return Z(e,t)!=null})}function ve(e){var t=Y(e,"hx-target");if(t){if(t==="this"){return de(e,"hx-target")}else{return ie(e,t)}}else{var r=ee(e);if(r.boosted){return K().body}else{return e}}}function ge(e){var t=G.config.attributesToSettle;for(var r=0;r<t.length;r++){if(e===t[r]){return true}}return false}function pe(t,r){te(t.attributes,function(e){if(!r.hasAttribute(e.name)&&ge(e.name)){t.removeAttribute(e.name)}});te(r.attributes,function(e){if(ge(e.name)){t.setAttribute(e.name,e.value)}})}function me(e,t){var r=Rr(t);for(var n=0;n<r.length;n++){var i=r[n];try{if(i.isInlineSwap(e)){return true}}catch(e){x(e)}}return e==="outerHTML"}function xe(e,i,a){var t="#"+i.id;var o="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=K().querySelectorAll(t);if(r){te(r,function(e){var t;var r=i.cloneNode(true);t=K().createDocumentFragment();t.appendChild(r);if(!me(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!oe(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){Me(o,e,e,t,a)}te(a.elts,function(e){oe(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);ae(K().body,"htmx:oobErrorNoTarget",{content:i})}return e}function ye(e,t,r){var n=Y(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e<i.length;e++){var a=i[e].split(":",2);var o=a[0].trim();if(o.indexOf("#")===0){o=o.substring(1)}var s=a[1]||"true";var l=t.querySelector("#"+o);if(l){xe(s,l,r)}}}te(f(t,"[hx-swap-oob], [data-hx-swap-oob]"),function(e){var t=Z(e,"hx-swap-oob");if(t!=null){xe(t,e,r)}})}function be(e){te(f(e,"[hx-preserve], [data-hx-preserve]"),function(e){var t=Z(e,"id");var r=K().getElementById(t);if(r!=null){e.parentNode.replaceChild(r,e)}})}function we(a,e,o){te(e.querySelectorAll("[id]"),function(e){if(e.id&&e.id.length>0){var t=e.id.replace("'","\\'");var r=e.tagName.replace(":","\\:");var n=a.querySelector(r+"[id='"+t+"']");if(n&&n!==a){var i=e.cloneNode();pe(e,n);o.tasks.push(function(){pe(e,i)})}}})}function Se(e){return function(){n(e,G.config.addedClass);Nt(e);St(e);Ee(e);oe(e,"htmx:load")}}function Ee(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){we(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;V(i,G.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(Se(i))}}}function Ce(e,t){var r=0;while(r<e.length){t=(t<<5)-t+e.charCodeAt(r++)|0}return t}function Re(e){var t=0;if(e.attributes){for(var r=0;r<e.attributes.length;r++){var n=e.attributes[r];if(n.value){t=Ce(n.name,t);t=Ce(n.value,t)}}}return t}function Oe(t){var r=ee(t);if(r.onHandlers){for(let e=0;e<r.onHandlers.length;e++){const n=r.onHandlers[e];t.removeEventListener(n.name,n.handler)}delete r.onHandlers}}function qe(e){var t=ee(e);if(t.timeout){clearTimeout(t.timeout)}if(t.webSocket){t.webSocket.close()}if(t.sseEventSource){t.sseEventSource.close()}if(t.listenerInfos){te(t.listenerInfos,function(e){if(e.on){e.on.removeEventListener(e.trigger,e.listener)}})}Oe(e)}function o(e){oe(e,"htmx:beforeCleanupElement");qe(e);if(e.children){te(e.children,function(e){o(e)})}}function Te(t,e,r){if(t.tagName==="BODY"){return ke(t,e,r)}else{var n;var i=t.previousSibling;a(u(t),t,e,r);if(i==null){n=u(t).firstChild}else{n=i.nextSibling}ee(t).replacedWith=n;r.elts=r.elts.filter(e=>e!=t);while(n&&n!==t){if(n.nodeType===Node.ELEMENT_NODE){r.elts.push(n)}n=n.nextElementSibling}o(t);u(t).removeChild(t)}}function He(e,t,r){return a(e,e.firstChild,t,r)}function Le(e,t,r){return a(u(e),e,t,r)}function Ae(e,t,r){return a(e,null,t,r)}function Ne(e,t,r){return a(u(e),e.nextSibling,t,r)}function Ie(e,t,r){o(e);return u(e).removeChild(e)}function ke(e,t,r){var n=e.firstChild;a(e,n,t,r);if(n){while(n.nextSibling){o(n.nextSibling);e.removeChild(n.nextSibling)}o(n);e.removeChild(n)}}function Pe(e,t,r){var n=r||Y(e,"hx-select");if(n){var i=K().createDocumentFragment();te(t.querySelectorAll(n),function(e){i.appendChild(e)});t=i}return t}function Me(e,t,r,n,i){switch(e){case"none":return;case"outerHTML":Te(r,n,i);return;case"afterbegin":He(r,n,i);return;case"beforebegin":Le(r,n,i);return;case"beforeend":Ae(r,n,i);return;case"afterend":Ne(r,n,i);return;case"delete":Ie(r,n,i);return;default:var a=Rr(t);for(var o=0;o<a.length;o++){var s=a[o];try{var l=s.handleSwap(e,r,n,i);if(l){if(typeof l.length!=="undefined"){for(var u=0;u<l.length;u++){var f=l[u];if(f.nodeType!==Node.TEXT_NODE&&f.nodeType!==Node.COMMENT_NODE){i.tasks.push(Se(f))}}}return}}catch(e){x(e)}}if(e==="innerHTML"){ke(r,n,i)}else{Me(G.config.defaultSwapStyle,t,r,n,i)}}}function De(e){if(e.indexOf("<title")>-1){var t=e.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/<title(\s[^>]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function Xe(e,t,r,n,i,a){i.title=De(n);var o=l(n);if(o){ye(r,o,i);o=Pe(r,o,a);be(o);return Me(e,r,t,o,i)}}function Fe(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=y(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!I(o)){o={value:o}}oe(r,a,o)}}}else{oe(r,n,[])}}var Ue=/\s/;var g=/[\s,]/;var Be=/[_$a-zA-Z]/;var Ve=/[_$a-zA-Z0-9]/;var je=['"',"'","/"];var p=/[^\s]/;function We(e){var t=[];var r=0;while(r<e.length){if(Be.exec(e.charAt(r))){var n=r;while(Ve.exec(e.charAt(r+1))){r++}t.push(e.substr(n,r-n+1))}else if(je.indexOf(e.charAt(r))!==-1){var i=e.charAt(r);var n=r;r++;while(r<e.length&&e.charAt(r)!==i){if(e.charAt(r)==="\\"){r++}r++}t.push(e.substr(n,r-n+1))}else{var a=e.charAt(r);t.push(a)}r++}return t}function _e(e,t,r){return Be.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==r&&t!=="."}function ze(e,t,r){if(t[0]==="["){t.shift();var n=1;var i=" return (function("+r+"){ return (";var a=null;while(t.length>0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=cr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){ae(K().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(_e(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function m(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}var $e="input, textarea, select";function Ge(e){var t=Z(e,"hx-trigger");var r=[];if(t){var n=We(t);do{m(n,p);var i=n.length;var a=m(n,/[,\[\s]/);if(a!==""){if(a==="every"){var o={trigger:"every"};m(n,p);o.pollInterval=v(m(n,/[,\[\s]/));m(n,p);var s=ze(e,n,"event");if(s){o.eventFilter=s}r.push(o)}else if(a.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:a.substr(4)})}else{var l={trigger:a};var s=ze(e,n,"event");if(s){l.eventFilter=s}while(n.length>0&&n[0]!==","){m(n,p);var u=n.shift();if(u==="changed"){l.changed=true}else if(u==="once"){l.once=true}else if(u==="consume"){l.consume=true}else if(u==="delay"&&n[0]===":"){n.shift();l.delay=v(m(n,g))}else if(u==="from"&&n[0]===":"){n.shift();var f=m(n,g);if(f==="closest"||f==="find"||f==="next"||f==="previous"){n.shift();f+=" "+m(n,g)}l.from=f}else if(u==="target"&&n[0]===":"){n.shift();l.target=m(n,g)}else if(u==="throttle"&&n[0]===":"){n.shift();l.throttle=v(m(n,g))}else if(u==="queue"&&n[0]===":"){n.shift();l.queue=m(n,g)}else if((u==="root"||u==="threshold")&&n[0]===":"){n.shift();l[u]=m(n,g)}else{ae(e,"htmx:syntax:error",{token:n.shift()})}}r.push(l)}}if(n.length===i){ae(e,"htmx:syntax:error",{token:n.shift()})}m(n,p)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"]')){return[{trigger:"click"}]}else if(h(e,$e)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function Je(e){ee(e).cancelled=true}function Ze(e,t,r){var n=ee(e);n.timeout=setTimeout(function(){if(re(e)&&n.cancelled!==true){if(!tt(r,e,kt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}Ze(e,t,r)}},r.pollInterval)}function Ke(e){return location.hostname===e.hostname&&J(e,"href")&&J(e,"href").indexOf("#")!==0}function Ye(t,r,e){if(t.tagName==="A"&&Ke(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=t.href}else{var a=J(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=J(t,"action")}e.forEach(function(e){rt(t,function(e,t){se(n,i,e,t)},r,e,true)})}}function Qe(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&d(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function et(e,t){return ee(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function tt(e,t,r){var n=e.eventFilter;if(n){try{return n.call(t,r)!==true}catch(e){ae(K().body,"htmx:eventFilter:error",{error:e,source:n.source});return true}}return false}function rt(i,a,e,o,s){var l=ee(i);var t;if(o.from){t=_(i,o.from)}else{t=[i]}if(o.changed){l.lastValue=i.value}te(t,function(r){var n=function(e){if(!re(i)){r.removeEventListener(o.trigger,n);return}if(et(i,e)){return}if(s||Qe(e,i)){e.preventDefault()}if(tt(o,i,e)){return}var t=ee(e);t.triggerSpec=o;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(i)<0){t.handledFor.push(i);if(o.consume){e.stopPropagation()}if(o.target&&e.target){if(!h(e.target,o.target)){return}}if(o.once){if(l.triggeredOnce){return}else{l.triggeredOnce=true}}if(o.changed){if(l.lastValue===i.value){return}else{l.lastValue=i.value}}if(l.delayed){clearTimeout(l.delayed)}if(l.throttle){return}if(o.throttle){if(!l.throttle){a(i,e);l.throttle=setTimeout(function(){l.throttle=null},o.throttle)}}else if(o.delay){l.delayed=setTimeout(function(){a(i,e)},o.delay)}else{oe(i,"htmx:trigger");a(i,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:o.trigger,listener:n,on:r});r.addEventListener(o.trigger,n)})}var nt=false;var it=null;function at(){if(!it){it=function(){nt=true};window.addEventListener("scroll",it);setInterval(function(){if(nt){nt=false;te(K().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){ot(e)})}},200)}}function ot(t){if(!q(t,"data-hx-revealed")&&P(t)){t.setAttribute("data-hx-revealed","true");var e=ee(t);if(e.initHash){oe(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){oe(t,"revealed")},{once:true})}}}function st(e,t,r){var n=M(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){lt(e,a[1],0)}if(a[0]==="send"){ft(e)}}}function lt(s,r,n){if(!re(s)){return}if(r.indexOf("/")==0){var e=location.hostname+(location.port?":"+location.port:"");if(location.protocol=="https:"){r="wss://"+e+r}else if(location.protocol=="http:"){r="ws://"+e+r}}var t=G.createWebSocket(r);t.onerror=function(e){ae(s,"htmx:wsError",{error:e,socket:t});ut(s)};t.onclose=function(e){if([1006,1012,1013].indexOf(e.code)>=0){var t=ct(n);setTimeout(function(){lt(s,r,n+1)},t)}};t.onopen=function(e){n=0};ee(s).webSocket=t;t.addEventListener("message",function(e){if(ut(s)){return}var t=e.data;w(s,function(e){t=e.transformResponse(t,null,s)});var r=S(s);var n=l(t);var i=k(n.children);for(var a=0;a<i.length;a++){var o=i[a];xe(Z(o,"hx-swap-oob")||"true",o,r)}Wt(r.tasks)})}function ut(e){if(!re(e)){ee(e).webSocket.close();return true}}function ft(u){var f=c(u,function(e){return ee(e).webSocket!=null});if(f){u.addEventListener(Ge(u)[0].trigger,function(e){var t=ee(f).webSocket;var r=nr(u,f);var n=Qt(u,"post");var i=n.errors;var a=n.values;var o=vr(u);var s=ne(a,o);var l=ir(s,u);l["HEADERS"]=r;if(i&&i.length>0){oe(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(Qe(e,u)){e.preventDefault()}})}else{ae(u,"htmx:noWebSocketSourceError")}}function ct(e){var t=G.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}x('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function ht(e,t,r){var n=M(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){dt(e,a[1])}if(a[0]==="swap"){vt(e,a[1])}}}function dt(t,e){var r=G.createEventSource(e);r.onerror=function(e){ae(t,"htmx:sseError",{error:e,source:r});pt(t)};ee(t).sseEventSource=r}function vt(a,o){var s=c(a,mt);if(s){var l=ee(s).sseEventSource;var u=function(e){if(pt(s)){return}if(!re(a)){l.removeEventListener(o,u);return}var t=e.data;w(a,function(e){t=e.transformResponse(t,null,a)});var r=or(a);var n=ve(a);var i=S(a);Xe(r.swapStyle,n,a,t,i);Wt(i.tasks);oe(a,"htmx:sseMessage",e)};ee(a).sseListener=u;l.addEventListener(o,u)}else{ae(a,"htmx:noSSESourceError")}}function gt(e,t,r){var n=c(e,mt);if(n){var i=ee(n).sseEventSource;var a=function(){if(!pt(n)){if(re(e)){t(e)}else{i.removeEventListener(r,a)}}};ee(e).sseListener=a;i.addEventListener(r,a)}else{ae(e,"htmx:noSSESourceError")}}function pt(e){if(!re(e)){ee(e).sseEventSource.close();return true}}function mt(e){return ee(e).sseEventSource!=null}function xt(e,t,r,n){var i=function(){if(!r.loaded){r.loaded=true;t(e)}};if(n){setTimeout(i,n)}else{i()}}function yt(t,i,e){var a=false;te(R,function(r){if(q(t,"hx-"+r)){var n=Z(t,"hx-"+r);a=true;i.path=n;i.verb=r;e.forEach(function(e){bt(t,e,i,function(e,t){se(r,n,e,t)})})}});return a}function bt(n,e,t,r){if(e.sseEvent){gt(n,r,e.sseEvent)}else if(e.trigger==="revealed"){at();rt(n,r,t,e);ot(n)}else if(e.trigger==="intersect"){var i={};if(e.root){i.root=ie(n,e.root)}if(e.threshold){i.threshold=parseFloat(e.threshold)}var a=new IntersectionObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.isIntersecting){oe(n,"intersect");break}}},i);a.observe(n);rt(n,r,t,e)}else if(e.trigger==="load"){if(!tt(e,n,kt("load",{elt:n}))){xt(n,r,t,e.delay)}}else if(e.pollInterval){t.polling=true;Ze(n,r,e)}else{rt(n,r,t,e)}}function wt(e){if(e.type==="text/javascript"||e.type==="module"||e.type===""){var t=K().createElement("script");te(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(G.config.inlineScriptNonce){t.nonce=G.config.inlineScriptNonce}var r=e.parentElement;try{r.insertBefore(t,e)}catch(e){x(e)}finally{if(e.parentElement){e.parentElement.removeChild(e)}}}}function St(e){if(h(e,"script")){wt(e)}te(f(e,"script"),function(e){wt(e)})}function Et(){return document.querySelector("[hx-boost], [data-hx-boost]")}function Ct(e){if(!document.evaluate)return[];let t=null;const r=[];const n=document.evaluate('//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") ]]',e);while(t=n.iterateNext())r.push(t);return r}function Rt(e){if(e.querySelectorAll){var t=Et()?", a, form":"";var r=e.querySelectorAll(O+t+", [hx-sse], [data-hx-sse], [hx-ws],"+" [data-hx-ws], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger], [hx-on], [data-hx-on]");return r}else{return[]}}function Ot(n){var e=function(e){var t=d(e.target,"button, input[type='submit']");if(t!==null){var r=ee(n);r.lastButtonClicked=t}};n.addEventListener("click",e);n.addEventListener("focusin",e);n.addEventListener("focusout",function(e){var t=ee(n);t.lastButtonClicked=null})}function qt(e){var t=We(e);var r=0;for(let e=0;e<t.length;e++){const n=t[e];if(n==="{"){r++}else if(n==="}"){r--}}return r}function Tt(t,e,r){var n=ee(t);n.onHandlers=[];var i=new Function("event",r+"; return;");var a=t.addEventListener(e,function(e){return i.call(t,e)});n.onHandlers.push({event:e,listener:a});return{nodeData:n,code:r,func:i,listener:a}}function Ht(e){var t=Z(e,"hx-on");if(t&&G.config.allowEval){var r={};var n=t.split("\n");var i=null;var a=0;while(n.length>0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=qt(o)}for(var l in r){Tt(e,l,r[l])}}}function Lt(t){Oe(t);for(const e of t.attributes){const{name:r,value:n}=e;if(r.startsWith("hx-on:")||r.startsWith("data-hx-on:")){let e=r.slice(r.indexOf(":")+1);if(e.startsWith(":"))e="htmx"+e;Tt(t,e,n)}}}function At(t){if(t.closest&&t.closest(G.config.disableSelector)){return}var r=ee(t);if(r.initHash!==Re(t)){r.initHash=Re(t);qe(t);Ht(t);oe(t,"htmx:beforeProcessNode");if(t.value){r.lastValue=t.value}var e=Ge(t);var n=yt(t,r,e);if(!n){if(Y(t,"hx-boost")==="true"){Ye(t,r,e)}else if(q(t,"hx-trigger")){e.forEach(function(e){bt(t,e,r,function(){})})}}if(t.tagName==="FORM"){Ot(t)}var i=Z(t,"hx-sse");if(i){ht(t,r,i)}var a=Z(t,"hx-ws");if(a){st(t,r,a)}oe(t,"htmx:afterProcessNode")}}function Nt(e){e=s(e);At(e);te(Rt(e),function(e){At(e)});te(Ct(e),Lt)}function It(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function kt(e,t){var r;if(window.CustomEvent&&typeof window.CustomEvent==="function"){r=new CustomEvent(e,{bubbles:true,cancelable:true,detail:t})}else{r=K().createEvent("CustomEvent");r.initCustomEvent(e,true,true,t)}return r}function ae(e,t,r){oe(e,t,ne({error:t},r))}function Pt(e){return e==="htmx:afterProcessNode"}function w(e,t){te(Rr(e),function(e){try{t(e)}catch(e){x(e)}})}function x(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function oe(e,t,r){e=s(e);if(r==null){r={}}r["elt"]=e;var n=kt(t,r);if(G.logger&&!Pt(t)){G.logger(e,t,r)}if(r.error){x(r.error);oe(e,"htmx:error",{errorInfo:r})}var i=e.dispatchEvent(n);var a=It(t);if(i&&a!==t){var o=kt(a,n.detail);i=i&&e.dispatchEvent(o)}w(e,function(e){i=i&&e.onEvent(t,n)!==false});return i}var Mt=location.pathname+location.search;function Dt(){var e=K().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||K().body}function Xt(e,t,r,n){if(!D()){return}e=X(e);var i=y(localStorage.getItem("htmx-history-cache"))||[];for(var a=0;a<i.length;a++){if(i[a].url===e){i.splice(a,1);break}}var o={url:e,content:t,title:r,scroll:n};oe(K().body,"htmx:historyItemCreated",{item:o,cache:i});i.push(o);while(i.length>G.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){ae(K().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Ft(e){if(!D()){return null}e=X(e);var t=y(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r<t.length;r++){if(t[r].url===e){return t[r]}}return null}function Ut(e){var t=G.config.requestClass;var r=e.cloneNode(true);te(f(r,"."+t),function(e){n(e,t)});return r.innerHTML}function Bt(){var e=Dt();var t=Mt||location.pathname+location.search;var r=K().querySelector('[hx-history="false" i],[data-hx-history="false" i]');if(!r){oe(K().body,"htmx:beforeHistorySave",{path:t,historyElt:e});Xt(t,Ut(e),K().title,window.scrollY)}if(G.config.historyEnabled)history.replaceState({htmx:true},K().title,window.location.href)}function Vt(e){if(G.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(e.endsWith("&")||e.endsWith("?")){e=e.slice(0,-1)}}if(G.config.historyEnabled){history.pushState({htmx:true},"",e)}Mt=e}function jt(e){if(G.config.historyEnabled)history.replaceState({htmx:true},"",e);Mt=e}function Wt(e){te(e,function(e){e.call()})}function _t(a){var e=new XMLHttpRequest;var o={path:a,xhr:e};oe(K().body,"htmx:historyCacheMiss",o);e.open("GET",a,true);e.setRequestHeader("HX-History-Restore-Request","true");e.onload=function(){if(this.status>=200&&this.status<400){oe(K().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Dt();var r=S(t);var n=De(this.response);if(n){var i=b("title");if(i){i.innerHTML=n}else{window.document.title=n}}ke(t,e,r);Wt(r.tasks);Mt=a;oe(K().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{ae(K().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function zt(e){Bt();e=e||location.pathname+location.search;var t=Ft(e);if(t){var r=l(t.content);var n=Dt();var i=S(n);ke(n,r,i);Wt(i.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);Mt=e;oe(K().body,"htmx:historyRestore",{path:e,item:t})}else{if(G.config.refreshOnHistoryMiss){window.location.reload(true)}else{_t(e)}}}function $t(e){var t=he(e,"hx-indicator");if(t==null){t=[e]}te(t,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,G.config.requestClass)});return t}function Gt(e){te(e,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,G.config.requestClass)}})}function Jt(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.isSameNode(t)){return true}}return false}function Zt(e){if(e.name===""||e.name==null||e.disabled){return false}if(e.type==="button"||e.type==="submit"||e.tagName==="image"||e.tagName==="reset"||e.tagName==="file"){return false}if(e.type==="checkbox"||e.type==="radio"){return e.checked}return true}function Kt(t,r,n,e,i){if(e==null||Jt(t,e)){return}else{t.push(e)}if(Zt(e)){var a=J(e,"name");var o=e.value;if(e.multiple){o=k(e.querySelectorAll("option:checked")).map(function(e){return e.value})}if(e.files){o=k(e.files)}if(a!=null&&o!=null){var s=r[a];if(s!==undefined){if(Array.isArray(s)){if(Array.isArray(o)){r[a]=s.concat(o)}else{s.push(o)}}else{if(Array.isArray(o)){r[a]=[s].concat(o)}else{r[a]=[s,o]}}}else{r[a]=o}}if(i){Yt(e,n)}}if(h(e,"form")){var l=e.elements;te(l,function(e){Kt(t,r,n,e,i)})}}function Yt(e,t){if(e.willValidate){oe(e,"htmx:validation:validate");if(!e.checkValidity()){t.push({elt:e,message:e.validationMessage,validity:e.validity});oe(e,"htmx:validation:failed",{message:e.validationMessage,validity:e.validity})}}}function Qt(e,t){var r=[];var n={};var i={};var a=[];var o=ee(e);var s=h(e,"form")&&e.noValidate!==true||Z(e,"hx-validate")==="true";if(o.lastButtonClicked){s=s&&o.lastButtonClicked.formNoValidate!==true}if(t!=="get"){Kt(r,i,a,d(e,"form"),s)}Kt(r,n,a,e,s);if(o.lastButtonClicked){var l=J(o.lastButtonClicked,"name");if(l){n[l]=o.lastButtonClicked.value}}var u=he(e,"hx-include");te(u,function(e){Kt(r,n,a,e,s);if(!h(e,"form")){te(e.querySelectorAll($e),function(e){Kt(r,n,a,e,s)})}});n=ne(n,i);return{errors:a,values:n}}function er(e,t,r){if(e!==""){e+="&"}if(String(r)==="[object Object]"){r=JSON.stringify(r)}var n=encodeURIComponent(r);e+=encodeURIComponent(t)+"="+n;return e}function tr(e){var t="";for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){te(n,function(e){t=er(t,r,e)})}else{t=er(t,r,n)}}}return t}function rr(e){var t=new FormData;for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){te(n,function(e){t.append(r,e)})}else{t.append(r,n)}}}return t}function nr(e,t,r){var n={"HX-Request":"true","HX-Trigger":J(e,"id"),"HX-Trigger-Name":J(e,"name"),"HX-Target":Z(t,"id"),"HX-Current-URL":K().location.href};fr(e,"hx-headers",false,n);if(r!==undefined){n["HX-Prompt"]=r}if(ee(e).boosted){n["HX-Boosted"]="true"}return n}function ir(t,e){var r=Y(e,"hx-params");if(r){if(r==="none"){return{}}else if(r==="*"){return t}else if(r.indexOf("not ")===0){te(r.substr(4).split(","),function(e){e=e.trim();delete t[e]});return t}else{var n={};te(r.split(","),function(e){e=e.trim();n[e]=t[e]});return n}}else{return t}}function ar(e){return J(e,"href")&&J(e,"href").indexOf("#")>=0}function or(e,t){var r=t?t:Y(e,"hx-swap");var n={swapStyle:ee(e).boosted?"innerHTML":G.config.defaultSwapStyle,swapDelay:G.config.defaultSwapDelay,settleDelay:G.config.defaultSettleDelay};if(ee(e).boosted&&!ar(e)){n["show"]="top"}if(r){var i=M(r);if(i.length>0){n["swapStyle"]=i[0];for(var a=1;a<i.length;a++){var o=i[a];if(o.indexOf("swap:")===0){n["swapDelay"]=v(o.substr(5))}if(o.indexOf("settle:")===0){n["settleDelay"]=v(o.substr(7))}if(o.indexOf("transition:")===0){n["transition"]=o.substr(11)==="true"}if(o.indexOf("scroll:")===0){var s=o.substr(7);var l=s.split(":");var u=l.pop();var f=l.length>0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}if(o.indexOf("focus-scroll:")===0){var d=o.substr("focus-scroll:".length);n["focusScroll"]=d=="true"}}}}return n}function sr(e){return Y(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&J(e,"enctype")==="multipart/form-data"}function lr(t,r,n){var i=null;w(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(sr(r)){return rr(n)}else{return tr(n)}}}function S(e){return{tasks:[],elts:[e]}}function ur(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ie(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ie(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:G.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:G.config.scrollBehavior})}}}function fr(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=Z(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=cr(e,function(){return Function("return ("+a+")")()},{})}else{s=y(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return fr(u(e),t,r,n)}function cr(e,t,r){if(G.config.allowEval){return t()}else{ae(e,"htmx:evalDisallowedError");return r}}function hr(e,t){return fr(e,"hx-vars",true,t)}function dr(e,t){return fr(e,"hx-vals",false,t)}function vr(e){return ne(hr(e),dr(e))}function gr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function pr(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ae(K().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function E(e,t){return e.getAllResponseHeaders().match(t)}function mr(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||A(r,"String")){return se(e,t,null,null,{targetOverride:s(r),returnPromise:true})}else{return se(e,t,s(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:s(r.target),swapOverride:r.swap,returnPromise:true})}}else{return se(e,t,null,null,{returnPromise:true})}}function xr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function se(e,t,n,r,i,M){var a=null;var o=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var s=new Promise(function(e,t){a=e;o=t})}if(n==null){n=K().body}var D=i.handler||br;if(!re(n)){return}var l=i.targetOverride||ve(n);if(l==null||l==ce){ae(n,"htmx:targetError",{target:Z(n,"hx-target")});return}if(!M){var X=function(){return se(e,t,n,r,i,true)};var F={target:l,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:X};if(oe(n,"htmx:confirm",F)===false){return}}var u=n;var f=ee(n);var c=Y(n,"hx-sync");var h=null;var d=false;if(c){var v=c.split(":");var g=v[0].trim();if(g==="this"){u=de(n,"hx-sync")}else{u=ie(n,g)}c=(v[1]||"drop").trim();f=ee(u);if(c==="drop"&&f.xhr&&f.abortable!==true){return}else if(c==="abort"){if(f.xhr){return}else{d=true}}else if(c==="replace"){oe(u,"htmx:abort")}else if(c.indexOf("queue")===0){var U=c.split(" ");h=(U[1]||"last").trim()}}if(f.xhr){if(f.abortable){oe(u,"htmx:abort")}else{if(h==null){if(r){var p=ee(r);if(p&&p.triggerSpec&&p.triggerSpec.queue){h=p.triggerSpec.queue}}if(h==null){h="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(h==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="all"){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){se(e,t,n,r,i)})}return}}var m=new XMLHttpRequest;f.xhr=m;f.abortable=d;var x=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var y=Y(n,"hx-prompt");if(y){var b=prompt(y);if(b===null||!oe(n,"htmx:prompt",{prompt:b,target:l})){Q(a);x();return s}}var w=Y(n,"hx-confirm");if(w){if(!confirm(w)){Q(a);x();return s}}var S=nr(n,l,b);if(i.headers){S=ne(S,i.headers)}var E=Qt(n,e);var C=E.errors;var R=E.values;if(i.values){R=ne(R,i.values)}var B=vr(n);var O=ne(R,B);var q=ir(O,n);if(e!=="get"&&!sr(n)){S["Content-Type"]="application/x-www-form-urlencoded"}if(G.config.getCacheBusterParam&&e==="get"){q["org.htmx.cache-buster"]=J(l,"id")||"true"}if(t==null||t===""){t=K().location.href}var T=fr(n,"hx-request");var V=ee(n).boosted;var H=G.config.methodsThatUseUrlParams.indexOf(e)>=0;var L={boosted:V,useUrlParams:H,parameters:q,unfilteredParameters:O,headers:S,target:l,verb:e,errors:C,withCredentials:i.credentials||T.credentials||G.config.withCredentials,timeout:i.timeout||T.timeout||G.config.timeout,path:t,triggeringEvent:r};if(!oe(n,"htmx:configRequest",L)){Q(a);x();return s}t=L.path;e=L.verb;S=L.headers;q=L.parameters;C=L.errors;H=L.useUrlParams;if(C&&C.length>0){oe(n,"htmx:validation:halted",L);Q(a);x();return s}var j=t.split("#");var W=j[0];var A=j[1];var N=t;if(H){N=W;var _=Object.keys(q).length!==0;if(_){if(N.indexOf("?")<0){N+="?"}else{N+="&"}N+=tr(q);if(A){N+="#"+A}}}m.open(e.toUpperCase(),N,true);m.overrideMimeType("text/html");m.withCredentials=L.withCredentials;m.timeout=L.timeout;if(T.noHeaders){}else{for(var I in S){if(S.hasOwnProperty(I)){var z=S[I];gr(m,I,z)}}}var k={xhr:m,target:l,requestConfig:L,etc:i,boosted:V,pathInfo:{requestPath:t,finalRequestPath:N,anchor:A}};m.onload=function(){try{var e=xr(n);k.pathInfo.responsePath=pr(m);D(n,k);Gt(P);oe(n,"htmx:afterRequest",k);oe(n,"htmx:afterOnLoad",k);if(!re(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(re(r)){t=r}}if(t){oe(t,"htmx:afterRequest",k);oe(t,"htmx:afterOnLoad",k)}}Q(a);x()}catch(e){ae(n,"htmx:onLoadError",ne({error:e},k));throw e}};m.onerror=function(){Gt(P);ae(n,"htmx:afterRequest",k);ae(n,"htmx:sendError",k);Q(o);x()};m.onabort=function(){Gt(P);ae(n,"htmx:afterRequest",k);ae(n,"htmx:sendAbort",k);Q(o);x()};m.ontimeout=function(){Gt(P);ae(n,"htmx:afterRequest",k);ae(n,"htmx:timeout",k);Q(o);x()};if(!oe(n,"htmx:beforeRequest",k)){Q(a);x();return s}var P=$t(n);te(["loadstart","loadend","progress","abort"],function(t){te([m,m.upload],function(e){e.addEventListener(t,function(e){oe(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});oe(n,"htmx:beforeSend",k);var $=H?null:lr(m,n,q);m.send($);return s}function yr(e,t){var r=t.xhr;var n=null;var i=null;if(E(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(E(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(E(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=Y(e,"hx-push-url");var l=Y(e,"hx-replace-url");var u=ee(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function br(l,u){var f=u.xhr;var c=u.target;var e=u.etc;if(!oe(l,"htmx:beforeOnLoad",u))return;if(E(f,/HX-Trigger:/i)){Fe(f,"HX-Trigger",l)}if(E(f,/HX-Location:/i)){Bt();var t=f.getResponseHeader("HX-Location");var h;if(t.indexOf("{")===0){h=y(t);t=h["path"];delete h["path"]}mr("GET",t,h).then(function(){Vt(t)});return}if(E(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");return}if(E(f,/HX-Refresh:/i)){if("true"===f.getResponseHeader("HX-Refresh")){location.reload();return}}if(E(f,/HX-Retarget:/i)){u.target=K().querySelector(f.getResponseHeader("HX-Retarget"))}var d=yr(l,u);var r=f.status>=200&&f.status<400&&f.status!==204;var v=f.response;var n=f.status>=400;var i=ne({shouldSwap:r,serverResponse:v,isError:n},u);if(!oe(c,"htmx:beforeSwap",i))return;c=i.target;v=i.serverResponse;n=i.isError;u.target=c;u.failed=n;u.successful=!n;if(i.shouldSwap){if(f.status===286){Je(l)}w(l,function(e){v=e.transformResponse(v,f,l)});if(d.type){Bt()}var a=e.swapOverride;if(E(f,/HX-Reswap:/i)){a=f.getResponseHeader("HX-Reswap")}var h=or(l,a);c.classList.add(G.config.swappingClass);var g=null;var p=null;var o=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var r;if(E(f,/HX-Reselect:/i)){r=f.getResponseHeader("HX-Reselect")}var n=S(c);Xe(h.swapStyle,c,l,v,n,r);if(t.elt&&!re(t.elt)&&t.elt.id){var i=document.getElementById(t.elt.id);var a={preventScroll:h.focusScroll!==undefined?!h.focusScroll:!G.config.defaultFocusScroll};if(i){if(t.start&&i.setSelectionRange){try{i.setSelectionRange(t.start,t.end)}catch(e){}}i.focus(a)}}c.classList.remove(G.config.swappingClass);te(n.elts,function(e){if(e.classList){e.classList.add(G.config.settlingClass)}oe(e,"htmx:afterSwap",u)});if(E(f,/HX-Trigger-After-Swap:/i)){var o=l;if(!re(l)){o=K().body}Fe(f,"HX-Trigger-After-Swap",o)}var s=function(){te(n.tasks,function(e){e.call()});te(n.elts,function(e){if(e.classList){e.classList.remove(G.config.settlingClass)}oe(e,"htmx:afterSettle",u)});if(d.type){if(d.type==="push"){Vt(d.path);oe(K().body,"htmx:pushedIntoHistory",{path:d.path})}else{jt(d.path);oe(K().body,"htmx:replacedInHistory",{path:d.path})}}if(u.pathInfo.anchor){var e=b("#"+u.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title){var t=b("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}ur(n.elts,h);if(E(f,/HX-Trigger-After-Settle:/i)){var r=l;if(!re(l)){r=K().body}Fe(f,"HX-Trigger-After-Settle",r)}Q(g)};if(h.settleDelay>0){setTimeout(s,h.settleDelay)}else{s()}}catch(e){ae(l,"htmx:swapError",u);Q(p);throw e}};var s=G.config.globalViewTransitions;if(h.hasOwnProperty("transition")){s=h.transition}if(s&&oe(l,"htmx:beforeTransition",u)&&typeof Promise!=="undefined"&&document.startViewTransition){var m=new Promise(function(e,t){g=e;p=t});var x=o;o=function(){document.startViewTransition(function(){x();return m})}}if(h.swapDelay>0){setTimeout(o,h.swapDelay)}else{o()}}if(n){ae(l,"htmx:responseError",ne({error:"Response Status Error Code "+f.status+" from "+u.pathInfo.requestPath},u))}}var wr={};function Sr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Er(e,t){if(t.init){t.init(C)}wr[e]=ne(Sr(),t)}function Cr(e){delete wr[e]}function Rr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=Z(e,"hx-ext");if(t){te(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=wr[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return Rr(u(e),r,n)}function Or(e){if(K().readyState!=="loading"){e()}else{K().addEventListener("DOMContentLoaded",e)}}function qr(){if(G.config.includeIndicatorStyles!==false){K().head.insertAdjacentHTML("beforeend","<style> ."+G.config.indicatorClass+"{opacity:0;transition: opacity 200ms ease-in;} ."+G.config.requestClass+" ."+G.config.indicatorClass+"{opacity:1} ."+G.config.requestClass+"."+G.config.indicatorClass+"{opacity:1} </style>")}}function Tr(){var e=K().querySelector('meta[name="htmx-config"]');if(e){return y(e.content)}else{return null}}function Hr(){var e=Tr();if(e){G.config=ne(G.config,e)}}Or(function(){Hr();qr();var e=K().body;Nt(e);var t=K().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=ee(t);if(r&&r.xhr){r.xhr.abort()}});var r=window.onpopstate;window.onpopstate=function(e){if(e.state&&e.state.htmx){zt();te(t,function(e){oe(e,"htmx:restored",{document:K(),triggerEvent:oe})})}else{if(r){r(e)}}};setTimeout(function(){oe(e,"htmx:load",{});e=null},0)});return G}()});
1
+ (function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var G={onLoad:t,process:Nt,on:le,off:ue,trigger:oe,ajax:xr,find:b,findAll:f,closest:d,values:function(e,t){var r=er(e,t||"post");return r.values},remove:U,addClass:B,removeClass:n,toggleClass:V,takeClass:j,defineExtension:Rr,removeExtension:Or,logAll:X,logNone:F,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:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get"],selfRequestsOnly:false},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=G.config.wsBinaryType;return t},version:"1.9.5"};var C={addTriggerHandler:bt,bodyContains:re,canAccessLocalStorage:M,findThisElement:he,filterValues:ar,hasAttribute:o,getAttributeValue:Z,getClosestAttributeValue:Y,getClosestMatch:c,getExpressionVars:gr,getHeaders:ir,getInputValues:er,getInternalData:ee,getSwapSpecification:sr,getTriggerSpecs:Ge,getTarget:de,makeFragment:l,mergeObjects:ne,makeSettleInfo:S,oobSwap:me,querySelectorExt:ie,selectAndSwap:De,settleImmediately:Wt,shouldCancel:Qe,triggerEvent:oe,triggerErrorEvent:ae,withExtensions:w};var R=["get","post","put","delete","patch"];var O=R.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function J(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function Z(e,t){return J(e,t)||J(e,"data-"+t)}function u(e){return e.parentElement}function K(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function T(e,t,r){var n=Z(t,r);var i=Z(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function Y(t,r){var n=null;c(t,function(e){return n=T(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function q(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function i(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=K().createDocumentFragment()}return i}function H(e){return e.match(/<body/)}function l(e){var t=!H(e);if(G.config.useTemplateFragments&&t){var r=i("<body><template>"+e+"</template></body>",0);return r.querySelector("template").content}else{var n=q(e);switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i("<table>"+e+"</table>",1);case"col":return i("<table><colgroup>"+e+"</colgroup></table>",2);case"tr":return i("<table><tbody>"+e+"</tbody></table>",2);case"td":case"th":return i("<table><tbody><tr>"+e+"</tr></tbody></table>",3);case"script":return i("<div>"+e+"</div>",1);default:return i(e,0)}}}function Q(e){if(e){e()}}function L(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function A(e){return L(e,"Function")}function N(e){return L(e,"Object")}function ee(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function I(e){var t=[];if(e){for(var r=0;r<e.length;r++){t.push(e[r])}}return t}function te(e,t){if(e){for(var r=0;r<e.length;r++){t(e[r])}}}function P(e){var t=e.getBoundingClientRect();var r=t.top;var n=t.bottom;return r<window.innerHeight&&n>=0}function re(e){if(e.getRootNode&&e.getRootNode()instanceof window.ShadowRoot){return K().body.contains(e.getRootNode().host)}else{return K().body.contains(e)}}function k(e){return e.trim().split(/\s+/)}function ne(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function y(e){try{return JSON.parse(e)}catch(e){x(e);return null}}function M(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function D(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!t.match("^/$")){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return hr(K().body,function(){return eval(e)})}function t(t){var e=G.on("htmx:load",function(e){t(e.detail.elt)});return e}function X(){G.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function F(){G.logger=null}function b(e,t){if(t){return e.querySelector(t)}else{return b(K(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(K(),e)}}function U(e,t){e=s(e);if(t){setTimeout(function(){U(e);e=null},t)}else{e.parentElement.removeChild(e)}}function B(e,t,r){e=s(e);if(r){setTimeout(function(){B(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=s(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function V(e,t){e=s(e);e.classList.toggle(t)}function j(e,t){e=s(e);te(e.parentElement.children,function(e){n(e,t)});B(e,t)}function d(e,t){e=s(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function r(e){var t=e.trim();if(t.startsWith("<")&&t.endsWith("/>")){return t.substring(1,t.length-2)}else{return t}}function W(e,t){if(t.indexOf("closest ")===0){return[d(e,r(t.substr(8)))]}else if(t.indexOf("find ")===0){return[b(e,r(t.substr(5)))]}else if(t.indexOf("next ")===0){return[_(e,r(t.substr(5)))]}else if(t.indexOf("previous ")===0){return[z(e,r(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else if(t==="body"){return[document.body]}else{return K().querySelectorAll(r(t))}}var _=function(e,t){var r=K().querySelectorAll(t);for(var n=0;n<r.length;n++){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING){return i}}};var z=function(e,t){var r=K().querySelectorAll(t);for(var n=r.length-1;n>=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ie(e,t){if(t){return W(e,t)[0]}else{return W(K().body,e)[0]}}function s(e){if(L(e,"String")){return b(e)}else{return e}}function $(e,t,r){if(A(t)){return{target:K().body,event:e,listener:t}}else{return{target:s(e),event:t,listener:r}}}function le(t,r,n){Hr(function(){var e=$(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=A(r);return e?r:n}function ue(t,r,n){Hr(function(){var e=$(t,r,n);e.target.removeEventListener(e.event,e.listener)});return A(r)?r:n}var fe=K().createElement("output");function ce(e,t){var r=Y(e,t);if(r){if(r==="this"){return[he(e,t)]}else{var n=W(e,r);if(n.length===0){x('The selector "'+r+'" on '+t+" returned no matches!");return[fe]}else{return n}}}}function he(e,t){return c(e,function(e){return Z(e,t)!=null})}function de(e){var t=Y(e,"hx-target");if(t){if(t==="this"){return he(e,"hx-target")}else{return ie(e,t)}}else{var r=ee(e);if(r.boosted){return K().body}else{return e}}}function ve(e){var t=G.config.attributesToSettle;for(var r=0;r<t.length;r++){if(e===t[r]){return true}}return false}function ge(t,r){te(t.attributes,function(e){if(!r.hasAttribute(e.name)&&ve(e.name)){t.removeAttribute(e.name)}});te(r.attributes,function(e){if(ve(e.name)){t.setAttribute(e.name,e.value)}})}function pe(e,t){var r=Tr(t);for(var n=0;n<r.length;n++){var i=r[n];try{if(i.isInlineSwap(e)){return true}}catch(e){x(e)}}return e==="outerHTML"}function me(e,i,a){var t="#"+J(i,"id");var o="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=K().querySelectorAll(t);if(r){te(r,function(e){var t;var r=i.cloneNode(true);t=K().createDocumentFragment();t.appendChild(r);if(!pe(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!oe(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){ke(o,e,e,t,a)}te(a.elts,function(e){oe(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);ae(K().body,"htmx:oobErrorNoTarget",{content:i})}return e}function xe(e,t,r){var n=Y(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e<i.length;e++){var a=i[e].split(":",2);var o=a[0].trim();if(o.indexOf("#")===0){o=o.substring(1)}var s=a[1]||"true";var l=t.querySelector("#"+o);if(l){me(s,l,r)}}}te(f(t,"[hx-swap-oob], [data-hx-swap-oob]"),function(e){var t=Z(e,"hx-swap-oob");if(t!=null){me(t,e,r)}})}function ye(e){te(f(e,"[hx-preserve], [data-hx-preserve]"),function(e){var t=Z(e,"id");var r=K().getElementById(t);if(r!=null){e.parentNode.replaceChild(r,e)}})}function be(o,e,s){te(e.querySelectorAll("[id]"),function(e){var t=J(e,"id");if(t&&t.length>0){var r=t.replace("'","\\'");var n=e.tagName.replace(":","\\:");var i=o.querySelector(n+"[id='"+r+"']");if(i&&i!==o){var a=e.cloneNode();ge(e,i);s.tasks.push(function(){ge(e,a)})}}})}function we(e){return function(){n(e,G.config.addedClass);Nt(e);St(e);Se(e);oe(e,"htmx:load")}}function Se(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){be(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;B(i,G.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(we(i))}}}function Ee(e,t){var r=0;while(r<e.length){t=(t<<5)-t+e.charCodeAt(r++)|0}return t}function Ce(e){var t=0;if(e.attributes){for(var r=0;r<e.attributes.length;r++){var n=e.attributes[r];if(n.value){t=Ee(n.name,t);t=Ee(n.value,t)}}}return t}function Re(t){var r=ee(t);if(r.onHandlers){for(let e=0;e<r.onHandlers.length;e++){const n=r.onHandlers[e];t.removeEventListener(n.event,n.listener)}delete r.onHandlers}}function Oe(e){var t=ee(e);if(t.timeout){clearTimeout(t.timeout)}if(t.webSocket){t.webSocket.close()}if(t.sseEventSource){t.sseEventSource.close()}if(t.listenerInfos){te(t.listenerInfos,function(e){if(e.on){e.on.removeEventListener(e.trigger,e.listener)}})}if(t.initHash){t.initHash=null}Re(e)}function g(e){oe(e,"htmx:beforeCleanupElement");Oe(e);if(e.children){te(e.children,function(e){g(e)})}}function Te(t,e,r){if(t.tagName==="BODY"){return Ie(t,e,r)}else{var n;var i=t.previousSibling;a(u(t),t,e,r);if(i==null){n=u(t).firstChild}else{n=i.nextSibling}ee(t).replacedWith=n;r.elts=r.elts.filter(function(e){return e!=t});while(n&&n!==t){if(n.nodeType===Node.ELEMENT_NODE){r.elts.push(n)}n=n.nextElementSibling}g(t);u(t).removeChild(t)}}function qe(e,t,r){return a(e,e.firstChild,t,r)}function He(e,t,r){return a(u(e),e,t,r)}function Le(e,t,r){return a(e,null,t,r)}function Ae(e,t,r){return a(u(e),e.nextSibling,t,r)}function Ne(e,t,r){g(e);return u(e).removeChild(e)}function Ie(e,t,r){var n=e.firstChild;a(e,n,t,r);if(n){while(n.nextSibling){g(n.nextSibling);e.removeChild(n.nextSibling)}g(n);e.removeChild(n)}}function Pe(e,t,r){var n=r||Y(e,"hx-select");if(n){var i=K().createDocumentFragment();te(t.querySelectorAll(n),function(e){i.appendChild(e)});t=i}return t}function ke(e,t,r,n,i){switch(e){case"none":return;case"outerHTML":Te(r,n,i);return;case"afterbegin":qe(r,n,i);return;case"beforebegin":He(r,n,i);return;case"beforeend":Le(r,n,i);return;case"afterend":Ae(r,n,i);return;case"delete":Ne(r,n,i);return;default:var a=Tr(t);for(var o=0;o<a.length;o++){var s=a[o];try{var l=s.handleSwap(e,r,n,i);if(l){if(typeof l.length!=="undefined"){for(var u=0;u<l.length;u++){var f=l[u];if(f.nodeType!==Node.TEXT_NODE&&f.nodeType!==Node.COMMENT_NODE){i.tasks.push(we(f))}}}return}}catch(e){x(e)}}if(e==="innerHTML"){Ie(r,n,i)}else{ke(G.config.defaultSwapStyle,t,r,n,i)}}}function Me(e){if(e.indexOf("<title")>-1){var t=e.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/<title(\s[^>]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function De(e,t,r,n,i,a){i.title=Me(n);var o=l(n);if(o){xe(r,o,i);o=Pe(r,o,a);ye(o);return ke(e,r,t,o,i)}}function Xe(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=y(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!N(o)){o={value:o}}oe(r,a,o)}}}else{var s=n.split(",");for(var l=0;l<s.length;l++){oe(r,s[l].trim(),[])}}}var Fe=/\s/;var p=/[\s,]/;var Ue=/[_$a-zA-Z]/;var Be=/[_$a-zA-Z0-9]/;var Ve=['"',"'","/"];var je=/[^\s]/;function We(e){var t=[];var r=0;while(r<e.length){if(Ue.exec(e.charAt(r))){var n=r;while(Be.exec(e.charAt(r+1))){r++}t.push(e.substr(n,r-n+1))}else if(Ve.indexOf(e.charAt(r))!==-1){var i=e.charAt(r);var n=r;r++;while(r<e.length&&e.charAt(r)!==i){if(e.charAt(r)==="\\"){r++}r++}t.push(e.substr(n,r-n+1))}else{var a=e.charAt(r);t.push(a)}r++}return t}function _e(e,t,r){return Ue.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==r&&t!=="."}function ze(e,t,r){if(t[0]==="["){t.shift();var n=1;var i=" return (function("+r+"){ return (";var a=null;while(t.length>0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=hr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){ae(K().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(_e(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function m(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}var $e="input, textarea, select";function Ge(e){var t=Z(e,"hx-trigger");var r=[];if(t){var n=We(t);do{m(n,je);var i=n.length;var a=m(n,/[,\[\s]/);if(a!==""){if(a==="every"){var o={trigger:"every"};m(n,je);o.pollInterval=v(m(n,/[,\[\s]/));m(n,je);var s=ze(e,n,"event");if(s){o.eventFilter=s}r.push(o)}else if(a.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:a.substr(4)})}else{var l={trigger:a};var s=ze(e,n,"event");if(s){l.eventFilter=s}while(n.length>0&&n[0]!==","){m(n,je);var u=n.shift();if(u==="changed"){l.changed=true}else if(u==="once"){l.once=true}else if(u==="consume"){l.consume=true}else if(u==="delay"&&n[0]===":"){n.shift();l.delay=v(m(n,p))}else if(u==="from"&&n[0]===":"){n.shift();var f=m(n,p);if(f==="closest"||f==="find"||f==="next"||f==="previous"){n.shift();f+=" "+m(n,p)}l.from=f}else if(u==="target"&&n[0]===":"){n.shift();l.target=m(n,p)}else if(u==="throttle"&&n[0]===":"){n.shift();l.throttle=v(m(n,p))}else if(u==="queue"&&n[0]===":"){n.shift();l.queue=m(n,p)}else if((u==="root"||u==="threshold")&&n[0]===":"){n.shift();l[u]=m(n,p)}else{ae(e,"htmx:syntax:error",{token:n.shift()})}}r.push(l)}}if(n.length===i){ae(e,"htmx:syntax:error",{token:n.shift()})}m(n,je)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,$e)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function Je(e){ee(e).cancelled=true}function Ze(e,t,r){var n=ee(e);n.timeout=setTimeout(function(){if(re(e)&&n.cancelled!==true){if(!tt(r,e,Pt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}Ze(e,t,r)}},r.pollInterval)}function Ke(e){return location.hostname===e.hostname&&J(e,"href")&&J(e,"href").indexOf("#")!==0}function Ye(t,r,e){if(t.tagName==="A"&&Ke(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=t.href}else{var a=J(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=J(t,"action")}e.forEach(function(e){rt(t,function(e,t){if(d(e,G.config.disableSelector)){g(e);return}se(n,i,e,t)},r,e,true)})}}function Qe(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&d(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function et(e,t){return ee(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function tt(e,t,r){var n=e.eventFilter;if(n){try{return n.call(t,r)!==true}catch(e){ae(K().body,"htmx:eventFilter:error",{error:e,source:n.source});return true}}return false}function rt(a,o,e,s,l){var u=ee(a);var t;if(s.from){t=W(a,s.from)}else{t=[a]}if(s.changed){t.forEach(function(e){var t=ee(e);t.lastValue=e.value})}te(t,function(n){var i=function(e){if(!re(a)){n.removeEventListener(s.trigger,i);return}if(et(a,e)){return}if(l||Qe(e,a)){e.preventDefault()}if(tt(s,a,e)){return}var t=ee(e);t.triggerSpec=s;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(a)<0){t.handledFor.push(a);if(s.consume){e.stopPropagation()}if(s.target&&e.target){if(!h(e.target,s.target)){return}}if(s.once){if(u.triggeredOnce){return}else{u.triggeredOnce=true}}if(s.changed){var r=ee(n);if(r.lastValue===n.value){return}r.lastValue=n.value}if(u.delayed){clearTimeout(u.delayed)}if(u.throttle){return}if(s.throttle){if(!u.throttle){o(a,e);u.throttle=setTimeout(function(){u.throttle=null},s.throttle)}}else if(s.delay){u.delayed=setTimeout(function(){o(a,e)},s.delay)}else{oe(a,"htmx:trigger");o(a,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:s.trigger,listener:i,on:n});n.addEventListener(s.trigger,i)})}var nt=false;var it=null;function at(){if(!it){it=function(){nt=true};window.addEventListener("scroll",it);setInterval(function(){if(nt){nt=false;te(K().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){ot(e)})}},200)}}function ot(t){if(!o(t,"data-hx-revealed")&&P(t)){t.setAttribute("data-hx-revealed","true");var e=ee(t);if(e.initHash){oe(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){oe(t,"revealed")},{once:true})}}}function st(e,t,r){var n=k(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){lt(e,a[1],0)}if(a[0]==="send"){ft(e)}}}function lt(s,r,n){if(!re(s)){return}if(r.indexOf("/")==0){var e=location.hostname+(location.port?":"+location.port:"");if(location.protocol=="https:"){r="wss://"+e+r}else if(location.protocol=="http:"){r="ws://"+e+r}}var t=G.createWebSocket(r);t.onerror=function(e){ae(s,"htmx:wsError",{error:e,socket:t});ut(s)};t.onclose=function(e){if([1006,1012,1013].indexOf(e.code)>=0){var t=ct(n);setTimeout(function(){lt(s,r,n+1)},t)}};t.onopen=function(e){n=0};ee(s).webSocket=t;t.addEventListener("message",function(e){if(ut(s)){return}var t=e.data;w(s,function(e){t=e.transformResponse(t,null,s)});var r=S(s);var n=l(t);var i=I(n.children);for(var a=0;a<i.length;a++){var o=i[a];me(Z(o,"hx-swap-oob")||"true",o,r)}Wt(r.tasks)})}function ut(e){if(!re(e)){ee(e).webSocket.close();return true}}function ft(u){var f=c(u,function(e){return ee(e).webSocket!=null});if(f){u.addEventListener(Ge(u)[0].trigger,function(e){var t=ee(f).webSocket;var r=ir(u,f);var n=er(u,"post");var i=n.errors;var a=n.values;var o=gr(u);var s=ne(a,o);var l=ar(s,u);l["HEADERS"]=r;if(i&&i.length>0){oe(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(Qe(e,u)){e.preventDefault()}})}else{ae(u,"htmx:noWebSocketSourceError")}}function ct(e){var t=G.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}x('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function ht(e,t,r){var n=k(r);for(var i=0;i<n.length;i++){var a=n[i].split(/:(.+)/);if(a[0]==="connect"){dt(e,a[1])}if(a[0]==="swap"){vt(e,a[1])}}}function dt(t,e){var r=G.createEventSource(e);r.onerror=function(e){ae(t,"htmx:sseError",{error:e,source:r});pt(t)};ee(t).sseEventSource=r}function vt(a,o){var s=c(a,mt);if(s){var l=ee(s).sseEventSource;var u=function(e){if(pt(s)){return}if(!re(a)){l.removeEventListener(o,u);return}var t=e.data;w(a,function(e){t=e.transformResponse(t,null,a)});var r=sr(a);var n=de(a);var i=S(a);De(r.swapStyle,n,a,t,i);Wt(i.tasks);oe(a,"htmx:sseMessage",e)};ee(a).sseListener=u;l.addEventListener(o,u)}else{ae(a,"htmx:noSSESourceError")}}function gt(e,t,r){var n=c(e,mt);if(n){var i=ee(n).sseEventSource;var a=function(){if(!pt(n)){if(re(e)){t(e)}else{i.removeEventListener(r,a)}}};ee(e).sseListener=a;i.addEventListener(r,a)}else{ae(e,"htmx:noSSESourceError")}}function pt(e){if(!re(e)){ee(e).sseEventSource.close();return true}}function mt(e){return ee(e).sseEventSource!=null}function xt(e,t,r,n){var i=function(){if(!r.loaded){r.loaded=true;t(e)}};if(n){setTimeout(i,n)}else{i()}}function yt(t,i,e){var a=false;te(R,function(r){if(o(t,"hx-"+r)){var n=Z(t,"hx-"+r);a=true;i.path=n;i.verb=r;e.forEach(function(e){bt(t,e,i,function(e,t){if(d(e,G.config.disableSelector)){g(e);return}se(r,n,e,t)})})}});return a}function bt(n,e,t,r){if(e.sseEvent){gt(n,r,e.sseEvent)}else if(e.trigger==="revealed"){at();rt(n,r,t,e);ot(n)}else if(e.trigger==="intersect"){var i={};if(e.root){i.root=ie(n,e.root)}if(e.threshold){i.threshold=parseFloat(e.threshold)}var a=new IntersectionObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.isIntersecting){oe(n,"intersect");break}}},i);a.observe(n);rt(n,r,t,e)}else if(e.trigger==="load"){if(!tt(e,n,Pt("load",{elt:n}))){xt(n,r,t,e.delay)}}else if(e.pollInterval){t.polling=true;Ze(n,r,e)}else{rt(n,r,t,e)}}function wt(e){if(G.config.allowScriptTags&&(e.type==="text/javascript"||e.type==="module"||e.type==="")){var t=K().createElement("script");te(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(G.config.inlineScriptNonce){t.nonce=G.config.inlineScriptNonce}var r=e.parentElement;try{r.insertBefore(t,e)}catch(e){x(e)}finally{if(e.parentElement){e.parentElement.removeChild(e)}}}}function St(e){if(h(e,"script")){wt(e)}te(f(e,"script"),function(e){wt(e)})}function Et(){return document.querySelector("[hx-boost], [data-hx-boost]")}function Ct(e){if(!document.evaluate)return[];let t=null;const r=[];const n=document.evaluate('//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") ]]',e);while(t=n.iterateNext())r.push(t);return r}function Rt(e){if(e.querySelectorAll){var t=Et()?", a":"";var r=e.querySelectorAll(O+t+", form, [type='submit'], [hx-sse], [data-hx-sse], [hx-ws],"+" [data-hx-ws], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger], [hx-on], [data-hx-on]");return r}else{return[]}}function Ot(e){var n=s("#"+J(e,"form"))||d(e,"form");if(!n){return}var t=function(e){var t=d(e.target,"button, input[type='submit']");if(t!==null){var r=ee(n);r.lastButtonClicked=t}};e.addEventListener("click",t);e.addEventListener("focusin",t);e.addEventListener("focusout",function(e){var t=ee(n);t.lastButtonClicked=null})}function Tt(e){var t=We(e);var r=0;for(let e=0;e<t.length;e++){const n=t[e];if(n==="{"){r++}else if(n==="}"){r--}}return r}function qt(t,e,r){var n=ee(t);n.onHandlers=[];var i;var a=function(e){return hr(t,function(){if(!i){i=new Function("event",r)}i.call(t,e)})};t.addEventListener(e,a);n.onHandlers.push({event:e,listener:a})}function Ht(e){var t=Z(e,"hx-on");if(t){var r={};var n=t.split("\n");var i=null;var a=0;while(n.length>0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=Tt(o)}for(var l in r){qt(e,l,r[l])}}}function Lt(t){Re(t);for(var e=0;e<t.attributes.length;e++){var r=t.attributes[e].name;var n=t.attributes[e].value;if(r.startsWith("hx-on:")||r.startsWith("data-hx-on:")){let e=r.slice(r.indexOf(":")+1);if(e.startsWith(":"))e="htmx"+e;qt(t,e,n)}}}function At(t){if(d(t,G.config.disableSelector)){g(t);return}var r=ee(t);if(r.initHash!==Ce(t)){Oe(t);r.initHash=Ce(t);Ht(t);oe(t,"htmx:beforeProcessNode");if(t.value){r.lastValue=t.value}var e=Ge(t);var n=yt(t,r,e);if(!n){if(Y(t,"hx-boost")==="true"){Ye(t,r,e)}else if(o(t,"hx-trigger")){e.forEach(function(e){bt(t,e,r,function(){})})}}if(t.tagName==="FORM"||J(t,"type")==="submit"&&o(t,"form")){Ot(t)}var i=Z(t,"hx-sse");if(i){ht(t,r,i)}var a=Z(t,"hx-ws");if(a){st(t,r,a)}oe(t,"htmx:afterProcessNode")}}function Nt(e){e=s(e);if(d(e,G.config.disableSelector)){g(e);return}At(e);te(Rt(e),function(e){At(e)});te(Ct(e),Lt)}function It(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Pt(e,t){var r;if(window.CustomEvent&&typeof window.CustomEvent==="function"){r=new CustomEvent(e,{bubbles:true,cancelable:true,detail:t})}else{r=K().createEvent("CustomEvent");r.initCustomEvent(e,true,true,t)}return r}function ae(e,t,r){oe(e,t,ne({error:t},r))}function kt(e){return e==="htmx:afterProcessNode"}function w(e,t){te(Tr(e),function(e){try{t(e)}catch(e){x(e)}})}function x(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function oe(e,t,r){e=s(e);if(r==null){r={}}r["elt"]=e;var n=Pt(t,r);if(G.logger&&!kt(t)){G.logger(e,t,r)}if(r.error){x(r.error);oe(e,"htmx:error",{errorInfo:r})}var i=e.dispatchEvent(n);var a=It(t);if(i&&a!==t){var o=Pt(a,n.detail);i=i&&e.dispatchEvent(o)}w(e,function(e){i=i&&e.onEvent(t,n)!==false});return i}var Mt=location.pathname+location.search;function Dt(){var e=K().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||K().body}function Xt(e,t,r,n){if(!M()){return}e=D(e);var i=y(localStorage.getItem("htmx-history-cache"))||[];for(var a=0;a<i.length;a++){if(i[a].url===e){i.splice(a,1);break}}var o={url:e,content:t,title:r,scroll:n};oe(K().body,"htmx:historyItemCreated",{item:o,cache:i});i.push(o);while(i.length>G.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){ae(K().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Ft(e){if(!M()){return null}e=D(e);var t=y(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r<t.length;r++){if(t[r].url===e){return t[r]}}return null}function Ut(e){var t=G.config.requestClass;var r=e.cloneNode(true);te(f(r,"."+t),function(e){n(e,t)});return r.innerHTML}function Bt(){var e=Dt();var t=Mt||location.pathname+location.search;var r=K().querySelector('[hx-history="false" i],[data-hx-history="false" i]');if(!r){oe(K().body,"htmx:beforeHistorySave",{path:t,historyElt:e});Xt(t,Ut(e),K().title,window.scrollY)}if(G.config.historyEnabled)history.replaceState({htmx:true},K().title,window.location.href)}function Vt(e){if(G.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(e.endsWith("&")||e.endsWith("?")){e=e.slice(0,-1)}}if(G.config.historyEnabled){history.pushState({htmx:true},"",e)}Mt=e}function jt(e){if(G.config.historyEnabled)history.replaceState({htmx:true},"",e);Mt=e}function Wt(e){te(e,function(e){e.call()})}function _t(a){var e=new XMLHttpRequest;var o={path:a,xhr:e};oe(K().body,"htmx:historyCacheMiss",o);e.open("GET",a,true);e.setRequestHeader("HX-History-Restore-Request","true");e.onload=function(){if(this.status>=200&&this.status<400){oe(K().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Dt();var r=S(t);var n=Me(this.response);if(n){var i=b("title");if(i){i.innerHTML=n}else{window.document.title=n}}Ie(t,e,r);Wt(r.tasks);Mt=a;oe(K().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{ae(K().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function zt(e){Bt();e=e||location.pathname+location.search;var t=Ft(e);if(t){var r=l(t.content);var n=Dt();var i=S(n);Ie(n,r,i);Wt(i.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);Mt=e;oe(K().body,"htmx:historyRestore",{path:e,item:t})}else{if(G.config.refreshOnHistoryMiss){window.location.reload(true)}else{_t(e)}}}function $t(e){var t=ce(e,"hx-indicator");if(t==null){t=[e]}te(t,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,G.config.requestClass)});return t}function Gt(e){te(e,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,G.config.requestClass)}})}function Jt(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.isSameNode(t)){return true}}return false}function Zt(e){if(e.name===""||e.name==null||e.disabled){return false}if(e.type==="button"||e.type==="submit"||e.tagName==="image"||e.tagName==="reset"||e.tagName==="file"){return false}if(e.type==="checkbox"||e.type==="radio"){return e.checked}return true}function Kt(e,t,r){if(e!=null&&t!=null){var n=r[e];if(n===undefined){r[e]=t}else if(Array.isArray(n)){if(Array.isArray(t)){r[e]=n.concat(t)}else{n.push(t)}}else{if(Array.isArray(t)){r[e]=[n].concat(t)}else{r[e]=[n,t]}}}}function Yt(t,r,n,e,i){if(e==null||Jt(t,e)){return}else{t.push(e)}if(Zt(e)){var a=J(e,"name");var o=e.value;if(e.multiple){o=I(e.querySelectorAll("option:checked")).map(function(e){return e.value})}if(e.files){o=I(e.files)}Kt(a,o,r);if(i){Qt(e,n)}}if(h(e,"form")){var s=e.elements;te(s,function(e){Yt(t,r,n,e,i)})}}function Qt(e,t){if(e.willValidate){oe(e,"htmx:validation:validate");if(!e.checkValidity()){t.push({elt:e,message:e.validationMessage,validity:e.validity});oe(e,"htmx:validation:failed",{message:e.validationMessage,validity:e.validity})}}}function er(e,t){var r=[];var n={};var i={};var a=[];var o=ee(e);var s=h(e,"form")&&e.noValidate!==true||Z(e,"hx-validate")==="true";if(o.lastButtonClicked){s=s&&o.lastButtonClicked.formNoValidate!==true}if(t!=="get"){Yt(r,i,a,d(e,"form"),s)}Yt(r,n,a,e,s);if(o.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&J(e,"type")==="submit"){var l=o.lastButtonClicked||e;var u=J(l,"name");Kt(u,l.value,i)}var f=ce(e,"hx-include");te(f,function(e){Yt(r,n,a,e,s);if(!h(e,"form")){te(e.querySelectorAll($e),function(e){Yt(r,n,a,e,s)})}});n=ne(n,i);return{errors:a,values:n}}function tr(e,t,r){if(e!==""){e+="&"}if(String(r)==="[object Object]"){r=JSON.stringify(r)}var n=encodeURIComponent(r);e+=encodeURIComponent(t)+"="+n;return e}function rr(e){var t="";for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){te(n,function(e){t=tr(t,r,e)})}else{t=tr(t,r,n)}}}return t}function nr(e){var t=new FormData;for(var r in e){if(e.hasOwnProperty(r)){var n=e[r];if(Array.isArray(n)){te(n,function(e){t.append(r,e)})}else{t.append(r,n)}}}return t}function ir(e,t,r){var n={"HX-Request":"true","HX-Trigger":J(e,"id"),"HX-Trigger-Name":J(e,"name"),"HX-Target":Z(t,"id"),"HX-Current-URL":K().location.href};cr(e,"hx-headers",false,n);if(r!==undefined){n["HX-Prompt"]=r}if(ee(e).boosted){n["HX-Boosted"]="true"}return n}function ar(t,e){var r=Y(e,"hx-params");if(r){if(r==="none"){return{}}else if(r==="*"){return t}else if(r.indexOf("not ")===0){te(r.substr(4).split(","),function(e){e=e.trim();delete t[e]});return t}else{var n={};te(r.split(","),function(e){e=e.trim();n[e]=t[e]});return n}}else{return t}}function or(e){return J(e,"href")&&J(e,"href").indexOf("#")>=0}function sr(e,t){var r=t?t:Y(e,"hx-swap");var n={swapStyle:ee(e).boosted?"innerHTML":G.config.defaultSwapStyle,swapDelay:G.config.defaultSwapDelay,settleDelay:G.config.defaultSettleDelay};if(ee(e).boosted&&!or(e)){n["show"]="top"}if(r){var i=k(r);if(i.length>0){n["swapStyle"]=i[0];for(var a=1;a<i.length;a++){var o=i[a];if(o.indexOf("swap:")===0){n["swapDelay"]=v(o.substr(5))}if(o.indexOf("settle:")===0){n["settleDelay"]=v(o.substr(7))}if(o.indexOf("transition:")===0){n["transition"]=o.substr(11)==="true"}if(o.indexOf("scroll:")===0){var s=o.substr(7);var l=s.split(":");var u=l.pop();var f=l.length>0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}if(o.indexOf("focus-scroll:")===0){var d=o.substr("focus-scroll:".length);n["focusScroll"]=d=="true"}}}}return n}function lr(e){return Y(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&J(e,"enctype")==="multipart/form-data"}function ur(t,r,n){var i=null;w(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(lr(r)){return nr(n)}else{return rr(n)}}}function S(e){return{tasks:[],elts:[e]}}function fr(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ie(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ie(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:G.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:G.config.scrollBehavior})}}}function cr(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=Z(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=hr(e,function(){return Function("return ("+a+")")()},{})}else{s=y(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return cr(u(e),t,r,n)}function hr(e,t,r){if(G.config.allowEval){return t()}else{ae(e,"htmx:evalDisallowedError");return r}}function dr(e,t){return cr(e,"hx-vars",true,t)}function vr(e,t){return cr(e,"hx-vals",false,t)}function gr(e){return ne(dr(e),vr(e))}function pr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function mr(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ae(K().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function E(e,t){return e.getAllResponseHeaders().match(t)}function xr(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||L(r,"String")){return se(e,t,null,null,{targetOverride:s(r),returnPromise:true})}else{return se(e,t,s(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:s(r.target),swapOverride:r.swap,returnPromise:true})}}else{return se(e,t,null,null,{returnPromise:true})}}function yr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function br(e,t,r){var n=new URL(t,document.location.href);var i=document.location.origin;var a=i===n.origin;if(G.config.selfRequestsOnly){if(!a){return false}}return oe(e,"htmx:validateUrl",ne({url:n,sameHost:a},r))}function se(e,t,n,r,i,M){var a=null;var o=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var s=new Promise(function(e,t){a=e;o=t})}if(n==null){n=K().body}var D=i.handler||Sr;if(!re(n)){return}var l=i.targetOverride||de(n);if(l==null||l==fe){ae(n,"htmx:targetError",{target:Z(n,"hx-target")});return}if(!M){var X=function(){return se(e,t,n,r,i,true)};var F={target:l,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:X};if(oe(n,"htmx:confirm",F)===false){return}}var u=n;var f=ee(n);var c=Y(n,"hx-sync");var h=null;var d=false;if(c){var v=c.split(":");var g=v[0].trim();if(g==="this"){u=he(n,"hx-sync")}else{u=ie(n,g)}c=(v[1]||"drop").trim();f=ee(u);if(c==="drop"&&f.xhr&&f.abortable!==true){return}else if(c==="abort"){if(f.xhr){return}else{d=true}}else if(c==="replace"){oe(u,"htmx:abort")}else if(c.indexOf("queue")===0){var U=c.split(" ");h=(U[1]||"last").trim()}}if(f.xhr){if(f.abortable){oe(u,"htmx:abort")}else{if(h==null){if(r){var p=ee(r);if(p&&p.triggerSpec&&p.triggerSpec.queue){h=p.triggerSpec.queue}}if(h==null){h="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(h==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="all"){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){se(e,t,n,r,i)})}return}}var m=new XMLHttpRequest;f.xhr=m;f.abortable=d;var x=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var y=Y(n,"hx-prompt");if(y){var b=prompt(y);if(b===null||!oe(n,"htmx:prompt",{prompt:b,target:l})){Q(a);x();return s}}var w=Y(n,"hx-confirm");if(w){if(!confirm(w)){Q(a);x();return s}}var S=ir(n,l,b);if(i.headers){S=ne(S,i.headers)}var E=er(n,e);var C=E.errors;var R=E.values;if(i.values){R=ne(R,i.values)}var B=gr(n);var O=ne(R,B);var T=ar(O,n);if(e!=="get"&&!lr(n)){S["Content-Type"]="application/x-www-form-urlencoded"}if(G.config.getCacheBusterParam&&e==="get"){T["org.htmx.cache-buster"]=J(l,"id")||"true"}if(t==null||t===""){t=K().location.href}var q=cr(n,"hx-request");var V=ee(n).boosted;var H=G.config.methodsThatUseUrlParams.indexOf(e)>=0;var L={boosted:V,useUrlParams:H,parameters:T,unfilteredParameters:O,headers:S,target:l,verb:e,errors:C,withCredentials:i.credentials||q.credentials||G.config.withCredentials,timeout:i.timeout||q.timeout||G.config.timeout,path:t,triggeringEvent:r};if(!oe(n,"htmx:configRequest",L)){Q(a);x();return s}t=L.path;e=L.verb;S=L.headers;T=L.parameters;C=L.errors;H=L.useUrlParams;if(C&&C.length>0){oe(n,"htmx:validation:halted",L);Q(a);x();return s}var j=t.split("#");var W=j[0];var A=j[1];var N=t;if(H){N=W;var _=Object.keys(T).length!==0;if(_){if(N.indexOf("?")<0){N+="?"}else{N+="&"}N+=rr(T);if(A){N+="#"+A}}}if(!br(n,N,L)){ae(n,"htmx:invalidPath",L);return}m.open(e.toUpperCase(),N,true);m.overrideMimeType("text/html");m.withCredentials=L.withCredentials;m.timeout=L.timeout;if(q.noHeaders){}else{for(var I in S){if(S.hasOwnProperty(I)){var z=S[I];pr(m,I,z)}}}var P={xhr:m,target:l,requestConfig:L,etc:i,boosted:V,pathInfo:{requestPath:t,finalRequestPath:N,anchor:A}};m.onload=function(){try{var e=yr(n);P.pathInfo.responsePath=mr(m);D(n,P);Gt(k);oe(n,"htmx:afterRequest",P);oe(n,"htmx:afterOnLoad",P);if(!re(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(re(r)){t=r}}if(t){oe(t,"htmx:afterRequest",P);oe(t,"htmx:afterOnLoad",P)}}Q(a);x()}catch(e){ae(n,"htmx:onLoadError",ne({error:e},P));throw e}};m.onerror=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:sendError",P);Q(o);x()};m.onabort=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:sendAbort",P);Q(o);x()};m.ontimeout=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:timeout",P);Q(o);x()};if(!oe(n,"htmx:beforeRequest",P)){Q(a);x();return s}var k=$t(n);te(["loadstart","loadend","progress","abort"],function(t){te([m,m.upload],function(e){e.addEventListener(t,function(e){oe(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});oe(n,"htmx:beforeSend",P);var $=H?null:ur(m,n,T);m.send($);return s}function wr(e,t){var r=t.xhr;var n=null;var i=null;if(E(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(E(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(E(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=Y(e,"hx-push-url");var l=Y(e,"hx-replace-url");var u=ee(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function Sr(l,u){var f=u.xhr;var c=u.target;var e=u.etc;if(!oe(l,"htmx:beforeOnLoad",u))return;if(E(f,/HX-Trigger:/i)){Xe(f,"HX-Trigger",l)}if(E(f,/HX-Location:/i)){Bt();var t=f.getResponseHeader("HX-Location");var h;if(t.indexOf("{")===0){h=y(t);t=h["path"];delete h["path"]}xr("GET",t,h).then(function(){Vt(t)});return}if(E(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");return}if(E(f,/HX-Refresh:/i)){if("true"===f.getResponseHeader("HX-Refresh")){location.reload();return}}if(E(f,/HX-Retarget:/i)){u.target=K().querySelector(f.getResponseHeader("HX-Retarget"))}var d=wr(l,u);var r=f.status>=200&&f.status<400&&f.status!==204;var v=f.response;var n=f.status>=400;var i=ne({shouldSwap:r,serverResponse:v,isError:n},u);if(!oe(c,"htmx:beforeSwap",i))return;c=i.target;v=i.serverResponse;n=i.isError;u.target=c;u.failed=n;u.successful=!n;if(i.shouldSwap){if(f.status===286){Je(l)}w(l,function(e){v=e.transformResponse(v,f,l)});if(d.type){Bt()}var a=e.swapOverride;if(E(f,/HX-Reswap:/i)){a=f.getResponseHeader("HX-Reswap")}var h=sr(l,a);c.classList.add(G.config.swappingClass);var g=null;var p=null;var o=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var r;if(E(f,/HX-Reselect:/i)){r=f.getResponseHeader("HX-Reselect")}var n=S(c);De(h.swapStyle,c,l,v,n,r);if(t.elt&&!re(t.elt)&&J(t.elt,"id")){var i=document.getElementById(J(t.elt,"id"));var a={preventScroll:h.focusScroll!==undefined?!h.focusScroll:!G.config.defaultFocusScroll};if(i){if(t.start&&i.setSelectionRange){try{i.setSelectionRange(t.start,t.end)}catch(e){}}i.focus(a)}}c.classList.remove(G.config.swappingClass);te(n.elts,function(e){if(e.classList){e.classList.add(G.config.settlingClass)}oe(e,"htmx:afterSwap",u)});if(E(f,/HX-Trigger-After-Swap:/i)){var o=l;if(!re(l)){o=K().body}Xe(f,"HX-Trigger-After-Swap",o)}var s=function(){te(n.tasks,function(e){e.call()});te(n.elts,function(e){if(e.classList){e.classList.remove(G.config.settlingClass)}oe(e,"htmx:afterSettle",u)});if(d.type){if(d.type==="push"){Vt(d.path);oe(K().body,"htmx:pushedIntoHistory",{path:d.path})}else{jt(d.path);oe(K().body,"htmx:replacedInHistory",{path:d.path})}}if(u.pathInfo.anchor){var e=b("#"+u.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title){var t=b("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}fr(n.elts,h);if(E(f,/HX-Trigger-After-Settle:/i)){var r=l;if(!re(l)){r=K().body}Xe(f,"HX-Trigger-After-Settle",r)}Q(g)};if(h.settleDelay>0){setTimeout(s,h.settleDelay)}else{s()}}catch(e){ae(l,"htmx:swapError",u);Q(p);throw e}};var s=G.config.globalViewTransitions;if(h.hasOwnProperty("transition")){s=h.transition}if(s&&oe(l,"htmx:beforeTransition",u)&&typeof Promise!=="undefined"&&document.startViewTransition){var m=new Promise(function(e,t){g=e;p=t});var x=o;o=function(){document.startViewTransition(function(){x();return m})}}if(h.swapDelay>0){setTimeout(o,h.swapDelay)}else{o()}}if(n){ae(l,"htmx:responseError",ne({error:"Response Status Error Code "+f.status+" from "+u.pathInfo.requestPath},u))}}var Er={};function Cr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Rr(e,t){if(t.init){t.init(C)}Er[e]=ne(Cr(),t)}function Or(e){delete Er[e]}function Tr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=Z(e,"hx-ext");if(t){te(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=Er[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return Tr(u(e),r,n)}var qr=false;K().addEventListener("DOMContentLoaded",function(){qr=true});function Hr(e){if(qr||K().readyState==="complete"){e()}else{K().addEventListener("DOMContentLoaded",e)}}function Lr(){if(G.config.includeIndicatorStyles!==false){K().head.insertAdjacentHTML("beforeend","<style> ."+G.config.indicatorClass+"{opacity:0;transition: opacity 200ms ease-in;} ."+G.config.requestClass+" ."+G.config.indicatorClass+"{opacity:1} ."+G.config.requestClass+"."+G.config.indicatorClass+"{opacity:1} </style>")}}function Ar(){var e=K().querySelector('meta[name="htmx-config"]');if(e){return y(e.content)}else{return null}}function Nr(){var e=Ar();if(e){G.config=ne(G.config,e)}}Hr(function(){Nr();Lr();var e=K().body;Nt(e);var t=K().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=ee(t);if(r&&r.xhr){r.xhr.abort()}});var r=window.onpopstate;window.onpopstate=function(e){if(e.state&&e.state.htmx){zt();te(t,function(e){oe(e,"htmx:restored",{document:K(),triggerEvent:oe})})}else{if(r){r(e)}}};setTimeout(function(){oe(e,"htmx:load",{});e=null},0)});return G}()});
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "AJAX",
6
6
  "HTML"
7
7
  ],
8
- "version": "1.9.3",
8
+ "version": "1.9.5",
9
9
  "homepage": "https://htmx.org/",
10
10
  "bugs": {
11
11
  "url": "https://github.com/bigskysoftware/htmx/issues"
@@ -24,9 +24,6 @@
24
24
  "types": "dist/htmx.d.ts",
25
25
  "unpkg": "dist/htmx.min.js",
26
26
  "web-types": "editors/jetbrains/htmx.web-types.json",
27
- "engines": {
28
- "node": "15.x"
29
- },
30
27
  "scripts": {
31
28
  "test": "mocha-chrome test/index.html",
32
29
  "test-types": "tsc --project ./jsconfig.json",