"use strict";(self.webpackChunkrichie_education=self.webpackChunkrichie_education||[]).push([[18323],{18323:function(e,t,r){r.r(t),r.d(t,{default:function(){return P}}),r(32390),r(55862),r(54994),r(54883),r(10853),r(68995),r(26364),r(86632),r(61928),r(45007),r(18821),r(4845),r(39275),r(3973),r(80044),r(19701),r(80238),r(6208),r(12938),r(26425),r(35054);var n=r(69701),o=r(89526),u=r(80292),i=r.n(u),a=r(34323),c=r(35164),s=r(63456),l=r(33469),f=r(95418);function g(e){return"courses"===e.kind}var p=r(68919),h=r(67557);function d(e,t,r,n,o,u,i){try{var a=e[u](i),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function y(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function i(e){d(u,n,o,i,a,"next",e)}function a(e){d(u,n,o,i,a,"throw",e)}i(void 0)}))}}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(u.push(n.value),!t||u.length!==t);i=!0);}catch(e){a=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var O=(0,a.vU)({searchFieldPlaceholder:{id:"components.RootSearchSuggestField.searchFieldPlaceholder",defaultMessage:[{type:0,value:"Search for courses"}]}}),P=function(e){var t=e.context,r=e.courseSearchPageUrl,u=(0,a.YB)(),d=(0,l.U)(!0),v=S((0,o.useState)(""),2),w=v[0],P=v[1],j=S((0,o.useState)([]),2),x=j[0],k=j[1],C=S((0,o.useState)(!1),2),R=C[0],F=C[1],A=function(){return p.xh.assign("".concat(r,"?").concat((0,n.stringify)(b(b({},f.e_),{},{query:w}))))},D={onChange:function(e,t){var r=t.newValue;P(r)},onKeyDown:function(e){13!==e.keyCode||R||A()},placeholder:u.formatMessage(O.searchFieldPlaceholder),"aria-label":u.formatMessage(O.searchFieldPlaceholder),value:w},M=function(){var e=y(regeneratorRuntime.mark((function e(t,o){var u,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!g(u=o.suggestion)){e.next=3;break}return e.abrupt("return",p.xh.assign(u.absolute_url));case 3:return e.t0=c.vt,e.next=6,d();case 6:e.t1=e.sent,e.t2=u,i=(0,e.t0)(e.t1,e.t2),p.xh.assign("".concat(r,"?").concat((0,n.stringify)(b(b({},f.e_),{},m({},i.name,u.id)))));case 10:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();return(0,h.jsx)(i(),{getSectionSuggestions:function(e){return e.values},getSuggestionValue:c.tV,inputProps:D,multiSection:!0,onSuggestionsClearRequested:function(){return k([])},onSuggestionsFetchRequested:function(){var e=y(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.value,e.t0=c.Fz,e.next=4,d();case 4:return e.t1=e.sent,e.t2=k,e.t3=r,e.abrupt("return",(0,e.t0)(e.t1,e.t2,e.t3));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),onSuggestionHighlighted:function(e){var t=e.suggestion;return F(!!t)},onSuggestionSelected:M,renderInputComponent:function(e){return(0,h.jsx)(s.M,{context:t,inputProps:e,onClick:A})},renderSectionTitle:function(e){return e.title},renderSuggestion:c.Pq,shouldRenderSuggestions:function(e){return e.length>2},suggestions:x})}}}]);
//# sourceMappingURL=18323.d858f50dc55f2ee7cf0a.index.js.map