mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
1 line
4.1 KiB
JavaScript
1 line
4.1 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[97920],{64180:(e,t,a)=>{a.r(t),a.d(t,{default:()=>_});var n=a(67294),r=a(8241),l=a(58526),s=a(71098),c=a(31984),o=a(92210);const u=["zero","one","two","few","many","other"];function m(e){return u.filter((t=>e.includes(t)))}const h={locale:"en",pluralForms:m(["one","other"]),select:e=>1===e?"one":"other"};function i(){const{i18n:{currentLocale:e}}=(0,r.Z)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:m(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),h}}),[e])}function p(){const e=i();return{selectMessage:(t,a)=>function(e,t,a){const n=e.split("|");if(1===n.length)return n[0];n.length>a.pluralForms.length&&console.error(`For locale=${a.locale}, a maximum of ${a.pluralForms.length} plural forms are expected (${a.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const r=a.select(t),l=a.pluralForms.indexOf(r);return n[Math.min(l,n.length-1)]}(a,t,e)}}var d=a(76775),g=a(58087);const f=function(){const e=(0,d.k6)(),t=(0,d.TH)(),{siteConfig:{baseUrl:a}}=(0,r.Z)();return{searchValue:g.Z.canUseDOM&&new URLSearchParams(t.search).get("q")||"",updateSearchPath:a=>{const n=new URLSearchParams(t.search);a?n.set("q",a):n.delete("q"),e.replace({search:n.toString()})},generateSearchPageLink:e=>`${a}search?q=${encodeURIComponent(e)}`}};var E=a(99924),y=a(50846),S=a(3007),w=a(97072),b=a(36812),I=a(93069);const P="searchQueryInput_CFBF",R="searchResultItem_U687",v="searchResultItemPath_uIbk",F="searchResultItemSummary_oZHr";var k=a(81523);function C({searchResult:{document:e,type:t,page:a,tokens:r,metadata:l}}){const s=0===t,o=2===t,u=(s?e.b:a.b).slice(),m=o?e.s:e.t;return s||u.push(a.t),n.createElement("article",{className:R},n.createElement("h2",null,n.createElement(c.Z,{to:e.u+(e.h||""),dangerouslySetInnerHTML:{__html:o?(0,S.C)(m,r):(0,w.o)(m,(0,b.m)(l,"t"),r,100)}})),u.length>0&&n.createElement("p",{className:v},(0,k.e)(u)),o&&n.createElement("p",{className:F,dangerouslySetInnerHTML:{__html:(0,w.o)(e.t,(0,b.m)(l,"t"),r,100)}}))}const _=function(){const{siteConfig:{baseUrl:e}}=(0,r.Z)(),{selectMessage:t}=p(),{searchValue:a,updateSearchPath:c}=f(),[u,m]=(0,n.useState)(a),[h,i]=(0,n.useState)(),[d,g]=(0,n.useState)(),S=(0,n.useMemo)((()=>u?(0,o.I)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:u}):(0,o.I)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"})),[u]);(0,n.useEffect)((()=>{c(u),h&&(u?h(u,(e=>{g(e)})):g(void 0))}),[u,h]);const w=(0,n.useCallback)((e=>{m(e.target.value)}),[]);return(0,n.useEffect)((()=>{a&&a!==u&&m(a)}),[a]),(0,n.useEffect)((()=>{!async function(){const{wrappedIndexes:t,zhDictionary:a}=await(0,E.w)(e);i((()=>(0,y.v)(t,a,100)))}()}),[e]),n.createElement(l.Z,null,n.createElement(s.Z,null,n.createElement("meta",{property:"robots",content:"noindex, follow"}),n.createElement("title",null,S)),n.createElement("div",{className:"container margin-vert--lg"},n.createElement("h1",null,S),n.createElement("input",{type:"search",name:"q",className:P,"aria-label":"Search",onChange:w,value:u,autoComplete:"off",autoFocus:!0}),!h&&u&&n.createElement("div",null,n.createElement(I.Z,null)),d&&(d.length>0?n.createElement("p",null,t(d.length,(0,o.I)({id:"theme.SearchPage.documentsFound.plurals",message:"1 document found|{count} documents found",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)'},{count:d.length}))):n.createElement("p",null,(0,o.I)({id:"theme.SearchPage.noResultsText",message:"No documents were found",description:"The paragraph for empty search result"}))),n.createElement("section",null,d&&d.map((e=>n.createElement(C,{key:e.document.i,searchResult:e}))))))}}}]); |