LocalCDN-Firefox-Chrome-Brave/resources/algoliasearch/4.22.0/algoliasearch.min.jsm

1 line
32 KiB
JavaScript
Raw Normal View History

2023-12-28 08:05:04 +01:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).algoliasearch=e()}(this,function(){"use strict";function e(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function g(n){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?e(Object(a),!0).forEach(function(t){var e,r;e=n,r=a[t=t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(a,t))})}return n}function d(t,e){if(null==t)return{};var r,n=function(t,e){if(null==t)return{};for(var r,n={},a=Object.keys(t),o=0;o<a.length;o++)r=a[o],0<=e.indexOf(r)||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols)for(var a=Object.getOwnPropertySymbols(t),o=0;o<a.length;o++)r=a[o],0<=e.indexOf(r)||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r]);return n}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function b(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function J(a){function o(){return JSON.parse(u().getItem(n)||"{}")}function i(t){u().setItem(n,JSON.stringify(t))}var t,n="algoliasearch-client-js-".concat(a.key),u=function(){return t=void 0===t?a.localStorage||window.localStorage:t};return{get:function(e,r){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){r=a.timeToLive?1e3*a.timeToLive:null,t=o(),t=Object.fromEntries(Object.entries(t).filter(function(t){return void 0!==l(t,2)[1].timestamp})),i(t),r&&(t=Object.fromEntries(Object.entries(t).filter(function(t){var t=l(t,2)[1],e=(new Date).getTime();return!(t.timestamp+r<e)})),i(t));var r,t=JSON.stringify(e);return o()[t]}).then(function(t){return Promise.all([t?t.value:r(),void 0!==t])}).then(function(t){var t=l(t,2),e=t[0],t=t[1];return Promise.all([e,t||n.miss(e)])}).then(function(t){return l(t,1)[0]})},set:function(e,r){return Promise.resolve().then(function(){var t=o();return t[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:r},u().setItem(n,JSON.stringify(t)),r})},delete:function(e){return Promise.resolve().then(function(){var t=o();delete t[JSON.stringify(e)],u().setItem(n,JSON.stringify(t))})},clear:function(){return Promise.resolve().then(function(){u().removeItem(n)})}}}function s(t){var o=0<arguments.length&&void 0!==t?t:{serializable:!0},i={};return{get:function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},t=JSON.stringify(t);if(t in i)return Promise.resolve(o.serializable?JSON.parse(i[t]):i[t]);var n=e(),a=r&&r.miss||function(){return Promise.resolve()};return n.then(function(t){return a(t)}).then(function(){return n})},set:function(t,e){return i[JSON.stringify(t)]=o.serializable?JSON.stringify(e):e,Promise.resolve(e)},delete:function(t){return delete i[JSON.stringify(t)],Promise.resolve()},clear:function(){return i={},Promise.resolve()}}}function c(t,e,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":e};r