(self.webpackChunkrichie_education=self.webpackChunkrichie_education||[]).push([[75913],{75913:function(e,t,r){"use strict";r.r(t),r(32390),r(10853),r(35054),r(73214),r(96900),r(26364),r(86632),r(61928),r(54883),r(45007),r(68995),r(18821),r(54994),r(4845),r(80044),r(19701),r(80238),r(6208),r(12938);var n=r(89526),o=r(25002),i=r(3787),c=r(89074),a=r(24463);function u(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 l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){f(i,n,o,c,a,"next",e)}function a(e){f(i,n,o,c,a,"throw",e)}c(void 0)}))}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var n,o,i=[],c=!0,a=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(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 d(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}t.default=function(e){var t=e.id,r=(0,c.kP)().user,u=n.useRef(null),s=n.useRef(null),f=p((0,n.useState)(),2),d=f[0],v=f[1],y=function(e){if(!e.ok)throw new Error("Failed to retrieve LTI consumer context at placeholder ".concat(t));return e.json()};return(0,i.b)(m(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("/api/v1.0/plugins/lti-consumer/".concat(t,"/context/")).then(y).then((function(e){return v(l(l({},e),{},{content_parameters:l(l({},e.content_parameters),r&&{lis_person_sourcedid:r.username})}))})).catch(a.p);case 2:case"end":return e.stop()}}),e)}))),[]),(0,n.useEffect)((function(){var e;if(d&&(null===(e=u.current)||void 0===e||e.submit(),d.is_automatic_resizing)){var t,r=null===(t=u.current)||void 0===t?void 0:t.closest(".richie-react--lti-consumer");(0,o.iframeResizer)({minHeight:null==r?void 0:r.clientHeight},s.current),null==r||r.classList.remove("aspect-ratio"),null==r||r.attributes.removeNamedItem("style")}}),[d]),d?n.createElement("div",{className:"lti-consumer"},n.createElement("form",{ref:u,action:d.url,method:"POST",encType:"application/x-www-form-urlencoded",target:"lti_iframe_".concat(t)},Object.entries(d.content_parameters).map((function(e){var t=p(e,2),r=t[0],o=t[1];return n.createElement("input",{key:r,type:"hidden",name:r,value:o})}))),n.createElement("iframe",{ref:s,name:"lti_iframe_".concat(t),title:d.url,src:d.url,allow:"microphone *; camera *; midi *; geolocation *; encrypted-media *; fullscreen *",allowFullScreen:!0})):n.createElement("div",{className:"lti-consumer"})}}}]);
//# sourceMappingURL=75913.bb9f598f835dbdc2968c.index.js.map