mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[97920],{79935:(e,t,a)=>{a.r(t),a.d(t,{default:()=>H});var r=a(58087),c=a(71098),n=a(31984),l=a(55995),s=a(40060),o=a(80958),u=a(18168),i=a(37806),m=a(89712),h=a(54995),g=a(92210),p=a(8241),d=a(98461),f=a(70290),v=a.n(f),b=a(8131),y=a.n(b),E=a(86010),P=a(67294),w=a(68263);const O="searchQueryInput_cpyO",S="searchVersionInput_wf2r",_="searchResultsColumn_PLpb",j="algoliaLogo_YElR",z="algoliaLogoPathFill_grp5",R="searchResultItem_AlWU",V="searchResultItemHeading_HJFH",N="searchResultItemPath_x9Ef",I="searchResultItemSummary_jej3",k="searchQueryColumn_hQFc",M="searchVersionColumn_GkmC",T="searchLogoColumn_Mj_0",F="loadingSpinner_E_zt",C="loader_ujSQ";function D(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Z(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},r=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),r.forEach((function(t){D(e,t,a[t])}))}return e}function x(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))})),e}function L({docsSearchVersionsHelpers:e}){const t=Object.entries(e.allDocsData).filter((([,e])=>e.versions.length>1));return P.createElement("div",{className:(0,E.Z)("col","col--3","padding-left--none",M)},t.map((([a,r])=>{const c=t.length>1?`${a}: `:"";return P.createElement("select",{key:a,onChange:t=>e.setSearchVersion(a,t.target.value),defaultValue:e.searchVersions[a],className:S},r.versions.map(((e,t)=>P.createElement("option",{key:t,label:`${c}${e.label}`,value:e.name}))))})))}function A(){const{siteConfig:{themeConfig:e},i18n:{currentLocale:t}}=(0,p.Z)(),{algolia:{appId:a,apiKey:m,indexName:f,externalUrlRegex:b}}=e,S=function(){const{selectMessage:e}=(0,s.c)();return t=>e(t,(0,g.I)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),M=function(){const e=(0,l._r)(),[t,a]=(0,P.useState)((()=>Object.entries(e).reduce(((e,[t,a])=>x(Z({},e),{[t]:a.versions[0].name})),{}))),r=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:r,searchVersions:t,setSearchVersion:(e,t)=>a((a=>x(Z({},a),{[e]:t})))}}(),[D,A]=(0,o.K)(),H={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[q,$]=(0,P.useReducer)(((e,t)=>{switch(t.type){case"reset":return H;case"loading":return x(Z({},e),{loading:!0});case"update":return D!==t.value.query?e:x(Z({},t.value),{items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)});case"advance":{const t=e.totalPages>e.lastPage+1;return x(Z({},e),{lastPage:t?e.lastPage+1:e.lastPage,hasMore:t})}default:return e}}),H),Q=v()(a,m),U=y()(Q,f,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","counter"]});U.on("result",(({results:{query:e,hits:t,page:a,nbHits:r,nbPages:c}})=>{if(""===e||!Array.isArray(t))return void $({type:"reset"});const n=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),l=t.map((({url:e,_highlightResult:{hierarchy:t},_snippetResult:a={}})=>{const r=new URL(e),c=Object.keys(t).map((e=>n(t[e].value)));return{title:c.pop(),url:(0,u.F)(b,r.href)?r.href:r.pathname+r.hash,summary:a.content?`${n(a.content.value)}...`:"",breadcrumbs:c}}));$({type:"update",value:{items:l,query:e,total
|