blog-hexo/themes/hexo-theme-cosy/source/js/07f44e09.js
2023-10-21 17:55:14 +08:00

2 lines
40 KiB
JavaScript

/*! For license information please see 07f44e09.js.LICENSE.txt */
(()=>{var e={886:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?t(Object(a),!0).forEach((function(t){e(r,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):t(Object(a)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},i=function(){return JSON.parse(n().getItem(r)||"{}")},o=function(e){n().setItem(r,JSON.stringify(e))},s=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=i(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==a(e,2)[1].timestamp})));if(o(n),t){var s=Object.fromEntries(Object.entries(n).filter((function(e){var r=a(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));o(s)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){s();var t=JSON.stringify(e);return i()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=a(e,2),n=t[0],i=t[1];return Promise.all([n,i||r.miss(n)])})).then((function(e){return a(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var a=i();return a[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(a)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=i();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function s(e){var t=i(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return a(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,a).catch((function(){return s({caches:t}).get(e,n,a)}))},set:function(e,n){return r.set(e,n).catch((function(){return s({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return s({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return s({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},i=JSON.stringify(r);if(i in t)return Promise.resolve(e.serializable?JSON.parse(t[i]):t[i]);var o=n(),s=a&&a.miss||function(){return Promise.resolve()};return o.then((function(e){return s(e)})).then((function(){return o}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===m.WithinHeaders?n:{}},queryParameters:function(){return e===m.WithinQueryParameters?n:{}}}}function l(e){var t=0;return e((function r(){return t++,new Promise((function(n){setTimeout((function(){n(e(r))}),Math.min(100*t,1e3))}))}))}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return Promise.resolve()};return Object.assign(e,{wait:function(r){return d(e.then((function(e){return Promise.all([t(e,r),e])})).then((function(e){return e[1]})))}})}function h(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function f(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function p(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var a=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[a++])}))}var m={WithinQueryParameters:0,WithinHeaders:1};function y(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var v={Read:1,Write:2,Any:3},g=1,b=2,x=3;function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function I(e){return"string"==typeof e?{protocol:"https",url:e,accept:v.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||v.Any}}var k="DELETE",D="GET",O="POST",S="PUT";function P(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(w(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===g||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===x&&Date.now()-e.lastUpdate<=12e4}(e)})),a=[].concat(i(r),i(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:a.length>0?a.map((function(e){return I(e)})):t}}))}function E(e,t,n,a){var o=[],s=function(e,t){if(e.method!==D&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,a),u=function(e,t){var n=r(r({},e.headers),t.headers),a={};return Object.keys(n).forEach((function(e){var t=n[e];a[e.toLowerCase()]=t})),a}(e,a),c=n.method,l=n.method!==D?{}:r(r({},n.data),a.data),d=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),a.queryParameters),h=0,f=function t(r,i){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:A(o)};var f={data:s,headers:u,method:c,url:T(l,n.path,d),connectTimeout:i(h,e.timeouts.connect),responseTimeout:i(h,a.timeout)},p=function(e){var t={request:f,response:e,host:l,triesLeft:r.length};return o.push(t),t},m={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var a=p(n);return n.isTimedOut&&h++,Promise.all([e.logger.info("Retryable failure",N(a)),e.hostsCache.set(l,w(l,n.isTimedOut?x:b))]).then((function(){return t(r,i)}))},onFail:function(e){throw p(e),function(e,t){var r=e.content,n=e.status,a=r;try{a=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(a,n,t)}(e,A(o))}};return e.requester.send(f).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,m)}))};return P(e.hostsCache,t).then((function(e){return f(i(e.statelessHosts).reverse(),e.getTimeout)}))}function j(e){var t=e.hostsCache,r=e.logger,n=e.requester,i=e.requestsCache,o=e.responsesCache,s=e.timeouts,u=e.userAgent,c=e.hosts,l=e.queryParameters,d={hostsCache:t,logger:r,requester:n,requestsCache:i,responsesCache:o,timeouts:s,userAgent:u,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return I(e)})),read:function(e,t){var r=y(t,d.timeouts.read),n=function(){return E(d,d.hosts.filter((function(e){return 0!=(e.accept&v.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var i={request:e,mappedRequestOptions:r,transporter:{queryParameters:d.queryParameters,headers:d.headers}};return d.responsesCache.get(i,(function(){return d.requestsCache.get(i,(function(){return d.requestsCache.set(i,n()).then((function(e){return Promise.all([d.requestsCache.delete(i),e])}),(function(e){return Promise.all([d.requestsCache.delete(i),Promise.reject(e)])})).then((function(e){var t=a(e,2);return t[0],t[1]}))}))}),{miss:function(e){return d.responsesCache.set(i,e)}})},write:function(e,t){return E(d,d.hosts.filter((function(e){return 0!=(e.accept&v.Write)})),e,y(t,d.timeouts.write))}};return d}function q(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function T(e,t,r){var n=R(r),a="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(a+="?".concat(n)),a}function R(e){return Object.keys(e).map((function(t){return p("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function A(e){return e.map((function(e){return N(e)}))}function N(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var C=function(e){return function(t,r){return e.transporter.write({method:O,path:"2/abtests",data:t},r)}},L=function(e){return function(t,r){return e.transporter.write({method:k,path:p("2/abtests/%s",t)},r)}},K=function(e){return function(t,r){return e.transporter.read({method:D,path:p("2/abtests/%s",t)},r)}},U=function(e){return function(t){return e.transporter.read({method:D,path:"2/abtests"},t)}},z=function(e){return function(t,r){return e.transporter.write({method:O,path:p("2/abtests/%s/stop",t)},r)}},M=function(e){return function(t){return e.transporter.read({method:D,path:"1/strategies/personalization"},t)}},F=function(e){return function(t,r){return e.transporter.write({method:O,path:"1/strategies/personalization",data:t},r)}};function H(e){return function t(r){return e.request(r).then((function(n){if(void 0!==e.batch&&e.batch(n.hits),!e.shouldStop(n))return n.cursor?t({cursor:n.cursor}):t({page:(r.page||0)+1})}))}({})}var J=function(e){return function(t,a){var i=a||{},o=i.queryParameters,s=n(i,["queryParameters"]),u=r({acl:t},void 0!==o?{queryParameters:o}:{});return d(e.transporter.write({method:O,path:"1/keys",data:u},s),(function(t,r){return l((function(n){return ee(e)(t.key,r).catch((function(e){if(404!==e.status)throw e;return n()}))}))}))}},W=function(e){return function(t,r,n){var a=y(n);return a.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:O,path:"1/clusters/mapping",data:{cluster:r}},a)}},B=function(e){return function(t,r,n){return e.transporter.write({method:O,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},n)}},G=function(e){return function(t,r){return d(e.transporter.write({method:O,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(t,r){return Oe(e)(t.taskID,r)}))}},V=function(e){return function(t,r,n){return d(e.transporter.write({method:O,path:p("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:dt}}).waitTask(r.taskID,n)}))}},Q=function(e){return function(t,n,a){return V(e)(t,n,r(r({},a),{},{scope:[ft.Rules]}))}},_=function(e){return function(t,n,a){return V(e)(t,n,r(r({},a),{},{scope:[ft.Settings]}))}},X=function(e){return function(t,n,a){return V(e)(t,n,r(r({},a),{},{scope:[ft.Synonyms]}))}},$=function(e){return function(t,r){return t.method===D?e.transporter.read(t,r):e.transporter.write(t,r)}},Y=function(e){return function(t,r){return d(e.transporter.write({method:k,path:p("1/keys/%s",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).then(r).catch((function(e){if(404!==e.status)throw e}))}))}))}},Z=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"deleteEntry",body:{objectID:e}}}));return d(e.transporter.write({method:O,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(t,r){return Oe(e)(t.taskID,r)}))}},ee=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/keys/%s",t)},r)}},te=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/task/%s",t.toString())},r)}},re=function(e){return function(t){return e.transporter.read({method:D,path:"/1/dictionaries/*/settings"},t)}},ne=function(e){return function(t){return e.transporter.read({method:D,path:"1/logs"},t)}},ae=function(e){return function(t){return e.transporter.read({method:D,path:"1/clusters/mapping/top"},t)}},ie=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/clusters/mapping/%s",t)},r)}},oe=function(e){return function(t){var r=t||{},a=r.retrieveMappings,i=n(r,["retrieveMappings"]);return!0===a&&(i.getClusters=!0),e.transporter.read({method:D,path:"1/clusters/mapping/pending"},i)}},se=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return f({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},ue=function(e){return function(t){return e.transporter.read({method:D,path:"1/keys"},t)}},ce=function(e){return function(t){return e.transporter.read({method:D,path:"1/clusters"},t)}},le=function(e){return function(t){return e.transporter.read({method:D,path:"1/indexes"},t)}},de=function(e){return function(t){return e.transporter.read({method:D,path:"1/clusters/mapping"},t)}},he=function(e){return function(t,r,n){return d(e.transporter.write({method:O,path:p("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:dt}}).waitTask(r.taskID,n)}))}},fe=function(e){return function(t,r){return d(e.transporter.write({method:O,path:"1/indexes/*/batch",data:{requests:t}},r),(function(t,r){return Promise.all(Object.keys(t.taskID).map((function(n){return se(e)(n,{methods:{waitTask:dt}}).waitTask(t.taskID[n],r)})))}))}},pe=function(e){return function(t,r){return e.transporter.read({method:O,path:"1/indexes/*/objects",data:{requests:t}},r)}},me=function(e){return function(t,n){var a=t.map((function(e){return r(r({},e),{},{params:R(e.params||{})})}));return e.transporter.read({method:O,path:"1/indexes/*/queries",data:{requests:a},cacheable:!0},n)}},ye=function(e){return function(t,a){return Promise.all(t.map((function(t){var i=t.params,o=i.facetName,s=i.facetQuery,u=n(i,["facetName","facetQuery"]);return se(e)(t.indexName,{methods:{searchForFacetValues:st}}).searchForFacetValues(o,s,r(r({},a),u))})))}},ve=function(e){return function(t,r){var n=y(r);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:k,path:"1/clusters/mapping"},n)}},ge=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"addEntry",body:e}}));return d(e.transporter.write({method:O,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:a}},n),(function(t,r){return Oe(e)(t.taskID,r)}))}},be=function(e){return function(t,r){return d(e.transporter.write({method:O,path:p("1/keys/%s/restore",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).catch((function(e){if(404!==e.status)throw e;return r()}))}))}))}},xe=function(e){return function(t,r,n){var a=r.map((function(e){return{action:"addEntry",body:e}}));return d(e.transporter.write({method:O,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(t,r){return Oe(e)(t.taskID,r)}))}},we=function(e){return function(t,r,n){return e.transporter.read({method:O,path:p("/1/dictionaries/%s/search",t),data:{query:r},cacheable:!0},n)}},Ie=function(e){return function(t,r){return e.transporter.read({method:O,path:"1/clusters/mapping/search",data:{query:t}},r)}},ke=function(e){return function(t,r){return d(e.transporter.write({method:S,path:"/1/dictionaries/*/settings",data:t},r),(function(t,r){return Oe(e)(t.taskID,r)}))}},De=function(e){return function(t,r){var a=Object.assign({},r),i=r||{},o=i.queryParameters,s=n(i,["queryParameters"]),u=o?{queryParameters:o}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return d(e.transporter.write({method:S,path:p("1/keys/%s",t),data:u},s),(function(r,n){return l((function(r){return ee(e)(t,n).then((function(e){return function(e){return Object.keys(a).filter((function(e){return-1!==c.indexOf(e)})).every((function(t){if(Array.isArray(e[t])&&Array.isArray(a[t])){var r=e[t];return r.length===a[t].length&&r.every((function(e,r){return e===a[t][r]}))}return e[t]===a[t]}))}(e)?Promise.resolve():r()}))}))}))}},Oe=function(e){return function(t,r){return l((function(n){return te(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},Se=function(e){return function(t,r){return d(e.transporter.write({method:O,path:p("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),(function(t,r){return dt(e)(t.taskID,r)}))}},Pe=function(e){return function(t){return H(r(r({shouldStop:function(e){return void 0===e.cursor}},t),{},{request:function(r){return e.transporter.read({method:O,path:p("1/indexes/%s/browse",e.indexName),data:r},t)}}))}},Ee=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return H(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ut(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},je=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return H(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ct(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},qe=function(e){return function(t,r,a){var i=a||{},o=i.batchSize,s=n(i,["batchSize"]),u={taskIDs:[],objectIDs:[]};return d(function n(){var a,i=[];for(a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;a<t.length&&(i.push(t[a]),i.length!==(o||1e3));a++);return 0===i.length?Promise.resolve(u):Se(e)(i.map((function(e){return{action:r,body:e}})),s).then((function(e){return u.objectIDs=u.objectIDs.concat(e.objectIDs),u.taskIDs.push(e.taskID),a++,n(a)}))}(),(function(t,r){return Promise.all(t.taskIDs.map((function(t){return dt(e)(t,r)})))}))}},Te=function(e){return function(t){return d(e.transporter.write({method:O,path:p("1/indexes/%s/clear",e.indexName)},t),(function(t,r){return dt(e)(t.taskID,r)}))}},Re=function(e){return function(t){var r=t||{},a=r.forwardToReplicas,i=y(n(r,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),d(e.transporter.write({method:O,path:p("1/indexes/%s/rules/clear",e.indexName)},i),(function(t,r){return dt(e)(t.taskID,r)}))}},Ae=function(e){return function(t){var r=t||{},a=r.forwardToReplicas,i=y(n(r,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),d(e.transporter.write({method:O,path:p("1/indexes/%s/synonyms/clear",e.indexName)},i),(function(t,r){return dt(e)(t.taskID,r)}))}},Ne=function(e){return function(t,r){return d(e.transporter.write({method:O,path:p("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(function(t,r){return dt(e)(t.taskID,r)}))}},Ce=function(e){return function(t){return d(e.transporter.write({method:k,path:p("1/indexes/%s",e.indexName)},t),(function(t,r){return dt(e)(t.taskID,r)}))}},Le=function(e){return function(t,r){return d(Ke(e)([t],r).then((function(e){return{taskID:e.taskIDs[0]}})),(function(t,r){return dt(e)(t.taskID,r)}))}},Ke=function(e){return function(t,r){var n=t.map((function(e){return{objectID:e}}));return qe(e)(n,ht.DeleteObject,r)}},Ue=function(e){return function(t,r){var a=r||{},i=a.forwardToReplicas,o=y(n(a,["forwardToReplicas"]));return i&&(o.queryParameters.forwardToReplicas=1),d(e.transporter.write({method:k,path:p("1/indexes/%s/rules/%s",e.indexName,t)},o),(function(t,r){return dt(e)(t.taskID,r)}))}},ze=function(e){return function(t,r){var a=r||{},i=a.forwardToReplicas,o=y(n(a,["forwardToReplicas"]));return i&&(o.queryParameters.forwardToReplicas=1),d(e.transporter.write({method:k,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},o),(function(t,r){return dt(e)(t.taskID,r)}))}},Me=function(e){return function(t){return Ve(e)(t).then((function(){return!0})).catch((function(e){if(404!==e.status)throw e;return!1}))}},Fe=function(e){return function(t,r,n){return e.transporter.read({method:O,path:p("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},He=function(e){return function(t,i){var o=i||{},s=o.query,u=o.paginate,c=n(o,["query","paginate"]),l=0;return function n(){return ot(e)(s||"",r(r({},c),{},{page:l})).then((function(e){for(var r=0,i=Object.entries(e.hits);r<i.length;r++){var o=a(i[r],2),s=o[0],c=o[1];if(t(c))return{object:c,position:parseInt(s,10),page:l}}if(l++,!1===u||l>=e.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return n()}))}()}},Je=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/indexes/%s/%s",e.indexName,t)},r)}},We=function(){return function(e,t){for(var r=0,n=Object.entries(e.hits);r<n.length;r++){var i=a(n[r],2),o=i[0];if(i[1].objectID===t)return parseInt(o,10)}return-1}},Be=function(e){return function(t,a){var i=a||{},o=i.attributesToRetrieve,s=n(i,["attributesToRetrieve"]),u=t.map((function(t){return r({indexName:e.indexName,objectID:t},o?{attributesToRetrieve:o}:{})}));return e.transporter.read({method:O,path:"1/indexes/*/objects",data:{requests:u}},s)}},Ge=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/indexes/%s/rules/%s",e.indexName,t)},r)}},Ve=function(e){return function(t){return e.transporter.read({method:D,path:p("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t)}},Qe=function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},r)}},_e=function(e){return function(t,r){return d(Xe(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return dt(e)(t.taskID,r)}))}},Xe=function(e){return function(t,r){var a=r||{},i=a.createIfNotExists,o=n(a,["createIfNotExists"]),s=i?ht.PartialUpdateObject:ht.PartialUpdateObjectNoCreate;return qe(e)(t,s,o)}},$e=function(e){return function(t,o){var s=o||{},u=s.safe,c=s.autoGenerateObjectIDIfNotExist,l=s.batchSize,h=n(s,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),f=function(t,r,n,a){return d(e.transporter.write({method:O,path:p("1/indexes/%s/operation",t),data:{operation:n,destination:r}},a),(function(t,r){return dt(e)(t.taskID,r)}))},m=Math.random().toString(36).substring(7),y="".concat(e.indexName,"_tmp_").concat(m),v=tt({appId:e.appId,transporter:e.transporter,indexName:y}),g=[],b=f(e.indexName,y,"copy",r(r({},h),{},{scope:["settings","synonyms","rules"]}));return g.push(b),d((u?b.wait(h):b).then((function(){var e=v(t,r(r({},h),{},{autoGenerateObjectIDIfNotExist:c,batchSize:l}));return g.push(e),u?e.wait(h):e})).then((function(){var t=f(y,e.indexName,"move",h);return g.push(t),u?t.wait(h):t})).then((function(){return Promise.all(g)})).then((function(e){var t=a(e,3),r=t[0],n=t[1],o=t[2];return{objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(i(n.taskIDs),[o.taskID])}})),(function(e,t){return Promise.all(g.map((function(e){return e.wait(t)})))}))}},Ye=function(e){return function(t,n){return nt(e)(t,r(r({},n),{},{clearExistingRules:!0}))}},Ze=function(e){return function(t,n){return it(e)(t,r(r({},n),{},{clearExistingSynonyms:!0}))}},et=function(e){return function(t,r){return d(tt(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return dt(e)(t.taskID,r)}))}},tt=function(e){return function(t,r){var a=r||{},i=a.autoGenerateObjectIDIfNotExist,o=n(a,["autoGenerateObjectIDIfNotExist"]),s=i?ht.AddObject:ht.UpdateObject;if(s===ht.UpdateObject){var u=!0,c=!1,l=void 0;try{for(var h,f=t[Symbol.iterator]();!(u=(h=f.next()).done);u=!0)if(void 0===h.value.objectID)return d(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}catch(e){c=!0,l=e}finally{try{u||null==f.return||f.return()}finally{if(c)throw l}}}return qe(e)(t,s,o)}},rt=function(e){return function(t,r){return nt(e)([t],r)}},nt=function(e){return function(t,r){var a=r||{},i=a.forwardToReplicas,o=a.clearExistingRules,s=y(n(a,["forwardToReplicas","clearExistingRules"]));return i&&(s.queryParameters.forwardToReplicas=1),o&&(s.queryParameters.clearExistingRules=1),d(e.transporter.write({method:O,path:p("1/indexes/%s/rules/batch",e.indexName),data:t},s),(function(t,r){return dt(e)(t.taskID,r)}))}},at=function(e){return function(t,r){return it(e)([t],r)}},it=function(e){return function(t,r){var a=r||{},i=a.forwardToReplicas,o=a.clearExistingSynonyms,s=a.replaceExistingSynonyms,u=y(n(a,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return i&&(u.queryParameters.forwardToReplicas=1),(s||o)&&(u.queryParameters.replaceExistingSynonyms=1),d(e.transporter.write({method:O,path:p("1/indexes/%s/synonyms/batch",e.indexName),data:t},u),(function(t,r){return dt(e)(t.taskID,r)}))}},ot=function(e){return function(t,r){return e.transporter.read({method:O,path:p("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},st=function(e){return function(t,r,n){return e.transporter.read({method:O,path:p("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},ut=function(e){return function(t,r){return e.transporter.read({method:O,path:p("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r)}},ct=function(e){return function(t,r){return e.transporter.read({method:O,path:p("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r)}},lt=function(e){return function(t,r){var a=r||{},i=a.forwardToReplicas,o=y(n(a,["forwardToReplicas"]));return i&&(o.queryParameters.forwardToReplicas=1),d(e.transporter.write({method:S,path:p("1/indexes/%s/settings",e.indexName),data:t},o),(function(t,r){return dt(e)(t.taskID,r)}))}},dt=function(e){return function(t,r){return l((function(n){return function(e){return function(t,r){return e.transporter.read({method:D,path:p("1/indexes/%s/task/%s",e.indexName,t.toString())},r)}}(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},ht={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},ft={Settings:"settings",Synonyms:"synonyms",Rules:"rules"};function pt(e,t,n){var a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,a=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},i=a(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(i),n=a(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(i),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(i),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:{debug:function(e,t){return Promise.resolve()},info:function(e,t){return Promise.resolve()},error:function(e,t){return Promise.resolve()}},responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:s({caches:[o({key:"".concat("4.20.0","-").concat(e)}),u()]}),userAgent:q("4.20.0").add({segment:"Browser"})},i=r(r({},a),n),l=function(){return function(e){return function(e){var t=e.region||"us",n=c(m.WithinHeaders,e.appId,e.apiKey),a=j(r(r({hosts:[{url:"personalization.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return f({appId:e.appId,transporter:a},e.methods)}(r(r(r({},a),e),{},{methods:{getPersonalizationStrategy:M,setPersonalizationStrategy:F}}))}};return function(e){var t=e.appId,n=c(void 0!==e.authMode?e.authMode:m.WithinHeaders,t,e.apiKey),a=j(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:v.Read},{url:"".concat(t,".algolia.net"),accept:v.Write}].concat(h([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return f({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)}(r(r({},i),{},{methods:{search:me,searchForFacetValues:ye,multipleBatch:fe,multipleGetObjects:pe,multipleQueries:me,copyIndex:V,copySettings:_,copySynonyms:X,copyRules:Q,moveIndex:he,listIndices:le,getLogs:ne,listClusters:ce,multipleSearchForFacetValues:ye,getApiKey:ee,addApiKey:J,listApiKeys:ue,updateApiKey:De,deleteApiKey:Y,restoreApiKey:be,assignUserID:W,assignUserIDs:B,getUserID:ie,searchUserIDs:Ie,listUserIDs:de,getTopUserIDs:ae,removeUserID:ve,hasPendingMappings:oe,clearDictionaryEntries:G,deleteDictionaryEntries:Z,getDictionarySettings:re,getAppTask:te,replaceDictionaryEntries:ge,saveDictionaryEntries:xe,searchDictionaryEntries:we,setDictionarySettings:ke,waitAppTask:Oe,customRequest:$,initIndex:function(e){return function(t){return se(e)(t,{methods:{batch:Se,delete:Ce,findAnswers:Fe,getObject:Je,getObjects:Be,saveObject:et,saveObjects:tt,search:ot,searchForFacetValues:st,waitTask:dt,setSettings:lt,getSettings:Ve,partialUpdateObject:_e,partialUpdateObjects:Xe,deleteObject:Le,deleteObjects:Ke,deleteBy:Ne,clearObjects:Te,browseObjects:Pe,getObjectPosition:We,findObject:He,exists:Me,saveSynonym:at,saveSynonyms:it,getSynonym:Qe,searchSynonyms:ct,browseSynonyms:je,deleteSynonym:ze,clearSynonyms:Ae,replaceAllObjects:$e,replaceAllSynonyms:Ze,searchRules:ut,getRule:Ge,deleteRule:Ue,saveRule:rt,saveRules:nt,replaceAllRules:Ye,browseRules:Ee,clearRules:Re}})}},initAnalytics:function(){return function(e){return function(e){var t=e.region||"us",n=c(m.WithinHeaders,e.appId,e.apiKey),a=j(r(r({hosts:[{url:"analytics.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return f({appId:e.appId,transporter:a},e.methods)}(r(r(r({},a),e),{},{methods:{addABTest:C,getABTest:K,getABTests:U,stopABTest:z,deleteABTest:L}}))}},initPersonalization:l,initRecommendation:function(){return function(e){return i.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),l()(e)}}}}))}return pt.version="4.20.0",pt}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(886),t=r.n(e);class n{constructor({appId:e,SearchOnlyAPIKey:t}){this.currentSelectedIndex=-1,this.resultLinks=[],this.initAlgolia(e,t),this.initElements(),this.bindEvents()}initAlgolia(e,r){this.client=t()(e,r),this.index=this.client.initIndex("hex-blog")}initElements(){this.maskElement=this.createElement("div",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgb(255 255 255 / 10%)",zIndex:"1000",display:"none",backdropFilter:"blur(2px) saturate(190%) contrast(50%) brightness(130%)","-webkit-backdrop-filter":"blur(2px) saturate(190%) contrast(50%) brightness(130%)"}),this.maskElement.classList.add("blur-behind","search-mask"),this.parentDiv=this.createElement("div",{position:"absolute",display:"flex",flexDirection:"column",top:"57px",left:"50%",transform:"translateX(-50%)",borderRadius:"8px",boxShadow:"var(--shadow-box)",width:"50%",maxHeight:"60%",border:"1px solid var(--color-border)",background:"var(--color-bg-2)"}),this.searchWrapper=this.createElement("div",{}),this.searchInputElement=this.createElement("input",{outline:"none",border:"0",borderBottom:"1px solid var(--color-border)",width:"100%",fontSize:"18px",color:"var(--color-font)",borderRadius:"8px 8px 0 0",background:"transparent",fontFamily:"var(--font-regular)",padding:"1.2rem",type:"text",placeholder:"搜索关键词"}),this.searchInputElement.setAttribute("placeholder",window.i18n["text-search"]),this.searchResultsDiv=this.createElement("div",{flex:"1",overflowY:"auto",borderRadius:"0 0 8px 8px"}),this.bottomKeycapsDiv=this.createElement("div",{display:"flex",alignItems:"center",padding:"1rem 1.2rem"}),this.bottomKeycapsDiv=this.createStyledElement("div",{display:"flex",alignItems:"center",padding:"1rem 1.2rem"}),this.bottomKeycapsDiv.appendChild(this.createKeyElement("↵")),this.bottomKeycapsDiv.appendChild(this.createTipElement(window.i18n["text-select"])),this.bottomKeycapsDiv.appendChild(this.createKeyElement("↑")),this.bottomKeycapsDiv.appendChild(this.createKeyElement("↓")),this.bottomKeycapsDiv.appendChild(this.createTipElement(window.i18n["text-move"])),this.bottomKeycapsDiv.appendChild(this.createKeyElement("esc")),this.bottomKeycapsDiv.appendChild(this.createTipElement(window.i18n["text-esc"])),this.searchResultsDiv.classList.add("scrollbar-obtrusive"),this.searchWrapper.appendChild(this.searchInputElement),this.parentDiv.append(this.searchWrapper,this.searchResultsDiv,this.bottomKeycapsDiv),this.maskElement.appendChild(this.parentDiv),document.body.appendChild(this.maskElement)}createStyledElement(e,t){const r=document.createElement(e);for(const[e,n]of Object.entries(t))r.style[e]=n;return r}createKeyElement(e){const t=this.createStyledElement("kbd",{});t.className="key-cap";const r=document.createElement("span");return r.textContent=e,t.appendChild(r),t}createTipElement(e){const t=this.createStyledElement("em",{fontWeight:"300",fontStyle:"initial",fontSize:"12px",color:"var(--color-font-2)",margin:"0 20px 0 6px"});return t.textContent=e,t}createArrowRightSVG(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 20 20"),e.setAttribute("width","12px"),e.setAttribute("height","12px");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.setAttribute("fill","none");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M7.646 4.147a.5.5 0 0 1 .707-.001l5.484 5.465a.55.55 0 0 1 0 .779l-5.484 5.465a.5.5 0 0 1-.706-.708L12.812 10L7.647 4.854a.5.5 0 0 1-.001-.707z"),r.setAttribute("fill","currentColor"),t.appendChild(r),e.appendChild(t),e}createElement(e,t){const r=document.createElement(e);return Object.assign(r.style,t),r}show(){this.maskElement.style.display="block",this.searchInputElement.focus()}hide(){this.maskElement.style.display="none"}bindEvents(){this.maskElement.addEventListener("click",(e=>{e.target===this.maskElement?this.hide():this.searchInputElement.focus()})),this.searchInputElement.addEventListener("input",(()=>this.performSearch())),document.addEventListener("keydown",(e=>{"block"===this.maskElement.style.display&&this.handleKeydown(e),"Escape"===e.key&&this.hide()}))}performSearch(){const e=this.searchInputElement.value;e?this.index.search(e).then((({hits:t})=>{if(this.searchResultsDiv.innerHTML="",this.currentSelectedIndex=-1,this.resultLinks=[],0===t.length)return this.searchResultsDiv.style.display="none";t.forEach(((t,r)=>{const n=this.createResultLink(t,e,r);this.searchResultsDiv.appendChild(n),this.resultLinks.push(n)})),this.searchResultsDiv.style.display="block"})):this.searchResultsDiv.style.display="none"}createResultLink(e,t,r){const n=this.createElement("a",{margin:"10px 0 0 0",display:"block",padding:"0 10px",textDecoration:"none"});n.href=e.permalink;const a=this.createElement("div",{fontFamily:"var(--font-regular)",padding:"8px",borderRadius:"var(--radius)",transition:"all .25s ease"}),i=this.createElement("span",{display:"flex",alignItems:"center",fontSize:"12px",color:"var(--color-font-2)"}),o=this.createElement("span",{padding:"0 0 0 5px",fontSize:"13px",letterSpacing:"1px",fontWeight:"300",color:"var(--color-font)"});o.textContent=e.title,i.append(e.categories[0],this.createArrowRightSVG(),o);const s=this.createElement("div",{paddingTop:"6px",fontFamily:"var(--font-regular)",color:"var(--color-font-2)",whiteSpace:"nowrap",lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis",fontSize:"12px"});return s.innerHTML=this.highlightKeyword(e.contentStrip,t),a.append(i,s),n.append(a),n.addEventListener("mouseenter",(()=>{this.updateCurrentSelectedIndex(r)})),n.addEventListener("mouseleave",(()=>{n.children[0].style.backgroundColor="transparent"})),n}highlightKeyword(e,t){const r=new RegExp(`(.{0,20})(${t})(.{0,20})`,"i"),n=e.match(r);return n?`${n[1]}<mark style="margin:0 3px;background:transparent;color:var(--color-primary);text-decoration:underline">${n[2]}</mark>${n[3]}`:e}updateCurrentSelectedIndex(e){if(-1!==this.currentSelectedIndex){this.resultLinks[this.currentSelectedIndex].children[0].style.backgroundColor="transparent"}this.currentSelectedIndex=e;this.resultLinks[this.currentSelectedIndex].children[0].style.backgroundColor="var(--color-primary-2)"}handleKeydown(e){switch(e.key){case"ArrowUp":this.moveSelection(-1),e.preventDefault();break;case"ArrowDown":this.moveSelection(1),e.preventDefault();break;case"Enter":-1!==this.currentSelectedIndex&&(window.location.href=this.resultLinks[this.currentSelectedIndex].href)}}ensureActiveLinkVisible(){const e=this.resultLinks[this.currentSelectedIndex];if(!e)return;if(0===this.currentSelectedIndex)return void(this.searchResultsDiv.scrollTop=0);const t=e.offsetTop,r=e.offsetHeight,n=this.searchResultsDiv.scrollTop,a=this.searchResultsDiv.offsetHeight;t<n?this.searchResultsDiv.scrollTop=t:t+r>n+a&&(this.searchResultsDiv.scrollTop=t+r-a)}moveSelection(e){if(-1!==this.currentSelectedIndex){this.resultLinks[this.currentSelectedIndex].children[0].style.backgroundColor="transparent"}this.currentSelectedIndex=Math.max(0,Math.min(this.currentSelectedIndex+e,this.resultLinks.length-1));this.resultLinks[this.currentSelectedIndex].children[0].style.backgroundColor="var(--color-primary-2)",this.ensureActiveLinkVisible()}}document.addEventListener("DOMContentLoaded",(()=>{var e;const t=new n({appId:window.algolia.appId,SearchOnlyAPIKey:window.algolia.SearchOnlyAPIKey});document.addEventListener("keydown",(e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(e.preventDefault(),t.show())})),null===(e=document.querySelector(".search-group"))||void 0===e||e.addEventListener("click",(function(){t.show()}))}))})()})();