cocos-enhance-kit/assets/js/1a4e3797.4aa4ddb2.js

1 line
4.6 KiB
JavaScript

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7920],{8824:function(e,t,n){n.d(t,{c:function(){return o}});var r=n(7294),a=n(2263),l=["zero","one","two","few","many","other"];function u(e){return l.filter((function(t){return e.includes(t)}))}var c={locale:"en",pluralForms:u(["one","other"]),select:function(e){return 1===e?"one":"other"}};function s(){var e=(0,a.Z)().i18n.currentLocale;return(0,r.useMemo)((function(){try{return t=e,n=new Intl.PluralRules(t),{locale:t,pluralForms:u(n.resolvedOptions().pluralCategories),select:function(e){return n.select(e)}}}catch(r){return console.error('Failed to use Intl.PluralRules for locale "'+e+'".\nDocusaurus will fallback to the default (English) implementation.\nError: '+r.message+"\n"),c}var t,n}),[e])}function o(){var e=s();return{selectMessage:function(t,n){return function(e,t,n){var r=e.split("|");if(1===r.length)return r[0];r.length>n.pluralForms.length&&console.error("For locale="+n.locale+", a maximum of "+n.pluralForms.length+" plural forms are expected ("+n.pluralForms+"), but the message contains "+r.length+": "+e);var a=n.select(t),l=n.pluralForms.indexOf(a);return r[Math.min(l,r.length-1)]}(n,t,e)}}}},1473:function(e,t,n){n.r(t),n.d(t,{default:function(){return C}});var r=n(5861),a=n(7757),l=n.n(a),u=n(7294),c=n(2263),s=n(8476),o=n(5742),i=n(9960),m=n(5999),h=n(8824),f=n(6775),p=n(412);var d=function(){var e=(0,f.k6)(),t=(0,f.TH)(),n=(0,c.Z)().siteConfig.baseUrl;return{searchValue:p.Z.canUseDOM&&new URLSearchParams(t.search).get("q")||"",updateSearchPath:function(n){var r=new URLSearchParams(t.search);n?r.set("q",n):r.delete("q"),e.replace({search:r.toString()})},generateSearchPageLink:function(e){return n+"search?q="+encodeURIComponent(e)}}},g=n(22),v=n(8202),y=n(2539),E=n(726),S=n(1073),w=n(311),I="searchQueryInput_CFBF",b="searchResultItem_U687",F="searchResultItemPath_uIbk",P="searchResultItemSummary_oZHr",k=n(3926);function R(e){var t=e.searchResult,n=t.document,r=t.type,a=t.page,l=t.tokens,c=t.metadata,s=0===r,o=2===r,m=(s?n.b:a.b).slice(),h=o?n.s:n.t;return s||m.push(a.t),u.createElement("article",{className:b},u.createElement("h2",null,u.createElement(i.Z,{to:n.u+(n.h||""),dangerouslySetInnerHTML:{__html:o?(0,y.C)(h,l):(0,E.o)(h,(0,S.m)(c,"t"),l,100)}})),m.length>0&&u.createElement("p",{className:F},(0,k.e)(m)),o&&u.createElement("p",{className:P,dangerouslySetInnerHTML:{__html:(0,E.o)(n.t,(0,S.m)(c,"t"),l,100)}}))}var C=function(){var e=(0,c.Z)().siteConfig.baseUrl,t=(0,h.c)().selectMessage,n=d(),a=n.searchValue,i=n.updateSearchPath,f=(0,u.useState)(a),p=f[0],y=f[1],E=(0,u.useState)(),S=E[0],b=E[1],F=(0,u.useState)(),P=F[0],k=F[1],C=(0,u.useMemo)((function(){return p?(0,m.I)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:p}):(0,m.I)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"})}),[p]);(0,u.useEffect)((function(){i(p),S&&(p?S(p,(function(e){k(e)})):k(void 0))}),[p,S]);var Z=(0,u.useCallback)((function(e){y(e.target.value)}),[]);return(0,u.useEffect)((function(){a&&a!==p&&y(a)}),[a]),(0,u.useEffect)((function(){function t(){return(t=(0,r.Z)(l().mark((function t(){var n,r,a;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,g.w)(e);case 2:n=t.sent,r=n.wrappedIndexes,a=n.zhDictionary,b((function(){return(0,v.v)(r,a,100)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function(){t.apply(this,arguments)}()}),[e]),u.createElement(s.Z,null,u.createElement(o.Z,null,u.createElement("meta",{property:"robots",content:"noindex, follow"}),u.createElement("title",null,C)),u.createElement("div",{className:"container margin-vert--lg"},u.createElement("h1",null,C),u.createElement("input",{type:"search",name:"q",className:I,"aria-label":"Search",onChange:Z,value:p,autoComplete:"off",autoFocus:!0}),!S&&p&&u.createElement("div",null,u.createElement(w.Z,null)),P&&(P.length>0?u.createElement("p",null,t(P.length,(0,m.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:P.length}))):u.createElement("p",null,(0,m.I)({id:"theme.SearchPage.noDocumentsFound",message:"No documents were found",description:"The paragraph for empty search result"}))),u.createElement("section",null,P&&P.map((function(e){return u.createElement(R,{key:e.document.i,searchResult:e})})))))}}}]);