(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[451],{6746:function(e,t,s){"use strict";s.r(t),t.default={src:"/_next/static/media/spin.6ffd8bb2.svg",height:38,width:38,blurWidth:0,blurHeight:0}},5986:function(e,t,s){"use strict";s.d(t,{t3:function(){return c}});var a=s(9729),i=s.n(a),n=s(6803),r=s.n(n),o=s(3454);let l={dataset:"production",projectId:"yy2m8799",useCdn:!0,apiVersion:"2021-10-21"},h=i()(l),c=r()(h);i()({...l,useCdn:!1,token:o.env.SANITY_API_TOKEN})},451:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return c}});var a=s(5893),i=s(1664),n=s.n(i);s(5675);var r=s(6969),o=s.n(r),l=s(5880);s(5986);var h=s(7294),c=function(e){let{searchType:t}=e,[s,i]=(0,h.useState)("default");return(0,h.useState)(()=>{},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:o().header,children:(0,a.jsxs)("div",{className:o().headerHolder,children:[(0,a.jsx)(n(),{href:"/",style:{display:"open"==s?"none":"auto"},children:(0,a.jsx)("span",{className:o().logoHolder,children:(0,a.jsx)("img",{className:o().logo,src:"/logo.svg",width:73,height:22,alt:"SVG Repo - Search, explore, edit and share open licensed SVG vectors"})})}),(0,a.jsx)(l.Z,{searchType:t,mobileSearchState:s}),(0,a.jsxs)("ul",{className:o().menuMobile,style:{display:"open"==s?"none":"auto"},children:[(0,a.jsx)("li",{children:(0,a.jsx)(n(),{legacyBehavior:!0,href:"/saved/",alt:"Saved Vectors",title:"Saved Vectors",children:(0,a.jsx)("a",{alt:"Saved Vectors",title:"Saved Vectors",children:(0,a.jsx)("svg",{style:{position:"relative",top:5,marginLeft:5,marginRight:5},width:"21",height:"21",viewBox:"0 0 24 24",fill:"none",stroke:"#333",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})})})})}),(0,a.jsx)("li",{children:(0,a.jsx)("div",{onClick:()=>i("open"),children:(0,a.jsx)("svg",{style:{position:"relative",top:5,marginLeft:5,marginRight:5},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"21",height:"21",fill:"#333",children:(0,a.jsx)("path",{d:"M16.32 14.9l5.39 5.4a1 1 0 0 1-1.42 1.4l-5.38-5.38a8 8 0 1 1 1.41-1.41zM10 16a6 6 0 1 0 0-12 6 6 0 0 0 0 12z"})})})})]}),(0,a.jsxs)("ul",{className:o().menu,children:[(0,a.jsx)("li",{children:(0,a.jsx)(n(),{href:"/collections/",children:"Vector Collections"})}),(0,a.jsx)("li",{children:(0,a.jsx)(n(),{legacyBehavior:!0,href:"/saved/",alt:"Saved Vectors",title:"Saved Vectors",children:(0,a.jsx)("a",{alt:"Saved Vectors",title:"Saved Vectors",children:(0,a.jsx)("svg",{style:{position:"relative",top:5,marginLeft:5,marginRight:5},width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#333",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})})})})})]})]})}),(0,a.jsx)("div",{className:o().headerSpacer})]})}},5880:function(e,t,s){"use strict";var a=s(5893),i=s(7294),n=s(1664),r=s.n(n),o=s(5675),l=s.n(o),h=s(1163),c=s.n(h),d=s(6772),p=s.n(d);class m extends i.Component{componentDidMount(){this.onCMDK=e=>{e.keyCode>=65&&e.keyCode<=90&&(e.metaKey||e.ctrlKey)&&75==e.keyCode&&(e.preventDefault(),this.refs._searchInput.focus())},window.addEventListener("keydown",this.onCMDK,!1),this.isMacLike=/(Mac|iPhone|iPod|iPad)/i.test(window.navigator.platform),this.setState({isMacLike:this.isMacLike}),this.props.isHome}componentWillUnmount(){window.removeEventListener("keydown",this.onCMDK,!1)}componentDidUpdate(e){this.props.mobileSearchState!==e.mobileSearchState&&"open"==this.props.mobileSearchState&&this.refs._searchInput.focus()}handleTermChange(e){this.setState({inputValue:e}),clearTimeout(this.timeout),e.length>1&&e!=this.state.term&&(this.setState({searching:!this.state.searchType}),this.timeout=setTimeout(()=>{this.setState({term:e,searching:!this.state.searchType}),this.searchTerm(e)},1e3)),0==e.length&&this.setState({term:e,searching:!1,recommendation:null})}handleKeyDown(e){8==(e.keyCode||e.charCode)&&""==this.refs._searchInput.value&&this.setState({searchType:!1})}searchTerm(e){this.state.searchType||fetch("https://api.svgrepo.com/term/".concat(e)).then(e=>e.json()).then(e=>{e.sort((e,t)=>e.title.length-t.title.length),this.setState({searching:!1,recommendation:e})})}handleSubmit(e){this.setState({searching:!1,recommendation:null});let t=this.refs._searchInput.value.toLowerCase();(t.endsWith("-")||t.endsWith(" "))&&(t=t.substr(0,t.length-1)),this.handleSearchEnd(t);let s=t.replace(/ /g,"-");"collection"==this.state.searchType?s?c().push("".concat(c().asPath.split("?")[0],"?search=").concat(s)):c().push("".concat(c().asPath.split("?")[0])):"collections"==this.state.searchType?c().push("/collections/".concat(s,"/")):c().push("/vectors/".concat(s,"/")),e.preventDefault()}handleSearchEnd(e){clearTimeout(this.timeout),setTimeout(()=>{this.setState({term:"",searching:!1,recommendation:null})},100),this.refs._searchInput.value=e}clearCollectionSearch(){this.setState({searchType:!1}),this.refs._searchInput.focus()}handleBlur(){clearTimeout(this.timeout),this.setState({recommendationOpacity:0}),setTimeout(()=>{this.setState({recommendationOpacity:1,recommendation:null,searching:!1})},300)}render(){return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:this.props.isHome?p().searchHolderHome:p().searchHolder,style:{display:"open"==this.props.mobileSearchState?"block":"auto"},children:(0,a.jsxs)("div",{className:p().search,children:[0==this.state.term.length&&(0,a.jsxs)("div",{className:p().pressEnter,children:[this.state.isMacLike?(0,a.jsx)("small",{style:{fontSize:12},children:"⌘"}):(0,a.jsx)("span",{children:"CTRL"})," + K"]}),this.state.term.length>1&&(0,a.jsx)("div",{className:p().pressEnter,children:this.state.searchType?"PRESS ENTER":"PRESS ENTER FOR MORE"}),(0,a.jsxs)("div",{className:this.state.searchType?p().searchIndicatorCollection:p().searchIndicator,children:[(0,a.jsx)("svg",{alt:"Search",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{transform:this.state.searching?"scale(0)":"scale(1)"},children:(0,a.jsx)("path",{d:"M16.32 14.9l5.39 5.4a1 1 0 0 1-1.42 1.4l-5.38-5.38a8 8 0 1 1 1.41-1.41zM10 16a6 6 0 1 0 0-12 6 6 0 0 0 0 12z"})}),(0,a.jsx)(l(),{src:s(6746),alt:"Searching",width:21,height:21,style:{opacity:this.state.searching?1:0}}),this.state.searchType&&(0,a.jsxs)("span",{onClick:()=>this.clearCollectionSearch(),children:[this.state.searchType," ",(0,a.jsx)("span",{style:{fontWeight:500},children:"\xd7"})]})]}),(0,a.jsxs)("form",{onSubmit:e=>this.handleSubmit(e),children:[(0,a.jsx)("input",{className:this.state.recommendation?p().inputWithRecommendations:p().input,type:"text",placeholder:"Search for vectors and icons...",defaultValue:this.state.term,onChange:e=>this.handleTermChange(e.target.value),onKeyDown:e=>this.handleKeyDown(e),onFocus:e=>this.handleTermChange(e.target.value),onBlur:e=>this.handleBlur(),style:{textIndent:this.state.searchType?145:40},ref:"_searchInput"}),this.state.searchType&&""==this.state.inputValue&&(0,a.jsx)("div",{className:p().searchTypeIndicator,children:(0,a.jsxs)("span",{children:["Search in ",this.state.searchType,", ",(0,a.jsx)("b",{children:"Press ←"})," for general search"]})}),(0,a.jsx)("input",{type:"submit",style:{display:"none"}})]}),(0,a.jsx)("div",{className:""==this.state.term?p().recommendation:p().recommendationActive,style:{opacity:this.state.recommendationOpacity},children:this.state.recommendation&&(0,a.jsx)("ul",{className:p().recommendationListing,children:this.state.recommendation.map((e,t)=>(0,a.jsx)(r(),{legacyBehavior:!0,href:"/vectors/".concat(e.title.toLowerCase().replace(/ /g,"-"),"/"),children:(0,a.jsx)("a",{onClick:()=>this.handleSearchEnd(e.title),children:(0,a.jsxs)("li",{children:[e.title[0].toUpperCase()+e.title.substr(1)," ",(0,a.jsxs)("span",{children:[e.count," vector",1!=e.count?"s":""]})]})})},"search-"+t))})})]})})})}constructor(...e){super(...e),this.state={inputValue:"",term:"",searching:!1,recommendation:null,recommendationOpacity:1,searchType:this.props.searchType,isMacLike:!1}}}t.Z=m},6969:function(e){e.exports={header:"style_header__zGlFh",logo:"style_logo__OFa7_",logoHolder:"style_logoHolder__YKj11",logoHolderDark:"style_logoHolderDark__cjR4A",headerHolder:"style_headerHolder__i_tTb",headerContentHolder:"style_headerContentHolder__HfCHq",menuMobile:"style_menuMobile__uHUfg",menu:"style_menu__qDQTZ",dropdown:"style_dropdown__ziFUR",dropdownHolder:"style_dropdownHolder__mJ7ju",dropdownContent:"style_dropdownContent__PcLAB",dropdownInner:"style_dropdownInner__h3XvO",dropdownFooter:"style_dropdownFooter__Et9wM",dropdownImage:"style_dropdownImage__81fuo",seeAll:"style_seeAll__HLOjS",headerSpacer:"style_headerSpacer__lt8mM"}},6772:function(e){e.exports={searchHolder:"style_searchHolder__s_8Sf",search:"style_search__5Sx9r",inputWithRecommendations:"style_inputWithRecommendations__Elmho",recommendation:"style_recommendation__SXg4e",recommendationListing:"style_recommendationListing__kj_0Y",searchIndicator:"style_searchIndicator__sASd0",searchIndicatorCollection:"style_searchIndicatorCollection__mTAoj",pressEnter:"style_pressEnter__Rv8T3",searchHolderHome:"style_searchHolderHome__8Dj59",searchTypeIndicator:"style_searchTypeIndicator__VTRiv"}}}]);