@untemps/react-vocal 2.0.0-beta.3 → 2.0.0-beta.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 +19 -0
- package/README.md +28 -15
- package/dev/src/index.jsx +39 -26
- package/dist/index.es.js +172 -1297
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -3
- package/src/components/Vocal.jsx +25 -9
- package/src/components/__tests__/Vocal.test.jsx +144 -9
- package/src/hooks/__tests__/useCommands.test.js +53 -2
- package/src/hooks/__tests__/useVocal.test.js +6 -1
- package/src/hooks/useCommands.js +63 -9
- package/src/hooks/useVocal.js +3 -3
- package/vite.config.js +2 -1
- package/vitest.setup.js +3 -0
package/dist/index.es.js
CHANGED
|
@@ -427,7 +427,7 @@ function D(e, t) {
|
|
|
427
427
|
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
428
428
|
return r;
|
|
429
429
|
}
|
|
430
|
-
var
|
|
430
|
+
var O = function() {
|
|
431
431
|
var e = T(regeneratorRuntime.mark((function e(t) {
|
|
432
432
|
return regeneratorRuntime.wrap((function(e) {
|
|
433
433
|
for (;;) switch (e.prev = e.next) {
|
|
@@ -439,8 +439,8 @@ var ee = function() {
|
|
|
439
439
|
case 0: return S() || r(new DOMException("Navigator API: permissions not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.next = 4, navigator.permissions.query({ name: t });
|
|
440
440
|
case 4:
|
|
441
441
|
i = e.sent, a = function e(t) {
|
|
442
|
-
i.removeEventListener("change", e),
|
|
443
|
-
}, i.addEventListener("change", a),
|
|
442
|
+
i.removeEventListener("change", e), k(t.target.state, n, r);
|
|
443
|
+
}, i.addEventListener("change", a), k(i.state, n, r), e.next = 13;
|
|
444
444
|
break;
|
|
445
445
|
case 10: e.prev = 10, e.t0 = e.catch(1), r(e.t0);
|
|
446
446
|
case 13:
|
|
@@ -460,14 +460,14 @@ var ee = function() {
|
|
|
460
460
|
return function(t) {
|
|
461
461
|
return e.apply(this, arguments);
|
|
462
462
|
};
|
|
463
|
-
}(),
|
|
463
|
+
}(), k = function(e, t, n) {
|
|
464
464
|
switch (e) {
|
|
465
465
|
case "denied":
|
|
466
466
|
n(new DOMException("Permission denied", "NOT_ALLOWED_ERR"));
|
|
467
467
|
break;
|
|
468
468
|
default: t(e);
|
|
469
469
|
}
|
|
470
|
-
},
|
|
470
|
+
}, A = function() {
|
|
471
471
|
var e = T(regeneratorRuntime.mark((function e(t, n) {
|
|
472
472
|
return regeneratorRuntime.wrap((function(e) {
|
|
473
473
|
for (;;) switch (e.prev = e.next) {
|
|
@@ -476,7 +476,7 @@ var ee = function() {
|
|
|
476
476
|
var a, o, s;
|
|
477
477
|
return regeneratorRuntime.wrap((function(e) {
|
|
478
478
|
for (;;) switch (e.prev = e.next) {
|
|
479
|
-
case 0: return S() && C() || i(new DOMException("Navigator API: permissions or Navigator API: mediaDevices not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.t0 = Promise, e.next = 5,
|
|
479
|
+
case 0: return S() && C() || i(new DOMException("Navigator API: permissions or Navigator API: mediaDevices not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.t0 = Promise, e.next = 5, O(t);
|
|
480
480
|
case 5: return e.t1 = e.sent, e.next = 8, navigator.mediaDevices.getUserMedia(n);
|
|
481
481
|
case 8: return e.t2 = e.sent, e.t3 = [e.t1, e.t2], e.next = 12, e.t0.all.call(e.t0, e.t3);
|
|
482
482
|
case 12:
|
|
@@ -501,7 +501,7 @@ var ee = function() {
|
|
|
501
501
|
return e.apply(this, arguments);
|
|
502
502
|
};
|
|
503
503
|
}();
|
|
504
|
-
function
|
|
504
|
+
function j(e, t) {
|
|
505
505
|
var n = Object.keys(e);
|
|
506
506
|
if (Object.getOwnPropertySymbols) {
|
|
507
507
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -511,24 +511,24 @@ function A(e, t) {
|
|
|
511
511
|
}
|
|
512
512
|
return n;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function M(e) {
|
|
515
515
|
for (var t = 1; t < arguments.length; t++) {
|
|
516
516
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
517
|
-
t % 2 ?
|
|
517
|
+
t % 2 ? j(Object(n), !0).forEach((function(t) {
|
|
518
518
|
x(e, t, n[t]);
|
|
519
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
519
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : j(Object(n)).forEach((function(t) {
|
|
520
520
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
521
521
|
}));
|
|
522
522
|
}
|
|
523
523
|
return e;
|
|
524
524
|
}
|
|
525
|
-
var
|
|
525
|
+
var N = function() {
|
|
526
526
|
function e(t) {
|
|
527
527
|
var n = this;
|
|
528
528
|
v(this, e), x(this, "_instance", null), x(this, "_listeners", null);
|
|
529
529
|
var r = e._resolveSpeechRecognition();
|
|
530
530
|
if (!r) throw new DOMException("SpeechRecognition not supported", "NOT_SUPPORTED_ERR");
|
|
531
|
-
this._instance = new r(), this._listeners = {}, Object.entries(
|
|
531
|
+
this._instance = new r(), this._listeners = {}, Object.entries(M(M({}, e.defaultOptions), t || {})).forEach((function(t) {
|
|
532
532
|
var r = _(t, 2), i = r[0], a = r[1];
|
|
533
533
|
if (i === "grammars" && !a) {
|
|
534
534
|
var o = e._resolveSpeechGrammarList();
|
|
@@ -558,7 +558,7 @@ var M = function() {
|
|
|
558
558
|
e.next = 14;
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
|
-
return e.prev = 1, e.next = 4,
|
|
561
|
+
return e.prev = 1, e.next = 4, A("microphone", { audio: !0 });
|
|
562
562
|
case 4:
|
|
563
563
|
if (e.sent) {
|
|
564
564
|
e.next = 7;
|
|
@@ -650,14 +650,14 @@ var M = function() {
|
|
|
650
650
|
}
|
|
651
651
|
}]), e;
|
|
652
652
|
}();
|
|
653
|
-
x(
|
|
653
|
+
x(N, "defaultOptions", {
|
|
654
654
|
grammars: null,
|
|
655
655
|
lang: "en-US",
|
|
656
656
|
continuous: !1,
|
|
657
657
|
interimResults: !1,
|
|
658
658
|
maxAlternatives: 1,
|
|
659
659
|
serviceURI: null
|
|
660
|
-
}), x(
|
|
660
|
+
}), x(N, "eventTypes", {
|
|
661
661
|
AUDIO_END: "audioend",
|
|
662
662
|
AUDIO_START: "audiostart",
|
|
663
663
|
END: "end",
|
|
@@ -672,40 +672,42 @@ x(M, "defaultOptions", {
|
|
|
672
672
|
});
|
|
673
673
|
//#endregion
|
|
674
674
|
//#region node_modules/@untemps/utils/dist/function/isFunction.js
|
|
675
|
-
var
|
|
676
|
-
let
|
|
675
|
+
var P = (e) => typeof e == "function", F = (e = "en-US", t = null, i = 1, o = null) => {
|
|
676
|
+
let s = a(null);
|
|
677
677
|
return r(() => {
|
|
678
|
-
if (
|
|
678
|
+
if (N.isSupported) return s.current = o || new N({
|
|
679
679
|
lang: e,
|
|
680
|
-
grammars: t
|
|
680
|
+
grammars: t,
|
|
681
|
+
maxAlternatives: i
|
|
681
682
|
}), () => {
|
|
682
|
-
|
|
683
|
+
s.current.abort(), s.current.cleanup();
|
|
683
684
|
};
|
|
684
685
|
}, [
|
|
685
686
|
e,
|
|
686
687
|
t,
|
|
687
|
-
i
|
|
688
|
-
|
|
688
|
+
i,
|
|
689
|
+
o
|
|
690
|
+
]), [s, {
|
|
689
691
|
start: n(() => {
|
|
690
|
-
|
|
692
|
+
s.current && s.current.start();
|
|
691
693
|
}, []),
|
|
692
694
|
stop: n(() => {
|
|
693
|
-
|
|
695
|
+
s.current && s.current.stop();
|
|
694
696
|
}, []),
|
|
695
697
|
abort: n(() => {
|
|
696
|
-
|
|
698
|
+
s.current && s.current.abort();
|
|
697
699
|
}, []),
|
|
698
700
|
subscribe: n((e, t) => {
|
|
699
|
-
|
|
701
|
+
s.current && s.current.addEventListener(e, t);
|
|
700
702
|
}, []),
|
|
701
703
|
unsubscribe: n((e, t) => {
|
|
702
|
-
|
|
704
|
+
s.current && s.current.removeEventListener(e, t);
|
|
703
705
|
}, []),
|
|
704
706
|
clean: n(() => {
|
|
705
|
-
|
|
707
|
+
s.current && s.current.cleanup();
|
|
706
708
|
}, [])
|
|
707
709
|
}];
|
|
708
|
-
},
|
|
710
|
+
}, I = (e, t = 0) => {
|
|
709
711
|
let i = a(-1), o = n(() => {
|
|
710
712
|
clearTimeout(i.current), i.current = -1;
|
|
711
713
|
}, []), s = n(() => {
|
|
@@ -716,1180 +718,45 @@ var te = (e) => typeof e == "function", N = (e = "en-US", t = null, i = null) =>
|
|
|
716
718
|
o
|
|
717
719
|
]);
|
|
718
720
|
return r(() => o, [o]), [s, o];
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
let t = e + "";
|
|
729
|
-
return t == "0" && 1 / e == -Infinity ? "-0" : t;
|
|
730
|
-
}
|
|
731
|
-
function I(e) {
|
|
732
|
-
return e == null ? "" : F(e);
|
|
733
|
-
}
|
|
734
|
-
function L(e) {
|
|
735
|
-
return typeof e == "string";
|
|
736
|
-
}
|
|
737
|
-
function R(e) {
|
|
738
|
-
return typeof e == "number";
|
|
739
|
-
}
|
|
740
|
-
function re(e) {
|
|
741
|
-
return e === !0 || e === !1 || ie(e) && H(e) == "[object Boolean]";
|
|
742
|
-
}
|
|
743
|
-
function z(e) {
|
|
744
|
-
return typeof e == "object";
|
|
745
|
-
}
|
|
746
|
-
function ie(e) {
|
|
747
|
-
return z(e) && e !== null;
|
|
748
|
-
}
|
|
749
|
-
function B(e) {
|
|
750
|
-
return e != null;
|
|
751
|
-
}
|
|
752
|
-
function V(e) {
|
|
753
|
-
return !e.trim().length;
|
|
754
|
-
}
|
|
755
|
-
function H(e) {
|
|
756
|
-
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
|
757
|
-
}
|
|
758
|
-
var U = "Incorrect 'index' type", W = (e) => `Invalid value for key ${e}`, G = (e) => `Pattern length exceeds max of ${e}.`, ae = (e) => `Missing ${e} property in key`, oe = (e) => `Property 'weight' in key '${e}' must be a positive integer`, se = Object.prototype.hasOwnProperty, ce = class {
|
|
759
|
-
constructor(e) {
|
|
760
|
-
this._keys = [], this._keyMap = {};
|
|
761
|
-
let t = 0;
|
|
762
|
-
e.forEach((e) => {
|
|
763
|
-
let n = le(e);
|
|
764
|
-
this._keys.push(n), this._keyMap[n.id] = n, t += n.weight;
|
|
765
|
-
}), this._keys.forEach((e) => {
|
|
766
|
-
e.weight /= t;
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
get(e) {
|
|
770
|
-
return this._keyMap[e];
|
|
771
|
-
}
|
|
772
|
-
keys() {
|
|
773
|
-
return this._keys;
|
|
774
|
-
}
|
|
775
|
-
toJSON() {
|
|
776
|
-
return JSON.stringify(this._keys);
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
function le(e) {
|
|
780
|
-
let t = null, n = null, r = null, i = 1, a = null;
|
|
781
|
-
if (L(e) || P(e)) r = e, t = ue(e), n = de(e);
|
|
782
|
-
else {
|
|
783
|
-
if (!se.call(e, "name")) throw Error(ae("name"));
|
|
784
|
-
let o = e.name;
|
|
785
|
-
if (r = o, se.call(e, "weight") && (i = e.weight, i <= 0)) throw Error(oe(o));
|
|
786
|
-
t = ue(o), n = de(o), a = e.getFn;
|
|
787
|
-
}
|
|
788
|
-
return {
|
|
789
|
-
path: t,
|
|
790
|
-
id: n,
|
|
791
|
-
weight: i,
|
|
792
|
-
src: r,
|
|
793
|
-
getFn: a
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
function ue(e) {
|
|
797
|
-
return P(e) ? e : e.split(".");
|
|
798
|
-
}
|
|
799
|
-
function de(e) {
|
|
800
|
-
return P(e) ? e.join(".") : e;
|
|
801
|
-
}
|
|
802
|
-
function fe(e, t) {
|
|
803
|
-
let n = [], r = !1, i = (e, t, a, o) => {
|
|
804
|
-
if (B(e)) if (!t[a]) n.push(o === void 0 ? e : {
|
|
805
|
-
v: e,
|
|
806
|
-
i: o
|
|
807
|
-
});
|
|
808
|
-
else {
|
|
809
|
-
let s = e[t[a]];
|
|
810
|
-
if (!B(s)) return;
|
|
811
|
-
if (a === t.length - 1 && (L(s) || R(s) || re(s) || typeof s == "bigint")) n.push(o === void 0 ? I(s) : {
|
|
812
|
-
v: I(s),
|
|
813
|
-
i: o
|
|
814
|
-
});
|
|
815
|
-
else if (P(s)) {
|
|
816
|
-
r = !0;
|
|
817
|
-
for (let e = 0, n = s.length; e < n; e += 1) i(s[e], t, a + 1, e);
|
|
818
|
-
} else t.length && i(s, t, a + 1, o);
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
return i(e, L(t) ? t.split(".") : t, 0), r ? n : n[0];
|
|
822
|
-
}
|
|
823
|
-
var pe = {
|
|
824
|
-
includeMatches: !1,
|
|
825
|
-
findAllMatches: !1,
|
|
826
|
-
minMatchCharLength: 1
|
|
827
|
-
}, me = {
|
|
828
|
-
isCaseSensitive: !1,
|
|
829
|
-
ignoreDiacritics: !1,
|
|
830
|
-
includeScore: !1,
|
|
831
|
-
keys: [],
|
|
832
|
-
shouldSort: !0,
|
|
833
|
-
sortFn: (e, t) => e.score === t.score ? e.idx < t.idx ? -1 : 1 : e.score < t.score ? -1 : 1
|
|
834
|
-
}, he = {
|
|
835
|
-
location: 0,
|
|
836
|
-
threshold: .6,
|
|
837
|
-
distance: 100
|
|
838
|
-
}, ge = {
|
|
839
|
-
useExtendedSearch: !1,
|
|
840
|
-
useTokenSearch: !1,
|
|
841
|
-
getFn: fe,
|
|
842
|
-
ignoreLocation: !1,
|
|
843
|
-
ignoreFieldNorm: !1,
|
|
844
|
-
fieldNormWeight: 1
|
|
845
|
-
}, K = Object.freeze({
|
|
846
|
-
...me,
|
|
847
|
-
...pe,
|
|
848
|
-
...he,
|
|
849
|
-
...ge
|
|
850
|
-
}), _e = /[^ ]+/g;
|
|
851
|
-
function ve(e = 1, t = 3) {
|
|
852
|
-
let n = /* @__PURE__ */ new Map(), r = 10 ** t;
|
|
853
|
-
return {
|
|
854
|
-
get(t) {
|
|
855
|
-
let i = t.match(_e).length;
|
|
856
|
-
if (n.has(i)) return n.get(i);
|
|
857
|
-
let a = 1 / i ** (.5 * e), o = parseFloat(Math.round(a * r) / r);
|
|
858
|
-
return n.set(i, o), o;
|
|
859
|
-
},
|
|
860
|
-
clear() {
|
|
861
|
-
n.clear();
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
var ye = class {
|
|
866
|
-
constructor({ getFn: e = K.getFn, fieldNormWeight: t = K.fieldNormWeight } = {}) {
|
|
867
|
-
this.norm = ve(t, 3), this.getFn = e, this.isCreated = !1, this.docs = [], this.keys = [], this._keysMap = {}, this.setIndexRecords();
|
|
868
|
-
}
|
|
869
|
-
setSources(e = []) {
|
|
870
|
-
this.docs = e;
|
|
871
|
-
}
|
|
872
|
-
setIndexRecords(e = []) {
|
|
873
|
-
this.records = e;
|
|
874
|
-
}
|
|
875
|
-
setKeys(e = []) {
|
|
876
|
-
this.keys = e, this._keysMap = {}, e.forEach((e, t) => {
|
|
877
|
-
this._keysMap[e.id] = t;
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
create() {
|
|
881
|
-
this.isCreated || !this.docs.length || (this.isCreated = !0, L(this.docs[0]) ? this.docs.forEach((e, t) => {
|
|
882
|
-
this._addString(e, t);
|
|
883
|
-
}) : this.docs.forEach((e, t) => {
|
|
884
|
-
this._addObject(e, t);
|
|
885
|
-
}), this.norm.clear());
|
|
886
|
-
}
|
|
887
|
-
add(e) {
|
|
888
|
-
let t = this.size();
|
|
889
|
-
L(e) ? this._addString(e, t) : this._addObject(e, t);
|
|
890
|
-
}
|
|
891
|
-
removeAt(e) {
|
|
892
|
-
this.records.splice(e, 1);
|
|
893
|
-
for (let t = e, n = this.size(); t < n; t += 1) --this.records[t].i;
|
|
894
|
-
}
|
|
895
|
-
removeAll(e) {
|
|
896
|
-
for (let t = e.length - 1; t >= 0; --t) this.records.splice(e[t], 1);
|
|
897
|
-
for (let e = 0, t = this.records.length; e < t; e += 1) this.records[e].i = e;
|
|
898
|
-
}
|
|
899
|
-
getValueForItemAtKeyId(e, t) {
|
|
900
|
-
return e[this._keysMap[t]];
|
|
901
|
-
}
|
|
902
|
-
size() {
|
|
903
|
-
return this.records.length;
|
|
904
|
-
}
|
|
905
|
-
_addString(e, t) {
|
|
906
|
-
if (!B(e) || V(e)) return;
|
|
907
|
-
let n = {
|
|
908
|
-
v: e,
|
|
909
|
-
i: t,
|
|
910
|
-
n: this.norm.get(e)
|
|
911
|
-
};
|
|
912
|
-
this.records.push(n);
|
|
913
|
-
}
|
|
914
|
-
_addObject(e, t) {
|
|
915
|
-
let n = {
|
|
916
|
-
i: t,
|
|
917
|
-
$: {}
|
|
918
|
-
};
|
|
919
|
-
this.keys.forEach((t, r) => {
|
|
920
|
-
let i = t.getFn ? t.getFn(e) : this.getFn(e, t.path);
|
|
921
|
-
if (B(i)) {
|
|
922
|
-
if (P(i)) {
|
|
923
|
-
let e = [];
|
|
924
|
-
for (let t = 0, n = i.length; t < n; t += 1) {
|
|
925
|
-
let n = i[t];
|
|
926
|
-
if (B(n)) {
|
|
927
|
-
if (L(n)) {
|
|
928
|
-
if (!V(n)) {
|
|
929
|
-
let r = {
|
|
930
|
-
v: n,
|
|
931
|
-
i: t,
|
|
932
|
-
n: this.norm.get(n)
|
|
933
|
-
};
|
|
934
|
-
e.push(r);
|
|
935
|
-
}
|
|
936
|
-
} else if (B(n.v)) {
|
|
937
|
-
let t = L(n.v) ? n.v : I(n.v);
|
|
938
|
-
if (!V(t)) {
|
|
939
|
-
let r = {
|
|
940
|
-
v: t,
|
|
941
|
-
i: n.i,
|
|
942
|
-
n: this.norm.get(t)
|
|
943
|
-
};
|
|
944
|
-
e.push(r);
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
n.$[r] = e;
|
|
950
|
-
} else if (L(i) && !V(i)) {
|
|
951
|
-
let e = {
|
|
952
|
-
v: i,
|
|
953
|
-
n: this.norm.get(i)
|
|
954
|
-
};
|
|
955
|
-
n.$[r] = e;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}), this.records.push(n);
|
|
959
|
-
}
|
|
960
|
-
toJSON() {
|
|
961
|
-
return {
|
|
962
|
-
keys: this.keys.map(({ getFn: e, ...t }) => t),
|
|
963
|
-
records: this.records
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
function be(e, t, { getFn: n = K.getFn, fieldNormWeight: r = K.fieldNormWeight } = {}) {
|
|
968
|
-
let i = new ye({
|
|
969
|
-
getFn: n,
|
|
970
|
-
fieldNormWeight: r
|
|
971
|
-
});
|
|
972
|
-
return i.setKeys(e.map(le)), i.setSources(t), i.create(), i;
|
|
973
|
-
}
|
|
974
|
-
function xe(e, { getFn: t = K.getFn, fieldNormWeight: n = K.fieldNormWeight } = {}) {
|
|
975
|
-
let { keys: r, records: i } = e, a = new ye({
|
|
976
|
-
getFn: t,
|
|
977
|
-
fieldNormWeight: n
|
|
978
|
-
});
|
|
979
|
-
return a.setKeys(r), a.setIndexRecords(i), a;
|
|
980
|
-
}
|
|
981
|
-
function Se(e = [], t = K.minMatchCharLength) {
|
|
982
|
-
let n = [], r = -1, i = -1, a = 0;
|
|
983
|
-
for (let o = e.length; a < o; a += 1) {
|
|
984
|
-
let o = e[a];
|
|
985
|
-
o && r === -1 ? r = a : !o && r !== -1 && (i = a - 1, i - r + 1 >= t && n.push([r, i]), r = -1);
|
|
986
|
-
}
|
|
987
|
-
return e[a - 1] && a - r >= t && n.push([r, a - 1]), n;
|
|
988
|
-
}
|
|
989
|
-
var q = 32;
|
|
990
|
-
function Ce(e, t, n, { location: r = K.location, distance: i = K.distance, threshold: a = K.threshold, findAllMatches: o = K.findAllMatches, minMatchCharLength: s = K.minMatchCharLength, includeMatches: c = K.includeMatches, ignoreLocation: l = K.ignoreLocation } = {}) {
|
|
991
|
-
if (t.length > q) throw Error(G(q));
|
|
992
|
-
let u = t.length, d = e.length, f = Math.max(0, Math.min(r, d)), p = a, m = f, h = (e, t) => {
|
|
993
|
-
let n = e / u;
|
|
994
|
-
if (l) return n;
|
|
995
|
-
let r = Math.abs(f - t);
|
|
996
|
-
return i ? n + r / i : r ? 1 : n;
|
|
997
|
-
}, g = s > 1 || c, _ = g ? Array(d) : [], v;
|
|
998
|
-
for (; (v = e.indexOf(t, m)) > -1;) {
|
|
999
|
-
let e = h(0, v);
|
|
1000
|
-
if (p = Math.min(e, p), m = v + u, g) {
|
|
1001
|
-
let e = 0;
|
|
1002
|
-
for (; e < u;) _[v + e] = 1, e += 1;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
m = -1;
|
|
1006
|
-
let y = [], b = 1, x = u + d, S = 1 << u - 1;
|
|
1007
|
-
for (let t = 0; t < u; t += 1) {
|
|
1008
|
-
let r = 0, i = x;
|
|
1009
|
-
for (; r < i;) h(t, f + i) <= p ? r = i : x = i, i = Math.floor((x - r) / 2 + r);
|
|
1010
|
-
x = i;
|
|
1011
|
-
let a = Math.max(1, f - i + 1), s = o ? d : Math.min(f + i, d) + u, c = Array(s + 2);
|
|
1012
|
-
c[s + 1] = (1 << t) - 1;
|
|
1013
|
-
for (let r = s; r >= a; --r) {
|
|
1014
|
-
let i = r - 1, o = n[e[i]];
|
|
1015
|
-
if (g && (_[i] = +!!o), c[r] = (c[r + 1] << 1 | 1) & o, t && (c[r] |= (y[r + 1] | y[r]) << 1 | 1 | y[r + 1]), c[r] & S && (b = h(t, i), b <= p)) {
|
|
1016
|
-
if (p = b, m = i, m <= f) break;
|
|
1017
|
-
a = Math.max(1, 2 * f - m);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
if (h(t + 1, f) > p) break;
|
|
1021
|
-
y = c;
|
|
1022
|
-
}
|
|
1023
|
-
let C = {
|
|
1024
|
-
isMatch: m >= 0,
|
|
1025
|
-
score: Math.max(.001, b)
|
|
1026
|
-
};
|
|
1027
|
-
if (g) {
|
|
1028
|
-
let e = Se(_, s);
|
|
1029
|
-
e.length ? c && (C.indices = e) : C.isMatch = !1;
|
|
1030
|
-
}
|
|
1031
|
-
return C;
|
|
1032
|
-
}
|
|
1033
|
-
function we(e) {
|
|
1034
|
-
let t = {};
|
|
1035
|
-
for (let n = 0, r = e.length; n < r; n += 1) {
|
|
1036
|
-
let i = e.charAt(n);
|
|
1037
|
-
t[i] = (t[i] || 0) | 1 << r - n - 1;
|
|
1038
|
-
}
|
|
1039
|
-
return t;
|
|
1040
|
-
}
|
|
1041
|
-
function Te(e) {
|
|
1042
|
-
if (e.length <= 1) return e;
|
|
1043
|
-
e.sort((e, t) => e[0] - t[0] || e[1] - t[1]);
|
|
1044
|
-
let t = [e[0]];
|
|
1045
|
-
for (let n = 1, r = e.length; n < r; n += 1) {
|
|
1046
|
-
let r = t[t.length - 1], i = e[n];
|
|
1047
|
-
i[0] <= r[1] + 1 ? r[1] = Math.max(r[1], i[1]) : t.push(i);
|
|
1048
|
-
}
|
|
1049
|
-
return t;
|
|
1050
|
-
}
|
|
1051
|
-
var Ee = {
|
|
1052
|
-
ł: "l",
|
|
1053
|
-
Ł: "L",
|
|
1054
|
-
đ: "d",
|
|
1055
|
-
Đ: "D",
|
|
1056
|
-
ø: "o",
|
|
1057
|
-
Ø: "O",
|
|
1058
|
-
ħ: "h",
|
|
1059
|
-
Ħ: "H",
|
|
1060
|
-
ŧ: "t",
|
|
1061
|
-
Ŧ: "T",
|
|
1062
|
-
ı: "i",
|
|
1063
|
-
ß: "ss"
|
|
1064
|
-
}, De = RegExp("[" + Object.keys(Ee).join("") + "]", "g"), J = String.prototype.normalize ? (e) => e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "").replace(De, (e) => Ee[e]) : (e) => e, Oe = class {
|
|
1065
|
-
constructor(e, { location: t = K.location, threshold: n = K.threshold, distance: r = K.distance, includeMatches: i = K.includeMatches, findAllMatches: a = K.findAllMatches, minMatchCharLength: o = K.minMatchCharLength, isCaseSensitive: s = K.isCaseSensitive, ignoreDiacritics: c = K.ignoreDiacritics, ignoreLocation: l = K.ignoreLocation } = {}) {
|
|
1066
|
-
if (this.options = {
|
|
1067
|
-
location: t,
|
|
1068
|
-
threshold: n,
|
|
1069
|
-
distance: r,
|
|
1070
|
-
includeMatches: i,
|
|
1071
|
-
findAllMatches: a,
|
|
1072
|
-
minMatchCharLength: o,
|
|
1073
|
-
isCaseSensitive: s,
|
|
1074
|
-
ignoreDiacritics: c,
|
|
1075
|
-
ignoreLocation: l
|
|
1076
|
-
}, e = s ? e : e.toLowerCase(), e = c ? J(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length) return;
|
|
1077
|
-
let u = (e, t) => {
|
|
1078
|
-
this.chunks.push({
|
|
1079
|
-
pattern: e,
|
|
1080
|
-
alphabet: we(e),
|
|
1081
|
-
startIndex: t
|
|
1082
|
-
});
|
|
1083
|
-
}, d = this.pattern.length;
|
|
1084
|
-
if (d > q) {
|
|
1085
|
-
let e = 0, t = d % q, n = d - t;
|
|
1086
|
-
for (; e < n;) u(this.pattern.substr(e, q), e), e += q;
|
|
1087
|
-
if (t) {
|
|
1088
|
-
let e = d - q;
|
|
1089
|
-
u(this.pattern.substr(e), e);
|
|
1090
|
-
}
|
|
1091
|
-
} else u(this.pattern, 0);
|
|
1092
|
-
}
|
|
1093
|
-
searchIn(e) {
|
|
1094
|
-
let { isCaseSensitive: t, ignoreDiacritics: n, includeMatches: r } = this.options;
|
|
1095
|
-
if (e = t ? e : e.toLowerCase(), e = n ? J(e) : e, this.pattern === e) {
|
|
1096
|
-
let t = {
|
|
1097
|
-
isMatch: !0,
|
|
1098
|
-
score: 0
|
|
1099
|
-
};
|
|
1100
|
-
return r && (t.indices = [[0, e.length - 1]]), t;
|
|
721
|
+
}, L = (e, t = .4) => {
|
|
722
|
+
let n = i(() => e ? Object.entries(e).reduce((e, [t, n]) => ({
|
|
723
|
+
...e,
|
|
724
|
+
[t.toLowerCase()]: n
|
|
725
|
+
}), {}) : {}, [e]), o = i(() => Object.keys(n), [n]), s = i(() => o.some((e) => e.includes(" ")), [o]), c = a(null);
|
|
726
|
+
return r(() => {
|
|
727
|
+
if (!s) {
|
|
728
|
+
c.current = null;
|
|
729
|
+
return;
|
|
1101
730
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
distance: a,
|
|
1107
|
-
threshold: o,
|
|
1108
|
-
findAllMatches: s,
|
|
1109
|
-
minMatchCharLength: c,
|
|
1110
|
-
includeMatches: r,
|
|
1111
|
-
ignoreLocation: l
|
|
731
|
+
import("fuse.js").then((e) => {
|
|
732
|
+
c.current = new (e.default ?? e)(o, {
|
|
733
|
+
includeScore: !0,
|
|
734
|
+
ignoreLocation: !0
|
|
1112
735
|
});
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
let p = {
|
|
1116
|
-
isMatch: f,
|
|
1117
|
-
score: f ? d / this.chunks.length : 1
|
|
1118
|
-
};
|
|
1119
|
-
return f && r && (p.indices = Te(u)), p;
|
|
1120
|
-
}
|
|
1121
|
-
}, Y = class {
|
|
1122
|
-
constructor(e) {
|
|
1123
|
-
this.pattern = e;
|
|
1124
|
-
}
|
|
1125
|
-
static isMultiMatch(e) {
|
|
1126
|
-
return ke(e, this.multiRegex);
|
|
1127
|
-
}
|
|
1128
|
-
static isSingleMatch(e) {
|
|
1129
|
-
return ke(e, this.singleRegex);
|
|
1130
|
-
}
|
|
1131
|
-
search(e) {
|
|
1132
|
-
return {
|
|
1133
|
-
isMatch: !1,
|
|
1134
|
-
score: 1
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
function ke(e, t) {
|
|
1139
|
-
let n = e.match(t);
|
|
1140
|
-
return n ? n[1] : null;
|
|
1141
|
-
}
|
|
1142
|
-
var Ae = class extends Y {
|
|
1143
|
-
constructor(e) {
|
|
1144
|
-
super(e);
|
|
1145
|
-
}
|
|
1146
|
-
static get type() {
|
|
1147
|
-
return "exact";
|
|
1148
|
-
}
|
|
1149
|
-
static get multiRegex() {
|
|
1150
|
-
return /^="(.*)"$/;
|
|
1151
|
-
}
|
|
1152
|
-
static get singleRegex() {
|
|
1153
|
-
return /^=(.*)$/;
|
|
1154
|
-
}
|
|
1155
|
-
search(e) {
|
|
1156
|
-
let t = e === this.pattern;
|
|
1157
|
-
return {
|
|
1158
|
-
isMatch: t,
|
|
1159
|
-
score: +!t,
|
|
1160
|
-
indices: [0, this.pattern.length - 1]
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
}, je = class extends Y {
|
|
1164
|
-
constructor(e) {
|
|
1165
|
-
super(e);
|
|
1166
|
-
}
|
|
1167
|
-
static get type() {
|
|
1168
|
-
return "inverse-exact";
|
|
1169
|
-
}
|
|
1170
|
-
static get multiRegex() {
|
|
1171
|
-
return /^!"(.*)"$/;
|
|
1172
|
-
}
|
|
1173
|
-
static get singleRegex() {
|
|
1174
|
-
return /^!(.*)$/;
|
|
1175
|
-
}
|
|
1176
|
-
search(e) {
|
|
1177
|
-
let t = e.indexOf(this.pattern) === -1;
|
|
1178
|
-
return {
|
|
1179
|
-
isMatch: t,
|
|
1180
|
-
score: +!t,
|
|
1181
|
-
indices: [0, e.length - 1]
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
}, Me = class extends Y {
|
|
1185
|
-
constructor(e) {
|
|
1186
|
-
super(e);
|
|
1187
|
-
}
|
|
1188
|
-
static get type() {
|
|
1189
|
-
return "prefix-exact";
|
|
1190
|
-
}
|
|
1191
|
-
static get multiRegex() {
|
|
1192
|
-
return /^\^"(.*)"$/;
|
|
1193
|
-
}
|
|
1194
|
-
static get singleRegex() {
|
|
1195
|
-
return /^\^(.*)$/;
|
|
1196
|
-
}
|
|
1197
|
-
search(e) {
|
|
1198
|
-
let t = e.startsWith(this.pattern);
|
|
1199
|
-
return {
|
|
1200
|
-
isMatch: t,
|
|
1201
|
-
score: +!t,
|
|
1202
|
-
indices: [0, this.pattern.length - 1]
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
}, Ne = class extends Y {
|
|
1206
|
-
constructor(e) {
|
|
1207
|
-
super(e);
|
|
1208
|
-
}
|
|
1209
|
-
static get type() {
|
|
1210
|
-
return "inverse-prefix-exact";
|
|
1211
|
-
}
|
|
1212
|
-
static get multiRegex() {
|
|
1213
|
-
return /^!\^"(.*)"$/;
|
|
1214
|
-
}
|
|
1215
|
-
static get singleRegex() {
|
|
1216
|
-
return /^!\^(.*)$/;
|
|
1217
|
-
}
|
|
1218
|
-
search(e) {
|
|
1219
|
-
let t = !e.startsWith(this.pattern);
|
|
1220
|
-
return {
|
|
1221
|
-
isMatch: t,
|
|
1222
|
-
score: +!t,
|
|
1223
|
-
indices: [0, e.length - 1]
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
}, Pe = class extends Y {
|
|
1227
|
-
constructor(e) {
|
|
1228
|
-
super(e);
|
|
1229
|
-
}
|
|
1230
|
-
static get type() {
|
|
1231
|
-
return "suffix-exact";
|
|
1232
|
-
}
|
|
1233
|
-
static get multiRegex() {
|
|
1234
|
-
return /^"(.*)"\$$/;
|
|
1235
|
-
}
|
|
1236
|
-
static get singleRegex() {
|
|
1237
|
-
return /^(.*)\$$/;
|
|
1238
|
-
}
|
|
1239
|
-
search(e) {
|
|
1240
|
-
let t = e.endsWith(this.pattern);
|
|
1241
|
-
return {
|
|
1242
|
-
isMatch: t,
|
|
1243
|
-
score: +!t,
|
|
1244
|
-
indices: [e.length - this.pattern.length, e.length - 1]
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
}, Fe = class extends Y {
|
|
1248
|
-
constructor(e) {
|
|
1249
|
-
super(e);
|
|
1250
|
-
}
|
|
1251
|
-
static get type() {
|
|
1252
|
-
return "inverse-suffix-exact";
|
|
1253
|
-
}
|
|
1254
|
-
static get multiRegex() {
|
|
1255
|
-
return /^!"(.*)"\$$/;
|
|
1256
|
-
}
|
|
1257
|
-
static get singleRegex() {
|
|
1258
|
-
return /^!(.*)\$$/;
|
|
1259
|
-
}
|
|
1260
|
-
search(e) {
|
|
1261
|
-
let t = !e.endsWith(this.pattern);
|
|
1262
|
-
return {
|
|
1263
|
-
isMatch: t,
|
|
1264
|
-
score: +!t,
|
|
1265
|
-
indices: [0, e.length - 1]
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
}, Ie = class extends Y {
|
|
1269
|
-
constructor(e, { location: t = K.location, threshold: n = K.threshold, distance: r = K.distance, includeMatches: i = K.includeMatches, findAllMatches: a = K.findAllMatches, minMatchCharLength: o = K.minMatchCharLength, isCaseSensitive: s = K.isCaseSensitive, ignoreDiacritics: c = K.ignoreDiacritics, ignoreLocation: l = K.ignoreLocation } = {}) {
|
|
1270
|
-
super(e), this._bitapSearch = new Oe(e, {
|
|
1271
|
-
location: t,
|
|
1272
|
-
threshold: n,
|
|
1273
|
-
distance: r,
|
|
1274
|
-
includeMatches: i,
|
|
1275
|
-
findAllMatches: a,
|
|
1276
|
-
minMatchCharLength: o,
|
|
1277
|
-
isCaseSensitive: s,
|
|
1278
|
-
ignoreDiacritics: c,
|
|
1279
|
-
ignoreLocation: l
|
|
736
|
+
}).catch(() => {
|
|
737
|
+
process.env.NODE_ENV !== "production" && console.warn("[react-vocal] fuse.js is not installed. Phrase command keys will fall back to exact matching. Install fuse.js to enable fuzzy matching: npm install fuse.js");
|
|
1280
738
|
});
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
static get singleRegex() {
|
|
1289
|
-
return /^(.*)$/;
|
|
1290
|
-
}
|
|
1291
|
-
search(e) {
|
|
1292
|
-
return this._bitapSearch.searchIn(e);
|
|
1293
|
-
}
|
|
1294
|
-
}, Le = class extends Y {
|
|
1295
|
-
constructor(e) {
|
|
1296
|
-
super(e);
|
|
1297
|
-
}
|
|
1298
|
-
static get type() {
|
|
1299
|
-
return "include";
|
|
1300
|
-
}
|
|
1301
|
-
static get multiRegex() {
|
|
1302
|
-
return /^'"(.*)"$/;
|
|
1303
|
-
}
|
|
1304
|
-
static get singleRegex() {
|
|
1305
|
-
return /^'(.*)$/;
|
|
1306
|
-
}
|
|
1307
|
-
search(e) {
|
|
1308
|
-
let t = 0, n, r = [], i = this.pattern.length;
|
|
1309
|
-
for (; (n = e.indexOf(this.pattern, t)) > -1;) t = n + i, r.push([n, t - 1]);
|
|
1310
|
-
let a = !!r.length;
|
|
1311
|
-
return {
|
|
1312
|
-
isMatch: a,
|
|
1313
|
-
score: +!a,
|
|
1314
|
-
indices: r
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
}, Re = [
|
|
1318
|
-
Ae,
|
|
1319
|
-
Le,
|
|
1320
|
-
Me,
|
|
1321
|
-
Ne,
|
|
1322
|
-
Fe,
|
|
1323
|
-
Pe,
|
|
1324
|
-
je,
|
|
1325
|
-
Ie
|
|
1326
|
-
], ze = Re.length, Be = "\0", Ve = "|";
|
|
1327
|
-
function He(e) {
|
|
1328
|
-
let t = [], n = e.length, r = 0;
|
|
1329
|
-
for (; r < n;) {
|
|
1330
|
-
for (; r < n && e[r] === " ";) r++;
|
|
1331
|
-
if (r >= n) break;
|
|
1332
|
-
let i = r;
|
|
1333
|
-
for (; i < n && e[i] !== " " && e[i] !== "\"";) i++;
|
|
1334
|
-
if (i < n && e[i] === "\"") {
|
|
1335
|
-
for (i++; i < n;) {
|
|
1336
|
-
if (e[i] === "\"") {
|
|
1337
|
-
let t = i + 1;
|
|
1338
|
-
if (t >= n || e[t] === " ") {
|
|
1339
|
-
i++;
|
|
1340
|
-
break;
|
|
1341
|
-
}
|
|
1342
|
-
if (e[t] === "$" && (t + 1 >= n || e[t + 1] === " ")) {
|
|
1343
|
-
i += 2;
|
|
1344
|
-
break;
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
i++;
|
|
1348
|
-
}
|
|
1349
|
-
t.push(e.substring(r, i)), r = i;
|
|
1350
|
-
} else {
|
|
1351
|
-
for (; i < n && e[i] !== " ";) i++;
|
|
1352
|
-
t.push(e.substring(r, i)), r = i;
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
return t;
|
|
1356
|
-
}
|
|
1357
|
-
function Ue(e, t = {}) {
|
|
1358
|
-
return e.replace(/\\\|/g, Be).split(Ve).map((e) => {
|
|
1359
|
-
let n = He(e.replace(/\u0000/g, "|").trim()).filter((e) => e && !!e.trim()), r = [];
|
|
1360
|
-
for (let e = 0, i = n.length; e < i; e += 1) {
|
|
1361
|
-
let i = n[e], a = !1, o = -1;
|
|
1362
|
-
for (; !a && ++o < ze;) {
|
|
1363
|
-
let e = Re[o], n = e.isMultiMatch(i);
|
|
1364
|
-
n && (r.push(new e(n, t)), a = !0);
|
|
1365
|
-
}
|
|
1366
|
-
if (!a) for (o = -1; ++o < ze;) {
|
|
1367
|
-
let e = Re[o], n = e.isSingleMatch(i);
|
|
1368
|
-
if (n) {
|
|
1369
|
-
r.push(new e(n, t));
|
|
1370
|
-
break;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
return r;
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
1378
|
-
constructor(e, { isCaseSensitive: t = K.isCaseSensitive, ignoreDiacritics: n = K.ignoreDiacritics, includeMatches: r = K.includeMatches, minMatchCharLength: i = K.minMatchCharLength, ignoreLocation: a = K.ignoreLocation, findAllMatches: o = K.findAllMatches, location: s = K.location, threshold: c = K.threshold, distance: l = K.distance } = {}) {
|
|
1379
|
-
this.query = null, this.options = {
|
|
1380
|
-
isCaseSensitive: t,
|
|
1381
|
-
ignoreDiacritics: n,
|
|
1382
|
-
includeMatches: r,
|
|
1383
|
-
minMatchCharLength: i,
|
|
1384
|
-
findAllMatches: o,
|
|
1385
|
-
ignoreLocation: a,
|
|
1386
|
-
location: s,
|
|
1387
|
-
threshold: c,
|
|
1388
|
-
distance: l
|
|
1389
|
-
}, e = t ? e : e.toLowerCase(), e = n ? J(e) : e, this.pattern = e, this.query = Ue(this.pattern, this.options);
|
|
1390
|
-
}
|
|
1391
|
-
static condition(e, t) {
|
|
1392
|
-
return t.useExtendedSearch;
|
|
1393
|
-
}
|
|
1394
|
-
searchIn(e) {
|
|
1395
|
-
let t = this.query;
|
|
1396
|
-
if (!t) return {
|
|
1397
|
-
isMatch: !1,
|
|
1398
|
-
score: 1
|
|
1399
|
-
};
|
|
1400
|
-
let { includeMatches: n, isCaseSensitive: r, ignoreDiacritics: i } = this.options;
|
|
1401
|
-
e = r ? e : e.toLowerCase(), e = i ? J(e) : e;
|
|
1402
|
-
let a = 0, o = [], s = 0, c = !1;
|
|
1403
|
-
for (let r = 0, i = t.length; r < i; r += 1) {
|
|
1404
|
-
let i = t[r];
|
|
1405
|
-
o.length = 0, a = 0, c = !1;
|
|
1406
|
-
for (let t = 0, r = i.length; t < r; t += 1) {
|
|
1407
|
-
let r = i[t], { isMatch: l, indices: u, score: d } = r.search(e);
|
|
1408
|
-
if (l) {
|
|
1409
|
-
a += 1, s += d;
|
|
1410
|
-
let e = r.constructor.type;
|
|
1411
|
-
e.startsWith("inverse") && (c = !0), n && (We.has(e) ? o.push(...u) : o.push(u));
|
|
1412
|
-
} else {
|
|
1413
|
-
s = 0, a = 0, o.length = 0, c = !1;
|
|
1414
|
-
break;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
if (a) {
|
|
1418
|
-
let e = {
|
|
1419
|
-
isMatch: !0,
|
|
1420
|
-
score: s / a
|
|
1421
|
-
};
|
|
1422
|
-
return c && (e.hasInverse = !0), n && (e.indices = Te(o)), e;
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
return {
|
|
1426
|
-
isMatch: !1,
|
|
1427
|
-
score: 1
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
}, Ke = [];
|
|
1431
|
-
function qe(...e) {
|
|
1432
|
-
Ke.push(...e);
|
|
1433
|
-
}
|
|
1434
|
-
function X(e, t) {
|
|
1435
|
-
for (let n = 0, r = Ke.length; n < r; n += 1) {
|
|
1436
|
-
let r = Ke[n];
|
|
1437
|
-
if (r.condition(e, t)) return new r(e, t);
|
|
1438
|
-
}
|
|
1439
|
-
return new Oe(e, t);
|
|
1440
|
-
}
|
|
1441
|
-
var Z = {
|
|
1442
|
-
AND: "$and",
|
|
1443
|
-
OR: "$or"
|
|
1444
|
-
}, Je = {
|
|
1445
|
-
PATH: "$path",
|
|
1446
|
-
PATTERN: "$val"
|
|
1447
|
-
}, Ye = (e) => !!(e[Z.AND] || e[Z.OR]), Xe = (e) => !!e[Je.PATH], Ze = (e) => !P(e) && z(e) && !Ye(e), Qe = (e) => ({ [Z.AND]: Object.keys(e).map((t) => ({ [t]: e[t] })) });
|
|
1448
|
-
function $e(e, t, { auto: n = !0 } = {}) {
|
|
1449
|
-
let r = (e) => {
|
|
1450
|
-
if (L(e)) {
|
|
1451
|
-
let r = {
|
|
1452
|
-
keyId: null,
|
|
1453
|
-
pattern: e
|
|
1454
|
-
};
|
|
1455
|
-
return n && (r.searcher = X(e, t)), r;
|
|
1456
|
-
}
|
|
1457
|
-
let i = Object.keys(e), a = Xe(e);
|
|
1458
|
-
if (!a && i.length > 1 && !Ye(e)) return r(Qe(e));
|
|
1459
|
-
if (Ze(e)) {
|
|
1460
|
-
let r = a ? e[Je.PATH] : i[0], o = a ? e[Je.PATTERN] : e[r];
|
|
1461
|
-
if (!L(o)) throw Error(W(r));
|
|
1462
|
-
let s = {
|
|
1463
|
-
keyId: de(r),
|
|
1464
|
-
pattern: o
|
|
1465
|
-
};
|
|
1466
|
-
return n && (s.searcher = X(o, t)), s;
|
|
1467
|
-
}
|
|
1468
|
-
let o = {
|
|
1469
|
-
children: [],
|
|
1470
|
-
operator: i[0]
|
|
1471
|
-
};
|
|
1472
|
-
return i.forEach((t) => {
|
|
1473
|
-
let n = e[t];
|
|
1474
|
-
P(n) && n.forEach((e) => {
|
|
1475
|
-
o.children.push(r(e));
|
|
1476
|
-
});
|
|
1477
|
-
}), o;
|
|
1478
|
-
};
|
|
1479
|
-
return Ye(e) || (e = Qe(e)), r(e);
|
|
1480
|
-
}
|
|
1481
|
-
function et(e, { ignoreFieldNorm: t = K.ignoreFieldNorm }) {
|
|
1482
|
-
let n = 1;
|
|
1483
|
-
return e.forEach(({ key: e, norm: r, score: i }) => {
|
|
1484
|
-
let a = e ? e.weight : null;
|
|
1485
|
-
n *= (i === 0 && a ? 2 ** -52 : i) ** +((a || 1) * (t ? 1 : r));
|
|
1486
|
-
}), n;
|
|
1487
|
-
}
|
|
1488
|
-
function tt(e, { ignoreFieldNorm: t = K.ignoreFieldNorm }) {
|
|
1489
|
-
e.forEach((e) => {
|
|
1490
|
-
e.score = et(e.matches, { ignoreFieldNorm: t });
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
var nt = class {
|
|
1494
|
-
constructor(e) {
|
|
1495
|
-
this.limit = e, this.heap = [];
|
|
1496
|
-
}
|
|
1497
|
-
get size() {
|
|
1498
|
-
return this.heap.length;
|
|
1499
|
-
}
|
|
1500
|
-
shouldInsert(e) {
|
|
1501
|
-
return this.size < this.limit || e < this.heap[0].score;
|
|
1502
|
-
}
|
|
1503
|
-
insert(e) {
|
|
1504
|
-
this.size < this.limit ? (this.heap.push(e), this._bubbleUp(this.size - 1)) : e.score < this.heap[0].score && (this.heap[0] = e, this._sinkDown(0));
|
|
1505
|
-
}
|
|
1506
|
-
extractSorted(e) {
|
|
1507
|
-
return this.heap.sort(e);
|
|
1508
|
-
}
|
|
1509
|
-
_bubbleUp(e) {
|
|
1510
|
-
let t = this.heap;
|
|
1511
|
-
for (; e > 0;) {
|
|
1512
|
-
let n = e - 1 >> 1;
|
|
1513
|
-
if (t[e].score <= t[n].score) break;
|
|
1514
|
-
let r = t[e];
|
|
1515
|
-
t[e] = t[n], t[n] = r, e = n;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
_sinkDown(e) {
|
|
1519
|
-
let t = this.heap, n = t.length, r = e;
|
|
1520
|
-
do {
|
|
1521
|
-
e = r;
|
|
1522
|
-
let i = 2 * e + 1, a = 2 * e + 2;
|
|
1523
|
-
if (i < n && t[i].score > t[r].score && (r = i), a < n && t[a].score > t[r].score && (r = a), r !== e) {
|
|
1524
|
-
let n = t[e];
|
|
1525
|
-
t[e] = t[r], t[r] = n;
|
|
739
|
+
}, [s, o]), (e) => {
|
|
740
|
+
if (!o.length) return null;
|
|
741
|
+
if (!s) {
|
|
742
|
+
let t = e.trim().split(/\s+/), r = t.length > 1 ? t : [e.trim()];
|
|
743
|
+
for (let e of r) {
|
|
744
|
+
let t = e.toLowerCase();
|
|
745
|
+
if (t in n) return n[t]?.(e);
|
|
1526
746
|
}
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1529
|
-
};
|
|
1530
|
-
function rt(e, t) {
|
|
1531
|
-
let n = e.matches;
|
|
1532
|
-
t.matches = [], B(n) && n.forEach((e) => {
|
|
1533
|
-
if (!B(e.indices) || !e.indices.length) return;
|
|
1534
|
-
let { indices: n, value: r } = e, i = {
|
|
1535
|
-
indices: n,
|
|
1536
|
-
value: r
|
|
1537
|
-
};
|
|
1538
|
-
e.key && (i.key = e.key.src), e.idx > -1 && (i.refIndex = e.idx), t.matches.push(i);
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
function it(e, t) {
|
|
1542
|
-
t.score = e.score;
|
|
1543
|
-
}
|
|
1544
|
-
function at(e, t, { includeMatches: n = K.includeMatches, includeScore: r = K.includeScore } = {}) {
|
|
1545
|
-
let i = [];
|
|
1546
|
-
return n && i.push(rt), r && i.push(it), e.map((e) => {
|
|
1547
|
-
let { idx: n } = e, r = {
|
|
1548
|
-
item: t[n],
|
|
1549
|
-
refIndex: n
|
|
1550
|
-
};
|
|
1551
|
-
return i.length && i.forEach((t) => {
|
|
1552
|
-
t(e, r);
|
|
1553
|
-
}), r;
|
|
1554
|
-
});
|
|
1555
|
-
}
|
|
1556
|
-
var ot = /\b\w+\b/g;
|
|
1557
|
-
function st({ isCaseSensitive: e = !1, ignoreDiacritics: t = !1 } = {}) {
|
|
1558
|
-
return { tokenize(n) {
|
|
1559
|
-
return e || (n = n.toLowerCase()), t && (n = J(n)), n.match(ot) || [];
|
|
1560
|
-
} };
|
|
1561
|
-
}
|
|
1562
|
-
function ct(e, t, n) {
|
|
1563
|
-
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = 0;
|
|
1564
|
-
function o(e, t, o, s) {
|
|
1565
|
-
let c = n.tokenize(e);
|
|
1566
|
-
if (!c.length) return;
|
|
1567
|
-
a++;
|
|
1568
|
-
let l = /* @__PURE__ */ new Map();
|
|
1569
|
-
for (let e of c) l.set(e, (l.get(e) || 0) + 1);
|
|
1570
|
-
for (let [e, n] of l) {
|
|
1571
|
-
let a = {
|
|
1572
|
-
docIdx: t,
|
|
1573
|
-
keyIdx: o,
|
|
1574
|
-
subIdx: s,
|
|
1575
|
-
tf: n
|
|
1576
|
-
}, c = r.get(e);
|
|
1577
|
-
c || (c = [], r.set(e, c)), c.push(a), i.set(e, (i.get(e) || 0) + 1);
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
for (let n of e) {
|
|
1581
|
-
let { i: e, v: r, $: i } = n;
|
|
1582
|
-
if (r !== void 0) {
|
|
1583
|
-
o(r, e, -1, -1);
|
|
1584
|
-
continue;
|
|
747
|
+
return null;
|
|
1585
748
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
749
|
+
let r = c.current;
|
|
750
|
+
if (r) {
|
|
751
|
+
let i = r.search(e).filter((e) => e.score < t);
|
|
752
|
+
if (i?.length) return n[i[0].item.toLowerCase()]?.(e);
|
|
753
|
+
} else {
|
|
754
|
+
let t = e.toLowerCase(), r = o.find((e) => t.includes(e) || e.includes(t));
|
|
755
|
+
if (r) return n[r]?.(e);
|
|
1590
756
|
}
|
|
1591
|
-
|
|
1592
|
-
return {
|
|
1593
|
-
terms: r,
|
|
1594
|
-
fieldCount: a,
|
|
1595
|
-
df: i
|
|
757
|
+
return null;
|
|
1596
758
|
};
|
|
1597
|
-
}
|
|
1598
|
-
function lt(e, t, n, r) {
|
|
1599
|
-
let { i, v: a, $: o } = t;
|
|
1600
|
-
function s(t, n, a) {
|
|
1601
|
-
let o = r.tokenize(t);
|
|
1602
|
-
if (!o.length) return;
|
|
1603
|
-
e.fieldCount++;
|
|
1604
|
-
let s = /* @__PURE__ */ new Map();
|
|
1605
|
-
for (let e of o) s.set(e, (s.get(e) || 0) + 1);
|
|
1606
|
-
for (let [t, r] of s) {
|
|
1607
|
-
let o = {
|
|
1608
|
-
docIdx: i,
|
|
1609
|
-
keyIdx: n,
|
|
1610
|
-
subIdx: a,
|
|
1611
|
-
tf: r
|
|
1612
|
-
}, s = e.terms.get(t);
|
|
1613
|
-
s || (s = [], e.terms.set(t, s)), s.push(o), e.df.set(t, (e.df.get(t) || 0) + 1);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
if (a !== void 0) {
|
|
1617
|
-
s(a, -1, -1);
|
|
1618
|
-
return;
|
|
1619
|
-
}
|
|
1620
|
-
if (o) for (let e = 0; e < n; e++) {
|
|
1621
|
-
let t = o[e];
|
|
1622
|
-
if (t) if (Array.isArray(t)) for (let n of t) s(n.v, e, n.i ?? -1);
|
|
1623
|
-
else s(t.v, e, -1);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
function ut(e, t) {
|
|
1627
|
-
for (let [n, r] of e.terms) {
|
|
1628
|
-
let i = r.filter((e) => e.docIdx !== t), a = r.length - i.length;
|
|
1629
|
-
a > 0 && (e.fieldCount -= a, e.df.set(n, (e.df.get(n) || 0) - a), i.length === 0 ? (e.terms.delete(n), e.df.delete(n)) : e.terms.set(n, i));
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
var Q = class {
|
|
1633
|
-
constructor(e, t, n) {
|
|
1634
|
-
this.options = {
|
|
1635
|
-
...K,
|
|
1636
|
-
...t
|
|
1637
|
-
}, this.options.useExtendedSearch, this.options.useTokenSearch, this._keyStore = new ce(this.options.keys), this._docs = e, this._myIndex = null, this._invertedIndex = null, this.setCollection(e, n), this._lastQuery = null, this._lastSearcher = null;
|
|
1638
|
-
}
|
|
1639
|
-
_getSearcher(e) {
|
|
1640
|
-
if (this._lastQuery === e) return this._lastSearcher;
|
|
1641
|
-
let t = X(e, this._invertedIndex ? {
|
|
1642
|
-
...this.options,
|
|
1643
|
-
_invertedIndex: this._invertedIndex
|
|
1644
|
-
} : this.options);
|
|
1645
|
-
return this._lastQuery = e, this._lastSearcher = t, t;
|
|
1646
|
-
}
|
|
1647
|
-
setCollection(e, t) {
|
|
1648
|
-
if (this._docs = e, t && !(t instanceof ye)) throw Error(U);
|
|
1649
|
-
if (this._myIndex = t || be(this.options.keys, this._docs, {
|
|
1650
|
-
getFn: this.options.getFn,
|
|
1651
|
-
fieldNormWeight: this.options.fieldNormWeight
|
|
1652
|
-
}), this.options.useTokenSearch) {
|
|
1653
|
-
let e = st({
|
|
1654
|
-
isCaseSensitive: this.options.isCaseSensitive,
|
|
1655
|
-
ignoreDiacritics: this.options.ignoreDiacritics
|
|
1656
|
-
});
|
|
1657
|
-
this._invertedIndex = ct(this._myIndex.records, this._myIndex.keys.length, e);
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
add(e) {
|
|
1661
|
-
if (B(e) && (this._docs.push(e), this._myIndex.add(e), this._invertedIndex)) {
|
|
1662
|
-
let e = this._myIndex.records[this._myIndex.records.length - 1], t = st({
|
|
1663
|
-
isCaseSensitive: this.options.isCaseSensitive,
|
|
1664
|
-
ignoreDiacritics: this.options.ignoreDiacritics
|
|
1665
|
-
});
|
|
1666
|
-
lt(this._invertedIndex, e, this._myIndex.keys.length, t);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
remove(e = () => !1) {
|
|
1670
|
-
let t = [], n = [];
|
|
1671
|
-
for (let r = 0, i = this._docs.length; r < i; r += 1) e(this._docs[r], r) && (t.push(this._docs[r]), n.push(r));
|
|
1672
|
-
if (n.length) {
|
|
1673
|
-
if (this._invertedIndex) for (let e of n) ut(this._invertedIndex, e);
|
|
1674
|
-
for (let e = n.length - 1; e >= 0; --e) this._docs.splice(n[e], 1);
|
|
1675
|
-
this._myIndex.removeAll(n);
|
|
1676
|
-
}
|
|
1677
|
-
return t;
|
|
1678
|
-
}
|
|
1679
|
-
removeAt(e) {
|
|
1680
|
-
this._invertedIndex && ut(this._invertedIndex, e);
|
|
1681
|
-
let t = this._docs.splice(e, 1)[0];
|
|
1682
|
-
return this._myIndex.removeAt(e), t;
|
|
1683
|
-
}
|
|
1684
|
-
getIndex() {
|
|
1685
|
-
return this._myIndex;
|
|
1686
|
-
}
|
|
1687
|
-
search(e, t) {
|
|
1688
|
-
let { limit: n = -1 } = t || {}, { includeMatches: r, includeScore: i, shouldSort: a, sortFn: o, ignoreFieldNorm: s } = this.options;
|
|
1689
|
-
if (L(e) && !e.trim()) {
|
|
1690
|
-
let e = this._docs.map((e, t) => ({
|
|
1691
|
-
item: e,
|
|
1692
|
-
refIndex: t
|
|
1693
|
-
}));
|
|
1694
|
-
return R(n) && n > -1 && (e = e.slice(0, n)), e;
|
|
1695
|
-
}
|
|
1696
|
-
let c = R(n) && n > 0 && L(e), l;
|
|
1697
|
-
if (c) {
|
|
1698
|
-
let t = new nt(n);
|
|
1699
|
-
L(this._docs[0]) ? this._searchStringList(e, {
|
|
1700
|
-
heap: t,
|
|
1701
|
-
ignoreFieldNorm: s
|
|
1702
|
-
}) : this._searchObjectList(e, {
|
|
1703
|
-
heap: t,
|
|
1704
|
-
ignoreFieldNorm: s
|
|
1705
|
-
}), l = t.extractSorted(o);
|
|
1706
|
-
} else l = L(e) ? L(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e), tt(l, { ignoreFieldNorm: s }), a && l.sort(o), R(n) && n > -1 && (l = l.slice(0, n));
|
|
1707
|
-
return at(l, this._docs, {
|
|
1708
|
-
includeMatches: r,
|
|
1709
|
-
includeScore: i
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
_searchStringList(e, { heap: t, ignoreFieldNorm: n } = {}) {
|
|
1713
|
-
let r = this._getSearcher(e), { records: i } = this._myIndex, a = t ? null : [];
|
|
1714
|
-
return i.forEach(({ v: e, i, n: o }) => {
|
|
1715
|
-
if (!B(e)) return;
|
|
1716
|
-
let { isMatch: s, score: c, indices: l } = r.searchIn(e);
|
|
1717
|
-
if (s) {
|
|
1718
|
-
let r = {
|
|
1719
|
-
item: e,
|
|
1720
|
-
idx: i,
|
|
1721
|
-
matches: [{
|
|
1722
|
-
score: c,
|
|
1723
|
-
value: e,
|
|
1724
|
-
norm: o,
|
|
1725
|
-
indices: l
|
|
1726
|
-
}]
|
|
1727
|
-
};
|
|
1728
|
-
t ? (r.score = et(r.matches, { ignoreFieldNorm: n }), t.shouldInsert(r.score) && t.insert(r)) : a.push(r);
|
|
1729
|
-
}
|
|
1730
|
-
}), a;
|
|
1731
|
-
}
|
|
1732
|
-
_searchLogical(e) {
|
|
1733
|
-
let t = $e(e, this.options), n = (e, t, r) => {
|
|
1734
|
-
if (!("children" in e)) {
|
|
1735
|
-
let { keyId: n, searcher: i } = e, a;
|
|
1736
|
-
return n === null ? (a = [], this._myIndex.keys.forEach((e, n) => {
|
|
1737
|
-
a.push(...this._findMatches({
|
|
1738
|
-
key: e,
|
|
1739
|
-
value: t[n],
|
|
1740
|
-
searcher: i
|
|
1741
|
-
}));
|
|
1742
|
-
})) : a = this._findMatches({
|
|
1743
|
-
key: this._keyStore.get(n),
|
|
1744
|
-
value: this._myIndex.getValueForItemAtKeyId(t, n),
|
|
1745
|
-
searcher: i
|
|
1746
|
-
}), a && a.length ? [{
|
|
1747
|
-
idx: r,
|
|
1748
|
-
item: t,
|
|
1749
|
-
matches: a
|
|
1750
|
-
}] : [];
|
|
1751
|
-
}
|
|
1752
|
-
let { children: i, operator: a } = e, o = [];
|
|
1753
|
-
for (let e = 0, s = i.length; e < s; e += 1) {
|
|
1754
|
-
let s = i[e], c = n(s, t, r);
|
|
1755
|
-
if (c.length) o.push(...c);
|
|
1756
|
-
else if (a === Z.AND) return [];
|
|
1757
|
-
}
|
|
1758
|
-
return o;
|
|
1759
|
-
}, r = this._myIndex.records, i = /* @__PURE__ */ new Map(), a = [];
|
|
1760
|
-
return r.forEach(({ $: e, i: r }) => {
|
|
1761
|
-
if (B(e)) {
|
|
1762
|
-
let o = n(t, e, r);
|
|
1763
|
-
o.length && (i.has(r) || (i.set(r, {
|
|
1764
|
-
idx: r,
|
|
1765
|
-
item: e,
|
|
1766
|
-
matches: []
|
|
1767
|
-
}), a.push(i.get(r))), o.forEach(({ matches: e }) => {
|
|
1768
|
-
i.get(r).matches.push(...e);
|
|
1769
|
-
}));
|
|
1770
|
-
}
|
|
1771
|
-
}), a;
|
|
1772
|
-
}
|
|
1773
|
-
_searchObjectList(e, { heap: t, ignoreFieldNorm: n } = {}) {
|
|
1774
|
-
let r = this._getSearcher(e), { keys: i, records: a } = this._myIndex, o = t ? null : [];
|
|
1775
|
-
return a.forEach(({ $: e, i: a }) => {
|
|
1776
|
-
if (!B(e)) return;
|
|
1777
|
-
let s = [], c = !1, l = !1;
|
|
1778
|
-
if (i.forEach((t, n) => {
|
|
1779
|
-
let i = this._findMatches({
|
|
1780
|
-
key: t,
|
|
1781
|
-
value: e[n],
|
|
1782
|
-
searcher: r
|
|
1783
|
-
});
|
|
1784
|
-
i.length ? (s.push(...i), i[0].hasInverse && (l = !0)) : c = !0;
|
|
1785
|
-
}), !(l && c) && s.length) {
|
|
1786
|
-
let r = {
|
|
1787
|
-
idx: a,
|
|
1788
|
-
item: e,
|
|
1789
|
-
matches: s
|
|
1790
|
-
};
|
|
1791
|
-
t ? (r.score = et(r.matches, { ignoreFieldNorm: n }), t.shouldInsert(r.score) && t.insert(r)) : o.push(r);
|
|
1792
|
-
}
|
|
1793
|
-
}), o;
|
|
1794
|
-
}
|
|
1795
|
-
_findMatches({ key: e, value: t, searcher: n }) {
|
|
1796
|
-
if (!B(t)) return [];
|
|
1797
|
-
let r = [];
|
|
1798
|
-
if (P(t)) t.forEach(({ v: t, i, n: a }) => {
|
|
1799
|
-
if (!B(t)) return;
|
|
1800
|
-
let { isMatch: o, score: s, indices: c, hasInverse: l } = n.searchIn(t);
|
|
1801
|
-
o && r.push({
|
|
1802
|
-
score: s,
|
|
1803
|
-
key: e,
|
|
1804
|
-
value: t,
|
|
1805
|
-
idx: i,
|
|
1806
|
-
norm: a,
|
|
1807
|
-
indices: c,
|
|
1808
|
-
hasInverse: l
|
|
1809
|
-
});
|
|
1810
|
-
});
|
|
1811
|
-
else {
|
|
1812
|
-
let { v: i, n: a } = t, { isMatch: o, score: s, indices: c, hasInverse: l } = n.searchIn(i);
|
|
1813
|
-
o && r.push({
|
|
1814
|
-
score: s,
|
|
1815
|
-
key: e,
|
|
1816
|
-
value: i,
|
|
1817
|
-
norm: a,
|
|
1818
|
-
indices: c,
|
|
1819
|
-
hasInverse: l
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
return r;
|
|
1823
|
-
}
|
|
1824
|
-
}, dt = class {
|
|
1825
|
-
static condition(e, t) {
|
|
1826
|
-
return t.useTokenSearch;
|
|
1827
|
-
}
|
|
1828
|
-
constructor(e, t) {
|
|
1829
|
-
this.options = t, this.analyzer = st({
|
|
1830
|
-
isCaseSensitive: t.isCaseSensitive,
|
|
1831
|
-
ignoreDiacritics: t.ignoreDiacritics
|
|
1832
|
-
});
|
|
1833
|
-
let n = this.analyzer.tokenize(e), { df: r, fieldCount: i } = t._invertedIndex;
|
|
1834
|
-
this.termSearchers = [], this.idfWeights = [];
|
|
1835
|
-
for (let e of n) {
|
|
1836
|
-
this.termSearchers.push(new Oe(e, {
|
|
1837
|
-
location: t.location,
|
|
1838
|
-
threshold: t.threshold,
|
|
1839
|
-
distance: t.distance,
|
|
1840
|
-
includeMatches: t.includeMatches,
|
|
1841
|
-
findAllMatches: t.findAllMatches,
|
|
1842
|
-
minMatchCharLength: t.minMatchCharLength,
|
|
1843
|
-
isCaseSensitive: t.isCaseSensitive,
|
|
1844
|
-
ignoreDiacritics: t.ignoreDiacritics,
|
|
1845
|
-
ignoreLocation: !0
|
|
1846
|
-
}));
|
|
1847
|
-
let n = r.get(e) || 0, a = Math.log(1 + (i - n + .5) / (n + .5));
|
|
1848
|
-
this.idfWeights.push(a);
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
searchIn(e) {
|
|
1852
|
-
if (!this.termSearchers.length) return {
|
|
1853
|
-
isMatch: !1,
|
|
1854
|
-
score: 1
|
|
1855
|
-
};
|
|
1856
|
-
let t = [], n = 0, r = 0, i = 0;
|
|
1857
|
-
for (let a = 0; a < this.termSearchers.length; a++) {
|
|
1858
|
-
let o = this.termSearchers[a].searchIn(e), s = this.idfWeights[a];
|
|
1859
|
-
r += s, o.isMatch && (i++, n += s * (1 - o.score), o.indices && t.push(...o.indices));
|
|
1860
|
-
}
|
|
1861
|
-
if (i === 0) return {
|
|
1862
|
-
isMatch: !1,
|
|
1863
|
-
score: 1
|
|
1864
|
-
};
|
|
1865
|
-
let a = r > 0 ? 1 - n / r : 0, o = {
|
|
1866
|
-
isMatch: !0,
|
|
1867
|
-
score: Math.max(.001, a)
|
|
1868
|
-
};
|
|
1869
|
-
return this.options.includeMatches && t.length && (o.indices = Te(t)), o;
|
|
1870
|
-
}
|
|
1871
|
-
};
|
|
1872
|
-
Q.version = "7.3.0", Q.createIndex = be, Q.parseIndex = xe, Q.config = K, Q.match = function(e, t, n) {
|
|
1873
|
-
return X(e, {
|
|
1874
|
-
...K,
|
|
1875
|
-
...n
|
|
1876
|
-
}).searchIn(t);
|
|
1877
|
-
}, Q.parseQuery = $e, qe(Ge), qe(dt), Q.use = function(...e) {
|
|
1878
|
-
e.forEach((e) => qe(e));
|
|
1879
|
-
};
|
|
1880
|
-
//#endregion
|
|
1881
|
-
//#region src/hooks/useCommands.js
|
|
1882
|
-
var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.toLowerCase()]: n }), {}) : {}, (n) => {
|
|
1883
|
-
let r = new Q(Object.keys(e), {
|
|
1884
|
-
includeScore: !0,
|
|
1885
|
-
ignoreLocation: !0
|
|
1886
|
-
}).search(n).filter((e) => e.score < t);
|
|
1887
|
-
if (r?.length) {
|
|
1888
|
-
let t = r[0].item.toLowerCase();
|
|
1889
|
-
return e[t]?.(n);
|
|
1890
|
-
}
|
|
1891
|
-
return null;
|
|
1892
|
-
}), pt = /* @__PURE__ */ s(((e) => {
|
|
759
|
+
}, R = /* @__PURE__ */ s(((e) => {
|
|
1893
760
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
1894
761
|
function r(e, n, r) {
|
|
1895
762
|
var i = null;
|
|
@@ -1904,11 +771,11 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1904
771
|
};
|
|
1905
772
|
}
|
|
1906
773
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
1907
|
-
})),
|
|
774
|
+
})), z = /* @__PURE__ */ s(((e) => {
|
|
1908
775
|
process.env.NODE_ENV !== "production" && (function() {
|
|
1909
776
|
function t(e) {
|
|
1910
777
|
if (e == null) return null;
|
|
1911
|
-
if (typeof e == "function") return e.$$typeof ===
|
|
778
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
1912
779
|
if (typeof e == "string") return e;
|
|
1913
780
|
switch (e) {
|
|
1914
781
|
case v: return "Fragment";
|
|
@@ -1916,7 +783,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1916
783
|
case y: return "StrictMode";
|
|
1917
784
|
case w: return "Suspense";
|
|
1918
785
|
case T: return "SuspenseList";
|
|
1919
|
-
case
|
|
786
|
+
case O: return "Activity";
|
|
1920
787
|
}
|
|
1921
788
|
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
1922
789
|
case _: return "Portal";
|
|
@@ -1961,14 +828,14 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1961
828
|
}
|
|
1962
829
|
}
|
|
1963
830
|
function a() {
|
|
1964
|
-
var e =
|
|
831
|
+
var e = A.A;
|
|
1965
832
|
return e === null ? null : e.getOwner();
|
|
1966
833
|
}
|
|
1967
834
|
function o() {
|
|
1968
835
|
return Error("react-stack-top-frame");
|
|
1969
836
|
}
|
|
1970
837
|
function s(e) {
|
|
1971
|
-
if (
|
|
838
|
+
if (j.call(e, "key")) {
|
|
1972
839
|
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1973
840
|
if (t && t.isReactWarning) return !1;
|
|
1974
841
|
}
|
|
@@ -1976,7 +843,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1976
843
|
}
|
|
1977
844
|
function l(e, t) {
|
|
1978
845
|
function n() {
|
|
1979
|
-
|
|
846
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
1980
847
|
}
|
|
1981
848
|
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1982
849
|
get: n,
|
|
@@ -1985,7 +852,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1985
852
|
}
|
|
1986
853
|
function u() {
|
|
1987
854
|
var e = t(this.type);
|
|
1988
|
-
return
|
|
855
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
1989
856
|
}
|
|
1990
857
|
function d(e, t, n, r, i, a) {
|
|
1991
858
|
var o = n.ref;
|
|
@@ -2025,17 +892,17 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
2025
892
|
}
|
|
2026
893
|
function f(e, n, i, o, c, u) {
|
|
2027
894
|
var f = n.children;
|
|
2028
|
-
if (f !== void 0) if (o) if (
|
|
895
|
+
if (f !== void 0) if (o) if (M(f)) {
|
|
2029
896
|
for (o = 0; o < f.length; o++) p(f[o]);
|
|
2030
897
|
Object.freeze && Object.freeze(f);
|
|
2031
898
|
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
2032
899
|
else p(f);
|
|
2033
|
-
if (
|
|
900
|
+
if (j.call(n, "key")) {
|
|
2034
901
|
f = t(e);
|
|
2035
902
|
var m = Object.keys(n).filter(function(e) {
|
|
2036
903
|
return e !== "key";
|
|
2037
904
|
});
|
|
2038
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
905
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
2039
906
|
}
|
|
2040
907
|
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
2041
908
|
else i = n;
|
|
@@ -2047,147 +914,155 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
2047
914
|
function m(e) {
|
|
2048
915
|
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
2049
916
|
}
|
|
2050
|
-
var h = c("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"),
|
|
917
|
+
var h = c("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
2051
918
|
return null;
|
|
2052
919
|
};
|
|
2053
920
|
h = { react_stack_bottom_frame: function(e) {
|
|
2054
921
|
return e();
|
|
2055
922
|
} };
|
|
2056
|
-
var
|
|
923
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
|
|
2057
924
|
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
2058
|
-
var r = 1e4 >
|
|
2059
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") :
|
|
925
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
926
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
2060
927
|
}, e.jsxs = function(e, t, n) {
|
|
2061
|
-
var r = 1e4 >
|
|
2062
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") :
|
|
928
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
929
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
2063
930
|
};
|
|
2064
931
|
})();
|
|
2065
|
-
})),
|
|
2066
|
-
process.env.NODE_ENV === "production" ? t.exports =
|
|
2067
|
-
})))(),
|
|
932
|
+
})), B = (/* @__PURE__ */ s(((e, t) => {
|
|
933
|
+
process.env.NODE_ENV === "production" ? t.exports = R() : t.exports = z();
|
|
934
|
+
})))(), ee = ({ color: e = "black", activeColor: t = "red", isActive: n = !1 }) => /* @__PURE__ */ (0, B.jsx)("svg", {
|
|
2068
935
|
"data-testid": "__icon-root__",
|
|
2069
936
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2070
937
|
width: "100%",
|
|
2071
938
|
height: "100%",
|
|
2072
939
|
viewBox: "0 0 24 24",
|
|
2073
|
-
children: /* @__PURE__ */ (0,
|
|
940
|
+
children: /* @__PURE__ */ (0, B.jsxs)("g", { children: [/* @__PURE__ */ (0, B.jsx)("path", {
|
|
2074
941
|
"data-testid": "__icon-path__",
|
|
2075
942
|
fill: e,
|
|
2076
943
|
d: "M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"
|
|
2077
|
-
}), n && /* @__PURE__ */ (0,
|
|
944
|
+
}), n && /* @__PURE__ */ (0, B.jsx)("circle", {
|
|
2078
945
|
"data-testid": "__icon-active__",
|
|
2079
946
|
fill: t,
|
|
2080
947
|
cx: "16",
|
|
2081
948
|
cy: "4",
|
|
2082
949
|
r: "4"
|
|
2083
950
|
})] })
|
|
2084
|
-
}),
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
951
|
+
}), te = (e, t) => {
|
|
952
|
+
for (let { alternatives: n } of e) for (let e of n) if (t(e) !== null) return;
|
|
953
|
+
}, V = ({ children: r, commands: s = null, lang: c = "en-US", grammars: l = null, timeout: u = 3e3, precision: d = .4, maxAlternatives: f = 1, ariaLabel: p = "start recognition", style: m = null, className: h = null, outlineStyle: g = "2px solid", onStart: _ = null, onEnd: v = null, onSpeechStart: y = null, onSpeechEnd: b = null, onResult: x = null, onError: S = null, onNoMatch: C = null, __rsInstance: w }) => {
|
|
954
|
+
let T = a(null), [E, D] = o(!1), [, { start: O, stop: k, subscribe: A, unsubscribe: j }] = F(c, l, f, w), M = L(s, d), R = a({});
|
|
955
|
+
R.current = {
|
|
956
|
+
onStart: _,
|
|
957
|
+
onEnd: v,
|
|
958
|
+
onSpeechStart: y,
|
|
959
|
+
onSpeechEnd: b,
|
|
960
|
+
onResult: x,
|
|
961
|
+
onError: S,
|
|
962
|
+
onNoMatch: C
|
|
2094
963
|
};
|
|
2095
|
-
let
|
|
2096
|
-
|
|
2097
|
-
let
|
|
964
|
+
let z = a(M);
|
|
965
|
+
z.current = M;
|
|
966
|
+
let V = a(null), H = a(null), [U, W] = I(n(() => H.current?.(), []), u), G = n(() => {
|
|
2098
967
|
try {
|
|
2099
|
-
|
|
968
|
+
D(!1), k();
|
|
2100
969
|
} catch (e) {
|
|
2101
|
-
|
|
2102
|
-
} finally {
|
|
2103
|
-
P.current?.();
|
|
970
|
+
R.current.onError?.(e), V.current?.();
|
|
2104
971
|
}
|
|
2105
|
-
}, [
|
|
2106
|
-
|
|
2107
|
-
}, [
|
|
2108
|
-
|
|
2109
|
-
}, [
|
|
2110
|
-
|
|
2111
|
-
}, [
|
|
972
|
+
}, [k]), K = n((e) => {
|
|
973
|
+
U(), R.current.onStart?.(e);
|
|
974
|
+
}, [U]), q = n((e) => {
|
|
975
|
+
W(), R.current.onSpeechStart?.(e);
|
|
976
|
+
}, [W]), J = n((e) => {
|
|
977
|
+
U(), R.current.onSpeechEnd?.(e);
|
|
978
|
+
}, [U]), Y = n((e) => {
|
|
2112
979
|
let t = Array.from(e?.results ?? [], (e) => {
|
|
2113
980
|
let t = {
|
|
2114
981
|
confidence: -Infinity,
|
|
2115
982
|
transcript: ""
|
|
2116
|
-
};
|
|
2117
|
-
for (let
|
|
2118
|
-
let
|
|
2119
|
-
(
|
|
983
|
+
}, n = [];
|
|
984
|
+
for (let r = 0; r < e.length; r++) {
|
|
985
|
+
let i = e[r];
|
|
986
|
+
n.push(i.transcript ?? ""), (i.confidence === void 0 || i.confidence > t.confidence) && (t = i);
|
|
2120
987
|
}
|
|
2121
|
-
return
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
988
|
+
return {
|
|
989
|
+
best: t.transcript ?? "",
|
|
990
|
+
alternatives: n
|
|
991
|
+
};
|
|
992
|
+
}), n = t.map((e) => e.best).join("");
|
|
993
|
+
W(), G(), te(t, z.current), R.current.onResult?.(n, e);
|
|
994
|
+
}, [W, G]), X = n((e) => {
|
|
995
|
+
G(), R.current.onError?.(e);
|
|
996
|
+
}, [G]), ne = n((e) => {
|
|
997
|
+
W(), G(), R.current.onNoMatch?.(e);
|
|
998
|
+
}, [W, G]), Z = n((e) => {
|
|
999
|
+
W();
|
|
1000
|
+
try {
|
|
1001
|
+
G(), V.current?.();
|
|
1002
|
+
} finally {
|
|
1003
|
+
R.current.onEnd?.(e);
|
|
1004
|
+
}
|
|
1005
|
+
}, [W, G]);
|
|
1006
|
+
H.current = Z;
|
|
1007
|
+
let Q = i(() => ({
|
|
1008
|
+
start: K,
|
|
1009
|
+
end: Z,
|
|
1010
|
+
speechstart: q,
|
|
1011
|
+
speechend: J,
|
|
1012
|
+
result: Y,
|
|
1013
|
+
error: X,
|
|
1014
|
+
nomatch: ne
|
|
2140
1015
|
}), [
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
1016
|
+
K,
|
|
1017
|
+
Z,
|
|
1018
|
+
q,
|
|
1019
|
+
J,
|
|
1020
|
+
Y,
|
|
1021
|
+
X,
|
|
1022
|
+
ne
|
|
2148
1023
|
]);
|
|
2149
|
-
|
|
2150
|
-
let
|
|
1024
|
+
V.current = () => Object.entries(Q).forEach(([e, t]) => j?.(e, t));
|
|
1025
|
+
let $ = n(() => {
|
|
2151
1026
|
try {
|
|
2152
|
-
|
|
1027
|
+
D(!0), Object.entries(Q).forEach(([e, t]) => A(e, t)), O();
|
|
2153
1028
|
} catch (e) {
|
|
2154
|
-
|
|
1029
|
+
X(e);
|
|
2155
1030
|
}
|
|
2156
1031
|
}, [
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
]),
|
|
2162
|
-
!
|
|
2163
|
-
},
|
|
2164
|
-
!
|
|
1032
|
+
Q,
|
|
1033
|
+
A,
|
|
1034
|
+
O,
|
|
1035
|
+
X
|
|
1036
|
+
]), re = () => {
|
|
1037
|
+
!h && g && (T.current.style.outline = g);
|
|
1038
|
+
}, ie = () => {
|
|
1039
|
+
!h && g && (T.current.style.outline = "none");
|
|
2165
1040
|
};
|
|
2166
|
-
return
|
|
1041
|
+
return N.isSupported ? P(r) ? r($, G, E) : t(r) ? e(r, { ...!E && { onClick: $ } }) : /* @__PURE__ */ (0, B.jsx)("button", {
|
|
2167
1042
|
"data-testid": "__vocal-root__",
|
|
2168
|
-
ref:
|
|
1043
|
+
ref: T,
|
|
2169
1044
|
role: "button",
|
|
2170
|
-
"aria-label":
|
|
2171
|
-
style:
|
|
1045
|
+
"aria-label": p,
|
|
1046
|
+
style: h ? null : {
|
|
2172
1047
|
width: 24,
|
|
2173
1048
|
height: 24,
|
|
2174
1049
|
backgroundColor: "transparent",
|
|
2175
1050
|
border: "none",
|
|
2176
1051
|
padding: 0,
|
|
2177
|
-
cursor:
|
|
2178
|
-
...
|
|
1052
|
+
cursor: E ? "default" : "pointer",
|
|
1053
|
+
...m
|
|
2179
1054
|
},
|
|
2180
|
-
className:
|
|
2181
|
-
onFocus:
|
|
2182
|
-
onBlur:
|
|
2183
|
-
onClick:
|
|
2184
|
-
children: /* @__PURE__ */ (0,
|
|
2185
|
-
isActive:
|
|
1055
|
+
className: h,
|
|
1056
|
+
onFocus: re,
|
|
1057
|
+
onBlur: ie,
|
|
1058
|
+
onClick: $,
|
|
1059
|
+
children: /* @__PURE__ */ (0, B.jsx)(ee, {
|
|
1060
|
+
isActive: E,
|
|
2186
1061
|
color: "#aaa"
|
|
2187
1062
|
})
|
|
2188
1063
|
}) : null;
|
|
2189
|
-
},
|
|
1064
|
+
}, H = N.isSupported, U = V;
|
|
2190
1065
|
//#endregion
|
|
2191
|
-
export {
|
|
1066
|
+
export { U as default, H as isSupported, F as useVocal };
|
|
2192
1067
|
|
|
2193
1068
|
//# sourceMappingURL=index.es.js.map
|