@cloudflare/ai-search-snippet 0.0.29 → 0.0.30

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.
@@ -15,12 +15,12 @@ const u = [
15
15
  ];
16
16
  function A(o, i) {
17
17
  let e;
18
- return function(...s) {
19
- const r = () => {
20
- clearTimeout(e), o(...s);
21
- };
22
- clearTimeout(e), e = setTimeout(r, i);
23
- };
18
+ function t(...s) {
19
+ clearTimeout(e), e = setTimeout(() => {
20
+ o(...s);
21
+ }, i);
22
+ }
23
+ return t.cancel = () => clearTimeout(e), t;
24
24
  }
25
25
  function h(o) {
26
26
  const i = document.createElement("div");
@@ -3348,7 +3348,7 @@ ${X}`;
3348
3348
  attachEventListeners() {
3349
3349
  !this.inputElement || !this.backdrop || (this.handleInputChange = (e) => {
3350
3350
  const s = e.target.value.trim();
3351
- s.length > 0 && this.debouncedSearch ? this.debouncedSearch(s) : (this.results = [], this.activeIndex = -1, this.showEmptyState());
3351
+ s.length > 0 && this.debouncedSearch ? this.debouncedSearch(s) : (this.debouncedSearch?.cancel(), this.currentSearchController?.abort(), this.results = [], this.activeIndex = -1, this.showEmptyState());
3352
3352
  }, this.inputElement.addEventListener("input", this.handleInputChange), this.handleInputKeydown = (e) => {
3353
3353
  switch (e.key) {
3354
3354
  case "ArrowDown":