@untemps/react-vocal 2.0.0-beta.4 → 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 +12 -0
- package/README.md +13 -1
- package/dist/index.es.js +97 -1243
- 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/hooks/__tests__/useCommands.test.js +28 -2
- package/src/hooks/useCommands.js +37 -11
- package/vite.config.js +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`)):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactVocal={},e.React))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var u=function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw Error(`Dynamic requires are not currently supported by @rollup/plugin-commonjs`)}(t==null&&n.path)}},n.exports),n.exports}((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r=typeof Symbol==`function`?Symbol:{},i=r.iterator||`@@iterator`,a=r.asyncIterator||`@@asyncIterator`,o=r.toStringTag||`@@toStringTag`;function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},``)}catch{s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype);return a._invoke=function(e,t,n){var r=`suspendedStart`;return function(i,a){if(r===`executing`)throw Error(`Generator is already running`);if(r===`completed`){if(i===`throw`)throw a;return T()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=b(o,n);if(s){if(s===u)continue;return s}}if(n.method===`next`)n.sent=n._sent=n.arg;else if(n.method===`throw`){if(r===`suspendedStart`)throw r=`completed`,n.arg;n.dispatchException(n.arg)}else n.method===`return`&&n.abrupt(`return`,n.arg);r=`executing`;var c=l(e,t,n);if(c.type===`normal`){if(r=n.done?`completed`:`suspendedYield`,c.arg===u)continue;return{value:c.arg,done:n.done}}c.type===`throw`&&(r=`completed`,n.method=`throw`,n.arg=c.arg)}}}(e,n,new C(r||[])),a}function l(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}e.wrap=c;var u={};function d(){}function f(){}function p(){}var m={};m[i]=function(){return this};var h=Object.getPrototypeOf,g=h&&h(h(w([])));g&&g!==t&&n.call(g,i)&&(m=g);var _=p.prototype=d.prototype=Object.create(m);function v(e){[`next`,`throw`,`return`].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){(function r(i,a,o,s){var c=l(e[i],e,a);if(c.type!==`throw`){var u=c.arg,d=u.value;return d&&typeof d==`object`&&n.call(d,`__await`)?t.resolve(d.__await).then((function(e){r(`next`,e,o,s)}),(function(e){r(`throw`,e,o,s)})):t.resolve(d).then((function(e){u.value=e,o(u)}),(function(e){return r(`throw`,e,o,s)}))}s(c.arg)})(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function b(e,t){var n=e.iterator[t.method];if(n===void 0){if(t.delegate=null,t.method===`throw`){if(e.iterator.return&&(t.method=`return`,t.arg=void 0,b(e,t),t.method===`throw`))return u;t.method=`throw`,t.arg=TypeError(`The iterator does not provide a 'throw' method`)}return u}var r=l(n,e.iterator,t.arg);if(r.type===`throw`)return t.method=`throw`,t.arg=r.arg,t.delegate=null,u;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,t.method!==`return`&&(t.method=`next`,t.arg=void 0),t.delegate=null,u):i:(t.method=`throw`,t.arg=TypeError(`iterator result is not an object`),t.delegate=null,u)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type=`normal`,delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:`root`}],e.forEach(x,this),this.reset(!0)}function w(e){if(e){var t=e[i];if(t)return t.call(e);if(typeof e.next==`function`)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:T}}function T(){return{value:void 0,done:!0}}return f.prototype=_.constructor=p,p.constructor=f,f.displayName=s(p,o,`GeneratorFunction`),e.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===f||(t.displayName||t.name)===`GeneratorFunction`)},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,`GeneratorFunction`)),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},v(y.prototype),y.prototype[a]=function(){return this},e.AsyncIterator=y,e.async=function(t,n,r,i,a){a===void 0&&(a=Promise);var o=new y(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},v(_),s(_,o,`Generator`),_[i]=function(){return this},_.toString=function(){return`[object Generator]`},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=w,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method=`next`,this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)t.charAt(0)===`t`&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type=`throw`,o.arg=e,t.next=n,r&&(t.method=`next`,t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if(a.tryLoc===`root`)return r(`end`);if(a.tryLoc<=this.prev){var s=n.call(a,`catchLoc`),c=n.call(a,`finallyLoc`);if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error(`try statement without catch or finally`);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,`finallyLoc`)&&this.prev<i.finallyLoc){var a=i;break}}a&&(e===`break`||e===`continue`)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method=`next`,this.next=a.finallyLoc,u):this.complete(o)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(r.type===`throw`){var i=r.arg;S(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},this.method===`next`&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=t}catch{Function(`r`,`regeneratorRuntime = r`)(t)}}));function d(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}var f=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){d(a,r,i,o,s,`next`,e)}function s(e){d(a,r,i,o,s,`throw`,e)}o(void 0)}))}},p=function(e){if(Array.isArray(e))return e},m=function(e,t){if(typeof Symbol<`u`&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||s.return==null||s.return()}finally{if(i)throw a}}return n}},h=function(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r},g=function(e,t){if(e){if(typeof e==`string`)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}},_=function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},v=function(e,t){return p(e)||m(e,t)||g(e,t)||_()},y=function(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)};function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var x=function(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e},S=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},C=function(){return!!navigator.permissions},w=function(){return!!navigator.mediaDevices};function T(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){T(a,r,i,o,s,`next`,e)}function s(e){T(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(typeof Symbol<`u`&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||s.return==null||s.return()}finally{if(i)throw a}}return n}}(e,t)||function(e,t){if(e){if(typeof e==`string`)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function O(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var k=function(){var e=E(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,new Promise(function(){var e=E(regeneratorRuntime.mark((function e(n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C()||r(new DOMException(`Navigator API: permissions not supported`,`NOT_SUPPORTED_ERR`)),e.prev=1,e.next=4,navigator.permissions.query({name:t});case 4:i=e.sent,a=function e(t){i.removeEventListener(`change`,e),A(t.target.state,n,r)},i.addEventListener(`change`,a),A(i.state,n,r),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),r(e.t0);case 13:case`end`:return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case`end`:return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(e,t,n){switch(e){case`denied`:n(new DOMException(`Permission denied`,`NOT_ALLOWED_ERR`));break;default:t(e)}},j=function(){var e=E(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,new Promise(function(){var e=E(regeneratorRuntime.mark((function e(r,i){var a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C()&&w()||i(new DOMException(`Navigator API: permissions or Navigator API: mediaDevices not supported`,`NOT_SUPPORTED_ERR`)),e.prev=1,e.t0=Promise,e.next=5,k(t);case 5:return e.t1=e.sent,e.next=8,navigator.mediaDevices.getUserMedia(n);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:a=e.sent,o=D(a,2),s=o[1],r(s),e.next=21;break;case 18:e.prev=18,e.t4=e.catch(1),i(e.t4);case 21:case`end`:return e.stop()}}),e,null,[[1,18]])})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case`end`:return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?M(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var P=function(){function e(t){var n=this;y(this,e),S(this,`_instance`,null),S(this,`_listeners`,null);var r=e._resolveSpeechRecognition();if(!r)throw new DOMException(`SpeechRecognition not supported`,`NOT_SUPPORTED_ERR`);this._instance=new r,this._listeners={},Object.entries(N(N({},e.defaultOptions),t||{})).forEach((function(t){var r=v(t,2),i=r[0],a=r[1];if(i===`grammars`&&!a){var o=e._resolveSpeechGrammarList();o&&(a=new o)}n._instance[i]=a}))}var t;return x(e,null,[{key:`isSupported`,get:function(){return!!e._resolveSpeechRecognition()&&!!C()&&!!w()},set:function(e){throw Error(`You cannot set isSupported directly.`)}}]),x(e,[{key:`start`,value:(t=f(u.mark((function e(){var t;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._instance){e.next=14;break}return e.prev=1,e.next=4,j(`microphone`,{audio:!0});case 4:if(e.sent){e.next=7;break}throw Error(`Unable to retrieve the stream from media device`);case 7:this._instance.start(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),(t=this._listeners.error)&&t(e.t0);case 14:return e.abrupt(`return`,this);case 15:case`end`:return e.stop()}}),e,this,[[1,10]])}))),function(){return t.apply(this,arguments)})},{key:`stop`,value:function(){return this._instance&&this._instance.stop(),this}},{key:`abort`,value:function(){return this._instance&&this._instance.abort(),this}},{key:`addEventListener`,value:function(t,n){var r=this;if(this._instance&&this._includesEventType(t)){this._listeners[t]&&this.removeEventListener(t);var i=function(i){var a=[];t===e.eventTypes.RESULT&&i.results&&i.results.length>0&&a.push(i.results[0][0].transcript),n&&n.apply(r,[i].concat(a))};this._instance.addEventListener(t,i),this._listeners[t]=i}return this}},{key:`removeEventListener`,value:function(e){var t=this._listeners[e];return this._instance.removeEventListener(e,t),delete this._listeners[e],this}},{key:`cleanup`,value:function(){var e=this;return this.stop(),Object.keys(this._listeners).forEach((function(t){return e.removeEventListener(t)})),this._instance=null,this}},{key:`_includesEventType`,value:function(t){return!!Object.values(e.eventTypes).find((function(e){return e===t}))}},{key:`instance`,get:function(){return this._instance},set:function(e){throw Error(`You cannot set instance directly.`)}}],[{key:`_resolveSpeechRecognition`,value:function(){return window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition}},{key:`_resolveSpeechGrammarList`,value:function(){return window.SpeechGrammarList||window.webkitSpeechGrammarList||window.mozSpeechGrammarList||window.msSpeechGrammarList}}]),e}();S(P,`defaultOptions`,{grammars:null,lang:`en-US`,continuous:!1,interimResults:!1,maxAlternatives:1,serviceURI:null}),S(P,`eventTypes`,{AUDIO_END:`audioend`,AUDIO_START:`audiostart`,END:`end`,ERROR:`error`,NO_MATCH:`nomatch`,RESULT:`result`,SOUND_END:`soundend`,SOUND_START:`soundstart`,SPEECH_END:`speechend`,SPEECH_START:`speechstart`,START:`start`});var ee=e=>typeof e==`function`,F=(e=`en-US`,n=null,r=1,i=null)=>{let a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(P.isSupported)return a.current=i||new P({lang:e,grammars:n,maxAlternatives:r}),()=>{a.current.abort(),a.current.cleanup()}},[e,n,r,i]),[a,{start:(0,t.useCallback)(()=>{a.current&&a.current.start()},[]),stop:(0,t.useCallback)(()=>{a.current&&a.current.stop()},[]),abort:(0,t.useCallback)(()=>{a.current&&a.current.abort()},[]),subscribe:(0,t.useCallback)((e,t)=>{a.current&&a.current.addEventListener(e,t)},[]),unsubscribe:(0,t.useCallback)((e,t)=>{a.current&&a.current.removeEventListener(e,t)},[]),clean:(0,t.useCallback)(()=>{a.current&&a.current.cleanup()},[])}]},te=(e,n=0)=>{let r=(0,t.useRef)(-1),i=(0,t.useCallback)(()=>{clearTimeout(r.current),r.current=-1},[]),a=(0,t.useCallback)(()=>{i(),r.current=setTimeout(e,n)},[e,n,i]);return(0,t.useEffect)(()=>i,[i]),[a,i]};function I(e){return Array.isArray?Array.isArray(e):re(e)===`[object Array]`}function ne(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function L(e){return e==null?``:ne(e)}function R(e){return typeof e==`string`}function z(e){return typeof e==`number`}function B(e){return e===!0||e===!1||H(e)&&re(e)==`[object Boolean]`}function V(e){return typeof e==`object`}function H(e){return V(e)&&e!==null}function U(e){return e!=null}function W(e){return!e.trim().length}function re(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var ie=`Incorrect 'index' type`,ae=e=>`Invalid value for key ${e}`,oe=e=>`Pattern length exceeds max of ${e}.`,se=e=>`Missing ${e} property in key`,ce=e=>`Property 'weight' in key '${e}' must be a positive integer`,le=Object.prototype.hasOwnProperty,ue=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=de(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function de(e){let t=null,n=null,r=null,i=1,a=null;if(R(e)||I(e))r=e,t=fe(e),n=pe(e);else{if(!le.call(e,`name`))throw Error(se(`name`));let o=e.name;if(r=o,le.call(e,`weight`)&&(i=e.weight,i<=0))throw Error(ce(o));t=fe(o),n=pe(o),a=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:a}}function fe(e){return I(e)?e:e.split(`.`)}function pe(e){return I(e)?e.join(`.`):e}function me(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(U(e))if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!U(s))return;if(a===t.length-1&&(R(s)||z(s)||B(s)||typeof s==`bigint`))n.push(o===void 0?L(s):{v:L(s),i:o});else if(I(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}};return i(e,R(t)?t.split(`.`):t,0),r?n:n[0]}var he={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ge={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},_e={location:0,threshold:.6,distance:100},ve={useExtendedSearch:!1,useTokenSearch:!1,getFn:me,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},G=Object.freeze({...ge,...he,..._e,...ve}),ye=/[^ ]+/g;function be(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=t.match(ye).length;if(n.has(i))return n.get(i);let a=1/i**(.5*e),o=parseFloat(Math.round(a*r)/r);return n.set(i,o),o},clear(){n.clear()}}}var xe=class{constructor({getFn:e=G.getFn,fieldNormWeight:t=G.fieldNormWeight}={}){this.norm=be(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,R(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){let t=this.size();R(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)--this.records[t].i}removeAll(e){for(let t=e.length-1;t>=0;--t)this.records.splice(e[t],1);for(let e=0,t=this.records.length;e<t;e+=1)this.records[e].i=e}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!U(e)||W(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((t,r)=>{let i=t.getFn?t.getFn(e):this.getFn(e,t.path);if(U(i)){if(I(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(U(n)){if(R(n)){if(!W(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(U(n.v)){let t=R(n.v)?n.v:L(n.v);if(!W(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[r]=e}else if(R(i)&&!W(i)){let e={v:i,n:this.norm.get(i)};n.$[r]=e}}}),this.records.push(n)}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function Se(e,t,{getFn:n=G.getFn,fieldNormWeight:r=G.fieldNormWeight}={}){let i=new xe({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(de)),i.setSources(t),i.create(),i}function Ce(e,{getFn:t=G.getFn,fieldNormWeight:n=G.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new xe({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function we(e=[],t=G.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}var K=32;function Te(e,t,n,{location:r=G.location,distance:i=G.distance,threshold:a=G.threshold,findAllMatches:o=G.findAllMatches,minMatchCharLength:s=G.minMatchCharLength,includeMatches:c=G.includeMatches,ignoreLocation:l=G.ignoreLocation}={}){if(t.length>K)throw Error(oe(K));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=u+d,S=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=x;for(;r<i;)h(t,f+i)<=p?r=i:x=i,i=Math.floor((x-r)/2+r);x=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];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)){if(p=b,m=i,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}let C={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=we(_,s);e.length?c&&(C.indices=e):C.isMatch=!1}return C}function Ee(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function De(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var Oe={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},ke=RegExp(`[`+Object.keys(Oe).join(``)+`]`,`g`),q=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(ke,e=>Oe[e]):e=>e,J=class{constructor(e,{location:t=G.location,threshold:n=G.threshold,distance:r=G.distance,includeMatches:i=G.includeMatches,findAllMatches:a=G.findAllMatches,minMatchCharLength:o=G.minMatchCharLength,isCaseSensitive:s=G.isCaseSensitive,ignoreDiacritics:c=G.ignoreDiacritics,ignoreLocation:l=G.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?q(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Ee(e),startIndex:t})},d=this.pattern.length;if(d>K){let e=0,t=d%K,n=d-t;for(;e<n;)u(this.pattern.substr(e,K),e),e+=K;if(t){let e=d-K;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?q(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Te(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=De(u)),p}},Y=class{constructor(e){this.pattern=e}static isMultiMatch(e){return Ae(e,this.multiRegex)}static isSingleMatch(e){return Ae(e,this.singleRegex)}search(e){return{isMatch:!1,score:1}}};function Ae(e,t){let n=e.match(t);return n?n[1]:null}var je=class extends Y{constructor(e){super(e)}static get type(){return`exact`}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:+!t,indices:[0,this.pattern.length-1]}}},Me=class extends Y{constructor(e){super(e)}static get type(){return`inverse-exact`}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let t=e.indexOf(this.pattern)===-1;return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},Ne=class extends Y{constructor(e){super(e)}static get type(){return`prefix-exact`}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,this.pattern.length-1]}}},Pe=class extends Y{constructor(e){super(e)}static get type(){return`inverse-prefix-exact`}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},Fe=class extends Y{constructor(e){super(e)}static get type(){return`suffix-exact`}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:+!t,indices:[e.length-this.pattern.length,e.length-1]}}},Ie=class extends Y{constructor(e){super(e)}static get type(){return`inverse-suffix-exact`}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},Le=class extends Y{constructor(e,{location:t=G.location,threshold:n=G.threshold,distance:r=G.distance,includeMatches:i=G.includeMatches,findAllMatches:a=G.findAllMatches,minMatchCharLength:o=G.minMatchCharLength,isCaseSensitive:s=G.isCaseSensitive,ignoreDiacritics:c=G.ignoreDiacritics,ignoreLocation:l=G.ignoreLocation}={}){super(e),this._bitapSearch=new J(e,{location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l})}static get type(){return`fuzzy`}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},Re=class extends Y{constructor(e){super(e)}static get type(){return`include`}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n,r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,t))>-1;)t=n+i,r.push([n,t-1]);let a=!!r.length;return{isMatch:a,score:+!a,indices:r}}},ze=[je,Re,Ne,Pe,Ie,Fe,Me,Le],Be=ze.length,Ve=`\0`,He=`|`;function Ue(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function We(e,t={}){return e.replace(/\\\|/g,Ve).split(He).map(e=>{let n=Ue(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<Be;){let e=ze[o],n=e.isMultiMatch(i);n&&(r.push(new e(n,t)),a=!0)}if(!a)for(o=-1;++o<Be;){let e=ze[o],n=e.isSingleMatch(i);if(n){r.push(new e(n,t));break}}}return r})}var Ge=new Set([Le.type,Re.type]),Ke=class{constructor(e,{isCaseSensitive:t=G.isCaseSensitive,ignoreDiacritics:n=G.ignoreDiacritics,includeMatches:r=G.includeMatches,minMatchCharLength:i=G.minMatchCharLength,ignoreLocation:a=G.ignoreLocation,findAllMatches:o=G.findAllMatches,location:s=G.location,threshold:c=G.threshold,distance:l=G.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?q(e):e,this.pattern=e,this.query=We(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?q(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l){a+=1,s+=d;let e=r.constructor.type;e.startsWith(`inverse`)&&(c=!0),n&&(Ge.has(e)?o.push(...u):o.push(u))}else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=De(o)),e}}return{isMatch:!1,score:1}}},qe=[];function Je(...e){qe.push(...e)}function X(e,t){for(let n=0,r=qe.length;n<r;n+=1){let r=qe[n];if(r.condition(e,t))return new r(e,t)}return new J(e,t)}var Z={AND:`$and`,OR:`$or`},Ye={PATH:`$path`,PATTERN:`$val`},Xe=e=>!!(e[Z.AND]||e[Z.OR]),Ze=e=>!!e[Ye.PATH],Qe=e=>!I(e)&&V(e)&&!Xe(e),$e=e=>({[Z.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function et(e,t,{auto:n=!0}={}){let r=e=>{if(R(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=X(e,t)),r}let i=Object.keys(e),a=Ze(e);if(!a&&i.length>1&&!Xe(e))return r($e(e));if(Qe(e)){let r=a?e[Ye.PATH]:i[0],o=a?e[Ye.PATTERN]:e[r];if(!R(o))throw Error(ae(r));let s={keyId:pe(r),pattern:o};return n&&(s.searcher=X(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];I(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Xe(e)||(e=$e(e)),r(e)}function tt(e,{ignoreFieldNorm:t=G.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function nt(e,{ignoreFieldNorm:t=G.ignoreFieldNorm}){e.forEach(e=>{e.score=tt(e.matches,{ignoreFieldNorm:t})})}var rt=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){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))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function it(e,t){let n=e.matches;t.matches=[],U(n)&&n.forEach(e=>{if(!U(e.indices)||!e.indices.length)return;let{indices:n,value:r}=e,i={indices:n,value:r};e.key&&(i.key=e.key.src),e.idx>-1&&(i.refIndex=e.idx),t.matches.push(i)})}function at(e,t){t.score=e.score}function ot(e,t,{includeMatches:n=G.includeMatches,includeScore:r=G.includeScore}={}){let i=[];return n&&i.push(it),r&&i.push(at),e.map(e=>{let{idx:n}=e,r={item:t[n],refIndex:n};return i.length&&i.forEach(t=>{t(e,r)}),r})}var st=/\b\w+\b/g;function ct({isCaseSensitive:e=!1,ignoreDiacritics:t=!1}={}){return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=q(n)),n.match(st)||[]}}}function lt(e,t,n){let r=new Map,i=new Map,a=0;function o(e,t,o,s){let c=n.tokenize(e);if(!c.length)return;a++;let l=new Map;for(let e of c)l.set(e,(l.get(e)||0)+1);for(let[e,n]of l){let a={docIdx:t,keyIdx:o,subIdx:s,tf:n},c=r.get(e);c||(c=[],r.set(e,c)),c.push(a),i.set(e,(i.get(e)||0)+1)}}for(let n of e){let{i:e,v:r,$:i}=n;if(r!==void 0){o(r,e,-1,-1);continue}if(i)for(let n=0;n<t;n++){let t=i[n];if(t)if(Array.isArray(t))for(let r of t)o(r.v,e,n,r.i??-1);else o(t.v,e,n,-1)}}return{terms:r,fieldCount:a,df:i}}function ut(e,t,n,r){let{i,v:a,$:o}=t;function s(t,n,a){let o=r.tokenize(t);if(!o.length)return;e.fieldCount++;let s=new Map;for(let e of o)s.set(e,(s.get(e)||0)+1);for(let[t,r]of s){let o={docIdx:i,keyIdx:n,subIdx:a,tf:r},s=e.terms.get(t);s||(s=[],e.terms.set(t,s)),s.push(o),e.df.set(t,(e.df.get(t)||0)+1)}}if(a!==void 0){s(a,-1,-1);return}if(o)for(let e=0;e<n;e++){let t=o[e];if(t)if(Array.isArray(t))for(let n of t)s(n.v,e,n.i??-1);else s(t.v,e,-1)}}function dt(e,t){for(let[n,r]of e.terms){let i=r.filter(e=>e.docIdx!==t),a=r.length-i.length;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))}}var Q=class{constructor(e,t,n){this.options={...G,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new ue(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=X(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof xe))throw Error(ie);if(this._myIndex=t||Se(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=ct({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=lt(this._myIndex.records,this._myIndex.keys.length,e)}}add(e){if(U(e)&&(this._docs.push(e),this._myIndex.add(e),this._invertedIndex)){let e=this._myIndex.records[this._myIndex.records.length-1],t=ct({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});ut(this._invertedIndex,e,this._myIndex.keys.length,t)}}remove(e=()=>!1){let t=[],n=[];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));if(n.length){if(this._invertedIndex)for(let e of n)dt(this._invertedIndex,e);for(let e=n.length-1;e>=0;--e)this._docs.splice(n[e],1);this._myIndex.removeAll(n)}return t}removeAt(e){this._invertedIndex&&dt(this._invertedIndex,e);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),t}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(R(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return z(n)&&n>-1&&(e=e.slice(0,n)),e}let c=z(n)&&n>0&&R(e),l;if(c){let t=new rt(n);R(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=R(e)?R(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),nt(l,{ignoreFieldNorm:s}),a&&l.sort(o),z(n)&&n>-1&&(l=l.slice(0,n));return ot(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),{records:i}=this._myIndex,a=t?null:[];return i.forEach(({v:e,i,n:o})=>{if(!U(e))return;let{isMatch:s,score:c,indices:l}=r.searchIn(e);if(s){let r={item:e,idx:i,matches:[{score:c,value:e,norm:o,indices:l}]};t?(r.score=tt(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):a.push(r)}}),a}_searchLogical(e){let t=et(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===Z.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(U(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),{keys:i,records:a}=this._myIndex,o=t?null:[];return a.forEach(({$:e,i:a})=>{if(!U(e))return;let s=[],c=!1,l=!1;if(i.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(s.push(...i),i[0].hasInverse&&(l=!0)):c=!0}),!(l&&c)&&s.length){let r={idx:a,item:e,matches:s};t?(r.score=tt(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}),o}_findMatches({key:e,value:t,searcher:n}){if(!U(t))return[];let r=[];if(I(t))t.forEach(({v:t,i,n:a})=>{if(!U(t))return;let{isMatch:o,score:s,indices:c,hasInverse:l}=n.searchIn(t);o&&r.push({score:s,key:e,value:t,idx:i,norm:a,indices:c,hasInverse:l})});else{let{v:i,n:a}=t,{isMatch:o,score:s,indices:c,hasInverse:l}=n.searchIn(i);o&&r.push({score:s,key:e,value:i,norm:a,indices:c,hasInverse:l})}return r}},ft=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=ct({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new J(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0;for(let a=0;a<this.termSearchers.length;a++){let o=this.termSearchers[a].searchIn(e),s=this.idfWeights[a];r+=s,o.isMatch&&(i++,n+=s*(1-o.score),o.indices&&t.push(...o.indices))}if(i===0)return{isMatch:!1,score:1};let a=r>0?1-n/r:0,o={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&t.length&&(o.indices=De(t)),o}};Q.version=`7.3.0`,Q.createIndex=Se,Q.parseIndex=Ce,Q.config=G,Q.match=function(e,t,n){return X(e,{...G,...n}).searchIn(t)},Q.parseQuery=et,Je(Ke),Je(ft),Q.use=function(...e){e.forEach(e=>Je(e))};var pt=(e,n=.4)=>{let r=(0,t.useMemo)(()=>e?Object.entries(e).reduce((e,[t,n])=>({...e,[t.toLowerCase()]:n}),{}):{},[e]),i=(0,t.useMemo)(()=>Object.keys(r),[r]),a=(0,t.useMemo)(()=>i.some(e=>e.includes(` `)),[i]),o=(0,t.useMemo)(()=>a?new Q(i,{includeScore:!0,ignoreLocation:!0}):null,[a,i]);return e=>{if(!i.length)return null;if(!a){let t=e.trim().split(/\s+/),n=t.length>1?t:[e.trim()];for(let e of n){let t=e.toLowerCase();if(t in r)return r[t]?.(e)}return null}let t=o.search(e).filter(e=>e.score<n);return t?.length?r[t[0].item.toLowerCase()]?.(e):null}},mt=c((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ht=c((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}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){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!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))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[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}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}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.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,te[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function O(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var k=function(){var e=E(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,new Promise(function(){var e=E(regeneratorRuntime.mark((function e(n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C()||r(new DOMException(`Navigator API: permissions not supported`,`NOT_SUPPORTED_ERR`)),e.prev=1,e.next=4,navigator.permissions.query({name:t});case 4:i=e.sent,a=function e(t){i.removeEventListener(`change`,e),A(t.target.state,n,r)},i.addEventListener(`change`,a),A(i.state,n,r),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),r(e.t0);case 13:case`end`:return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case`end`:return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(e,t,n){switch(e){case`denied`:n(new DOMException(`Permission denied`,`NOT_ALLOWED_ERR`));break;default:t(e)}},j=function(){var e=E(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,new Promise(function(){var e=E(regeneratorRuntime.mark((function e(r,i){var a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C()&&w()||i(new DOMException(`Navigator API: permissions or Navigator API: mediaDevices not supported`,`NOT_SUPPORTED_ERR`)),e.prev=1,e.t0=Promise,e.next=5,k(t);case 5:return e.t1=e.sent,e.next=8,navigator.mediaDevices.getUserMedia(n);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:a=e.sent,o=D(a,2),s=o[1],r(s),e.next=21;break;case 18:e.prev=18,e.t4=e.catch(1),i(e.t4);case 21:case`end`:return e.stop()}}),e,null,[[1,18]])})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case`end`:return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?M(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var P=function(){function e(t){var n=this;y(this,e),S(this,`_instance`,null),S(this,`_listeners`,null);var r=e._resolveSpeechRecognition();if(!r)throw new DOMException(`SpeechRecognition not supported`,`NOT_SUPPORTED_ERR`);this._instance=new r,this._listeners={},Object.entries(N(N({},e.defaultOptions),t||{})).forEach((function(t){var r=v(t,2),i=r[0],a=r[1];if(i===`grammars`&&!a){var o=e._resolveSpeechGrammarList();o&&(a=new o)}n._instance[i]=a}))}var t;return x(e,null,[{key:`isSupported`,get:function(){return!!e._resolveSpeechRecognition()&&!!C()&&!!w()},set:function(e){throw Error(`You cannot set isSupported directly.`)}}]),x(e,[{key:`start`,value:(t=f(u.mark((function e(){var t;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._instance){e.next=14;break}return e.prev=1,e.next=4,j(`microphone`,{audio:!0});case 4:if(e.sent){e.next=7;break}throw Error(`Unable to retrieve the stream from media device`);case 7:this._instance.start(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),(t=this._listeners.error)&&t(e.t0);case 14:return e.abrupt(`return`,this);case 15:case`end`:return e.stop()}}),e,this,[[1,10]])}))),function(){return t.apply(this,arguments)})},{key:`stop`,value:function(){return this._instance&&this._instance.stop(),this}},{key:`abort`,value:function(){return this._instance&&this._instance.abort(),this}},{key:`addEventListener`,value:function(t,n){var r=this;if(this._instance&&this._includesEventType(t)){this._listeners[t]&&this.removeEventListener(t);var i=function(i){var a=[];t===e.eventTypes.RESULT&&i.results&&i.results.length>0&&a.push(i.results[0][0].transcript),n&&n.apply(r,[i].concat(a))};this._instance.addEventListener(t,i),this._listeners[t]=i}return this}},{key:`removeEventListener`,value:function(e){var t=this._listeners[e];return this._instance.removeEventListener(e,t),delete this._listeners[e],this}},{key:`cleanup`,value:function(){var e=this;return this.stop(),Object.keys(this._listeners).forEach((function(t){return e.removeEventListener(t)})),this._instance=null,this}},{key:`_includesEventType`,value:function(t){return!!Object.values(e.eventTypes).find((function(e){return e===t}))}},{key:`instance`,get:function(){return this._instance},set:function(e){throw Error(`You cannot set instance directly.`)}}],[{key:`_resolveSpeechRecognition`,value:function(){return window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition}},{key:`_resolveSpeechGrammarList`,value:function(){return window.SpeechGrammarList||window.webkitSpeechGrammarList||window.mozSpeechGrammarList||window.msSpeechGrammarList}}]),e}();S(P,`defaultOptions`,{grammars:null,lang:`en-US`,continuous:!1,interimResults:!1,maxAlternatives:1,serviceURI:null}),S(P,`eventTypes`,{AUDIO_END:`audioend`,AUDIO_START:`audiostart`,END:`end`,ERROR:`error`,NO_MATCH:`nomatch`,RESULT:`result`,SOUND_END:`soundend`,SOUND_START:`soundstart`,SPEECH_END:`speechend`,SPEECH_START:`speechstart`,START:`start`});var F=e=>typeof e==`function`,I=(e=`en-US`,n=null,r=1,i=null)=>{let a=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(P.isSupported)return a.current=i||new P({lang:e,grammars:n,maxAlternatives:r}),()=>{a.current.abort(),a.current.cleanup()}},[e,n,r,i]),[a,{start:(0,t.useCallback)(()=>{a.current&&a.current.start()},[]),stop:(0,t.useCallback)(()=>{a.current&&a.current.stop()},[]),abort:(0,t.useCallback)(()=>{a.current&&a.current.abort()},[]),subscribe:(0,t.useCallback)((e,t)=>{a.current&&a.current.addEventListener(e,t)},[]),unsubscribe:(0,t.useCallback)((e,t)=>{a.current&&a.current.removeEventListener(e,t)},[]),clean:(0,t.useCallback)(()=>{a.current&&a.current.cleanup()},[])}]},L=(e,n=0)=>{let r=(0,t.useRef)(-1),i=(0,t.useCallback)(()=>{clearTimeout(r.current),r.current=-1},[]),a=(0,t.useCallback)(()=>{i(),r.current=setTimeout(e,n)},[e,n,i]);return(0,t.useEffect)(()=>i,[i]),[a,i]},R=(e,n=.4)=>{let r=(0,t.useMemo)(()=>e?Object.entries(e).reduce((e,[t,n])=>({...e,[t.toLowerCase()]:n}),{}):{},[e]),i=(0,t.useMemo)(()=>Object.keys(r),[r]),a=(0,t.useMemo)(()=>i.some(e=>e.includes(` `)),[i]),o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!a){o.current=null;return}import(`fuse.js`).then(e=>{o.current=new(e.default??e)(i,{includeScore:!0,ignoreLocation:!0})}).catch(()=>{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`)})},[a,i]),e=>{if(!i.length)return null;if(!a){let t=e.trim().split(/\s+/),n=t.length>1?t:[e.trim()];for(let e of n){let t=e.toLowerCase();if(t in r)return r[t]?.(e)}return null}let t=o.current;if(t){let i=t.search(e).filter(e=>e.score<n);if(i?.length)return r[i[0].item.toLowerCase()]?.(e)}else{let t=e.toLowerCase(),n=i.find(e=>t.includes(e)||e.includes(t));if(n)return r[n]?.(e)}return null}},z=c((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=c((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}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){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!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))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[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}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}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.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
4
4
|
let props = %s;
|
|
5
5
|
<%s {...props} />
|
|
6
6
|
React keys must be passed directly to JSX without using spread:
|
|
7
7
|
let props = %s;
|
|
8
|
-
<%s key={someKey} {...props} />`,o,p,m,p),
|
|
8
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),V=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=z():t.exports=B()}))(),H=({color:e=`black`,activeColor:t=`red`,isActive:n=!1})=>(0,V.jsx)(`svg`,{"data-testid":`__icon-root__`,xmlns:`http://www.w3.org/2000/svg`,width:`100%`,height:`100%`,viewBox:`0 0 24 24`,children:(0,V.jsxs)(`g`,{children:[(0,V.jsx)(`path`,{"data-testid":`__icon-path__`,fill:e,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`}),n&&(0,V.jsx)(`circle`,{"data-testid":`__icon-active__`,fill:t,cx:`16`,cy:`4`,r:`4`})]})}),U=(e,t)=>{for(let{alternatives:n}of e)for(let e of n)if(t(e)!==null)return},W=({children:e,commands:n=null,lang:r=`en-US`,grammars:i=null,timeout:a=3e3,precision:o=.4,maxAlternatives:s=1,ariaLabel:c=`start recognition`,style:l=null,className:u=null,outlineStyle:d=`2px solid`,onStart:f=null,onEnd:p=null,onSpeechStart:m=null,onSpeechEnd:h=null,onResult:g=null,onError:_=null,onNoMatch:v=null,__rsInstance:y})=>{let b=(0,t.useRef)(null),[x,S]=(0,t.useState)(!1),[,{start:C,stop:w,subscribe:T,unsubscribe:E}]=I(r,i,s,y),D=R(n,o),O=(0,t.useRef)({});O.current={onStart:f,onEnd:p,onSpeechStart:m,onSpeechEnd:h,onResult:g,onError:_,onNoMatch:v};let k=(0,t.useRef)(D);k.current=D;let A=(0,t.useRef)(null),j=(0,t.useRef)(null),[M,N]=L((0,t.useCallback)(()=>j.current?.(),[]),a),z=(0,t.useCallback)(()=>{try{S(!1),w()}catch(e){O.current.onError?.(e),A.current?.()}},[w]),B=(0,t.useCallback)(e=>{M(),O.current.onStart?.(e)},[M]),W=(0,t.useCallback)(e=>{N(),O.current.onSpeechStart?.(e)},[N]),G=(0,t.useCallback)(e=>{M(),O.current.onSpeechEnd?.(e)},[M]),K=(0,t.useCallback)(e=>{let t=Array.from(e?.results??[],e=>{let t={confidence:-1/0,transcript:``},n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(i.transcript??``),(i.confidence===void 0||i.confidence>t.confidence)&&(t=i)}return{best:t.transcript??``,alternatives:n}}),n=t.map(e=>e.best).join(``);N(),z(),U(t,k.current),O.current.onResult?.(n,e)},[N,z]),q=(0,t.useCallback)(e=>{z(),O.current.onError?.(e)},[z]),J=(0,t.useCallback)(e=>{N(),z(),O.current.onNoMatch?.(e)},[N,z]),Y=(0,t.useCallback)(e=>{N();try{z(),A.current?.()}finally{O.current.onEnd?.(e)}},[N,z]);j.current=Y;let X=(0,t.useMemo)(()=>({start:B,end:Y,speechstart:W,speechend:G,result:K,error:q,nomatch:J}),[B,Y,W,G,K,q,J]);A.current=()=>Object.entries(X).forEach(([e,t])=>E?.(e,t));let Z=(0,t.useCallback)(()=>{try{S(!0),Object.entries(X).forEach(([e,t])=>T(e,t)),C()}catch(e){q(e)}},[X,T,C,q]),Q=()=>{!u&&d&&(b.current.style.outline=d)},$=()=>{!u&&d&&(b.current.style.outline=`none`)};return P.isSupported?F(e)?e(Z,z,x):(0,t.isValidElement)(e)?(0,t.cloneElement)(e,{...!x&&{onClick:Z}}):(0,V.jsx)(`button`,{"data-testid":`__vocal-root__`,ref:b,role:`button`,"aria-label":c,style:u?null:{width:24,height:24,backgroundColor:`transparent`,border:`none`,padding:0,cursor:x?`default`:`pointer`,...l},className:u,onFocus:Q,onBlur:$,onClick:Z,children:(0,V.jsx)(H,{isActive:x,color:`#aaa`})}):null},G=P.isSupported;e.default=W,e.isSupported=G,e.useVocal=I});
|
|
9
9
|
//# sourceMappingURL=index.umd.js.map
|