speice.io/assets/js/4294.a7567dcb.js

101 lines
102 KiB
JavaScript
Raw Permalink Normal View History

(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["4294"],{1639:function(e,t,n){"use strict";e.exports=n(9281)},7114:function(e,t,n){"use strict";var i=n(5670),r={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:"0"},defaultClasses:{root:"algolia-autocomplete",prefix:"aa",noPrefix:!1,dropdownMenu:"dropdown-menu",input:"input",hint:"hint",suggestions:"suggestions",suggestion:"suggestion",cursor:"cursor",dataset:"dataset",empty:"empty"},appendTo:{wrapper:{position:"absolute",zIndex:"100",display:"none"},input:{},inputWithNoHint:{},dropdown:{display:"block"}}};i.isMsie()&&i.mixin(r.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),i.isMsie()&&7>=i.isMsie()&&i.mixin(r.input,{marginTop:"-1px"}),e.exports=r},3312:function(e,t,n){"use strict";var i="aaDataset",r="aaValue",s="aaDatum",o=n(5670),a=n(3855),u=n(6619),c=n(7114),l=n(6823);function h(e){(e=e||{}).templates=e.templates||{},!e.source&&o.error("missing source"),e.name&&!function(e){return/^[_a-zA-Z0-9-]+$/.test(e)}(e.name)&&o.error("invalid dataset name: "+e.name),this.query=null,this._isEmpty=!0,this.highlight=!!e.highlight,this.name=void 0===e.name||null===e.name?o.getUniqueId():e.name,this.source=e.source,this.displayFn=function(e){return e=e||"value",o.isFunction(e)?e:function(t){return t[e]}}(e.display||e.displayKey),this.debounce=e.debounce,this.cache=!1!==e.cache,this.templates=function(e,t){return{empty:e.empty&&o.templatify(e.empty),header:e.header&&o.templatify(e.header),footer:e.footer&&o.templatify(e.footer),suggestion:e.suggestion||function(e){return"<p>"+t(e)+"</p>"}}}(e.templates,this.displayFn),this.css=o.mixin({},c,e.appendTo?c.appendTo:{}),this.cssClasses=e.cssClasses=o.mixin({},c.defaultClasses,e.cssClasses||{}),this.cssClasses.prefix=e.cssClasses.formattedPrefix||o.formatPrefix(this.cssClasses.prefix,this.cssClasses.noPrefix);var t=o.className(this.cssClasses.prefix,this.cssClasses.dataset);this.$el=e.$menu&&e.$menu.find(t+"-"+this.name).length>0?a.element(e.$menu.find(t+"-"+this.name)[0]):a.element(u.dataset.replace("%CLASS%",this.name).replace("%PREFIX%",this.cssClasses.prefix).replace("%DATASET%",this.cssClasses.dataset)),this.$menu=e.$menu,this.clearCachedSuggestions()}h.extractDatasetName=function(e){return a.element(e).data(i)},h.extractValue=function(e){return a.element(e).data(r)},h.extractDatum=function(e){var t=a.element(e).data(s);return"string"==typeof t&&(t=JSON.parse(t)),t},o.mixin(h.prototype,l,{_render:function(e,t){if(!!this.$el){var n,c=this,l=[].slice.call(arguments,2);if(this.$el.empty(),n=t&&t.length,this._isEmpty=!n,!n&&this.templates.empty)this.$el.html((function(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!0}].concat(t),c.templates.empty.apply(this,t)}).apply(this,l)).prepend(c.templates.header?h.apply(this,l):null).append(c.templates.footer?p.apply(this,l):null);else if(n)this.$el.html((function(){var e,n,l=[].slice.call(arguments,0),h=this,p=u.suggestions.replace("%PREFIX%",this.cssClasses.prefix).replace("%SUGGESTIONS%",this.cssClasses.suggestions);return e=a.element(p).css(this.css.suggestions),n=o.map(t,function(e){var t,n=u.suggestion.replace("%PREFIX%",h.cssClasses.prefix).replace("%SUGGESTION%",h.cssClasses.suggestion);return(t=a.element(n).attr({role:"option",id:["option",Math.floor(1e8*Math.random())].join("-")}).append(c.templates.suggestion.apply(this,[e].concat(l)))).data(i,c.name),t.data(r,c.displayFn(e)||void 0),t.data(s,JSON.stringify(e)),t.children().each(function(){a.element(this).css(h.css.suggestionChild)}),t}),e.append.apply(e,n),e}).
<a class="${l}
{{#isCategoryHeader}}${l}__main{{/isCategoryHeader}}
{{#isSubCategoryHeader}}${l}__secondary{{/isSubCategoryHeader}}
"
aria-label="Link to the result"
href="{{{url}}}"
>
<div class="${l}--category-header">
<span class="${l}--category-header-lvl0">{{{category}}}</span>
</div>
<div class="${l}--wrapper">
<div class="${l}--subcategory-column">
<span class="${l}--subcategory-column-text">{{{subcategory}}}</span>
</div>
{{#isTextOrSubcategoryNonEmpty}}
<div class="${l}--content">
<div class="${l}--subcategory-inline">{{{subcategory}}}</div>
<div class="${l}--title">{{{title}}}</div>
{{#text}}<div class="${l}--text">{{{text}}}</div>{{/text}}
{{#version}}<div class="${l}--version">{{version}}</div>{{/version}}
</div>
{{/isTextOrSubcategoryNonEmpty}}
</div>
</a>
`,suggestionSimple:`
<div class="${l}
{{#isCategoryHeader}}${l}__main{{/isCategoryHeader}}
{{#isSubCategoryHeader}}${l}__secondary{{/isSubCategoryHeader}}
suggestion-layout-simple
">
<div class="${l}--category-header">
{{^isLvl0}}
<span class="${l}--category-header-lvl0 ${l}--category-header-item">{{{category}}}</span>
{{^isLvl1}}
{{^isLvl1EmptyOrDuplicate}}
<span class="${l}--category-header-lvl1 ${l}--category-header-item">
{{{subcategory}}}
</span>
{{/isLvl1EmptyOrDuplicate}}
{{/isLvl1}}
{{/isLvl0}}
<div class="${l}--title ${l}--category-header-item">
{{#isLvl2}}
{{{title}}}
{{/isLvl2}}
{{#isLvl1}}
{{{subcategory}}}
{{/isLvl1}}
{{#isLvl0}}
{{{category}}}
{{/isLvl0}}
</div>
</div>
<div class="${l}--wrapper">
{{#text}}
<div class="${l}--content">
<div class="${l}--text">{{{text}}}</div>
</div>
{{/text}}
</div>
</div>
`,footer:`
<div class="${h}">
</div>
`,empty:`
<div class="${l}">
<div class="${l}--wrapper">
<div class="${l}--content ${l}--no-results">
<div class="${l}--title">
<div class="${l}--text">
No results found for query <b>"{{query}}"</b>
</div>
</div>
</div>
</div>
</div>
`,searchBox:`
<form novalidate="novalidate" onsubmit="return false;" class="searchbox">
<div role="search" class="searchbox__wrapper">
<input id="docsearch" type="search" name="search" placeholder="Search the docs" autocomplete="off" required="required" class="searchbox__input"/>
<button type="submit" title="Submit your search query." class="searchbox__submit" >
<svg width=12 height=12 role="img" aria-label="Search">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-search-13"></use>
</svg>
</button>
<button type="reset" title="Clear the search query." class="searchbox__reset hide">
<svg width=12 height=12 role="img" aria-label="Reset">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-clear-3"></use>
</svg>
</button>
</div>
</form>
<div class="svg-icons" style="height: 0; width: 0; position: absolute; visibility: hidden">
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="sbx-icon-clear-3" viewBox="0 0 40 40"><path d="M16.228 20L1.886 5.657 0 3.772 3.772 0l1.885 1.886L20 16.228 34.343 1.886 36.228 0 40 3.772l-1.886 1.885L23.772 20l14.342 14.343L40 36.228 36.228 40l-1.885-1.886L20 23.772 5.657 38.114 3.772 40 0 36.228l1.886-1.885L16.228 20z" fill-rule="evenodd"></symbol>
<symbol id="sbx-icon-search-13" viewBox="0 0 40 40"><path d="M26.806 29.012a16.312 16.312 0 0 1-10.427 3.746C7.332 32.758 0 25.425 0 16.378 0 7.334 7.333 0 16.38 0c9.045 0 16.378 7.333 16.378 16.38 0 3.96-1.406 7.593-3.746 10.426L39.547 37.34c.607.608.61 1.59-.004 2.203a1.56 1.56 0 0 1-2.202.004L26.807 29.012zm-10.427.627c7.322 0 13.26-5.938 13.26-13.26 0-7.324-5.938-13.26-13.26-13.26-7.324 0-13.26 5.936-13.26 13.26 0 7.322 5.936 13.26 13.26 13.26z" fill-rule="evenodd"></symbol>
</svg>
</div>
`};var d=n("7939"),f=n.n(d);let g={mergeKeyWithParent(e,t){if(void 0===e[t]||"object"!=typeof e[t])return e;let n=f().extend({},e,e[t]);return delete n[t],n},groupBy(e,t){let n={};return f().each(e,(e,i)=>{if(void 0===i[t])throw Error(`[groupBy]: Object has no key ${t}`);let r=i[t];"string"==typeof r&&(r=r.toLowerCase()),!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=[]),n[r].push(i)}),n},values:e=>Object.keys(e).map(t=>e[t]),flatten(e){let t=[];return e.forEach(e=>{if(!Array.isArray(e)){t.push(e);return}e.forEach(e=>{t.push(e)})}),t},flattenAndFlagFirst(e,t){let n=this.values(e).map(e=>e.map((e,n)=>(e[t]=0===n,e)));return this.flatten(n)},compact(e){let t=[];return e.forEach(e=>{if(!!e)t.push(e)}),t},getHighlightedValue:(e,t)=>e._highlightResult&&e._highlightResult.hierarchy_camel&&e._highlightResult.hierarchy_camel[t]&&e._highlightResult.hierarchy_camel[t].matchLevel&&"none"!==e._highlightResult.hierarchy_camel[t].matchLevel&&e._highlightResult.hierarchy_camel[t].value?e._highlightResult.hierarchy_camel[t].value:e._highlightResult&&e._highlightResult&&e._highlightResult[t]&&e._highlightResult[t].value?e._highlightResult[t].value:e[t],getSnippetedValue(e,t){if(!e._snippetResult||!e._snippetResult[t]||!e._snippetResult[t].value)return e[t];let n=e._snippetResult[t].value;return n[0]!==n[0].toUpperCase()&&(n=`\u{2026}${n}`),-1===[".","!","?"].indexOf(n[n.length-1])&&(n=`${n}\u{2026}`),n},deepClone:e=>JSON.parse(JSON.stringify(e))};class m{constructor({searchDocs:e,searchIndex:t,inputSelector:n,debug:i=!1,baseUrl:r="/",queryDataCallback:s=null,autocompleteOptions:a={debug:!1,hint:!1,autoselect:!0},transformData:c=!1,queryHook:l=!1,handleSelected:h=!1,enhancedSearchInput:d=!1,layout:g="column",maxHits:v=5}){this.input=m.getInputFromSelector(n),this.queryDataCallback=s||null;let y=!!a&&!!a.debug&&a.debug;a.debug=i||y,this.autocompleteOptions=a,this.autocompleteOptions.cssClasses=this.autocompleteOptions.cssClasses||{},this.autocompleteOptions.cssClasses.prefix=this.autocompleteOptions.cssClasses.prefix||"ds";let x=this.input&&"function"==typeof this.input.attr&&this.input.attr("aria-label");this.autocompleteOptions.ariaLabel=this.autocompleteOptions.ariaLabel||x||"search input",this.isSimpleLayout="simple"===g,this.client=new o(e,t,r,v),d&&(this.input=m.injectSearchBox(this.input)),this.autocomplete=u()(this.input,a,[{source:this.getAutocompleteSource(c,l),templates:{suggestion:m.getSuggestionTemplate(this.isSimpleLayout),footer:p.footer,empty:m.getEmptyTemplate()}}]);this.handleSelected=h||this.handleSelected,h&&f()(".algolia-autocomplete").on("click",".ds-suggestions a",e=>{e.preventDefault()}),this.autocomplete.on("autocomplete:selected",this.handleSelected.bind(null,this.autocomplete.autocomplete)),this.autocomplete.on("autocomplete:shown",this.handleShown.bind(null,this.input)),d&&m.bindSearchBoxEvent(),document.addEventListener("keydown",e=>{(e.ctrlKey||e.metaKey)&&"k"==e.key&&(this.input.focus(),e.preventDefault())})}static injectSearchBox(e){e.before(p.searchBox);let t=e.prev().prev().find("input");return e.remove(),t}static bindSearchBoxEvent(){f()('.searchbox [type="reset"]').on("click",function(){f()("input#docsearch").focus(),f()(this).addClass("hide"),u().autocomplete.setVal("")}),f()("input#docsearch").on("keyup",()=>{let e=document.querySelector("input#docsearch"),t=document.querySelector('.searchbox [type="reset"]');t.className="searchbox__reset",0===e.value.length&&(t.className+=" hide")})}static getInputFromSelector(e){let t=f()(e).filter("input");return t.length?f()(t[0]):null}getAutocompleteSource(e,t){return(n,i)=>{t&&(n=t(n)||n),this.client.search(n).then(t=>{this.queryDataCallback&&"function"==typeof this.queryDataCallback&&this.queryDataCallback(t),e&&(t=e(t)||t),i(m.formatHits(t))})}}static formatHits(e){let t=g.deepClone(e).map(e=>(e._highlightResult&&(e._highlightResult=g.mergeKeyWithParent(e._highlightResult,"hierarchy")),g.mergeKeyWithParent(e,"hierarchy"))),n=g.groupBy(t,"lvl0");return f().each(n,(e,t)=>{let i=g.groupBy(t,"lvl1"),r=g.flattenAndFlagFirst(i,"isSubCategoryHeader");n[e]=r}),(n