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