diff --git a/js/h5p-hub-registration.js b/js/h5p-hub-registration.js index 5517775..9a15f10 100644 --- a/js/h5p-hub-registration.js +++ b/js/h5p-hub-registration.js @@ -34,4 +34,4 @@ object-assign * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var r,i,o,a,l;if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,c=null,s=function(){if(null!==u)try{var e=t.unstable_now();u(!0,e),u=null}catch(e){throw setTimeout(s,0),e}},f=Date.now();t.unstable_now=function(){return Date.now()-f},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(s,0))},i=function(e,t){c=setTimeout(e,t)},o=function(){clearTimeout(c)},a=function(){return!1},l=t.unstable_forceFrameRate=function(){}}else{var d=window.performance,p=window.Date,h=window.setTimeout,m=window.clearTimeout;if("undefined"!=typeof console){var v=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)t.unstable_now=function(){return d.now()};else{var g=p.now();t.unstable_now=function(){return p.now()-g}}var y=!1,b=null,w=-1,k=5,x=0;a=function(){return t.unstable_now()>=x},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0P(a,n))void 0!==u&&0>P(u,a)?(e[r]=u,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var N=[],O=[],R=1,z=null,L=3,I=!1,D=!1,M=!1;function j(e){for(var t=C(O);null!==t;){if(null===t.callback)_(O);else{if(!(t.startTime<=e))break;_(O),t.sortIndex=t.expirationTime,S(N,t)}t=C(O)}}function A(e){if(M=!1,j(e),!D)if(null!==C(N))D=!0,r(F);else{var t=C(O);null!==t&&i(A,t.startTime-e)}}function F(e,n){D=!1,M&&(M=!1,o()),I=!0;var r=L;try{for(j(n),z=C(N);null!==z&&(!(z.expirationTime>n)||e&&!a());){var l=z.callback;if(null!==l){z.callback=null,L=z.priorityLevel;var u=l(z.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?z.callback=u:z===C(N)&&_(N),j(n)}else _(N);z=C(N)}if(null!==z)var c=!0;else{var s=C(O);null!==s&&i(A,s.startTime-n),c=!1}return c}finally{z=null,L=r,I=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=l;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){D||I||(D=!0,r(F))},t.unstable_getCurrentPriorityLevel=function(){return L},t.unstable_getFirstCallbackNode=function(){return C(N)},t.unstable_next=function(e){switch(L){case 1:case 2:case 3:var t=3;break;default:t=L}var n=L;L=t;try{return e()}finally{L=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=L;L=e;try{return t()}finally{L=n}},t.unstable_scheduleCallback=function(e,n,a){var l=t.unstable_now();if("object"==typeof a&&null!==a){var u=a.delay;u="number"==typeof u&&0l?(e.sortIndex=u,S(O,e),null===C(N)&&e===C(O)&&(M?o():M=!0,i(A,u-l))):(e.sortIndex=a,S(N,e),D||I||(D=!0,r(F))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();j(e);var n=C(N);return n!==z&&null!==z&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTimee.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(15);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),o=n(16),a=n.n(o),l=i.a.createContext(),u=n(4),c=n.n(u),s=n(3),f=n.n(s),d=n(1),p=n.n(d),h=(n(30),function(e){var t=e.children,n=e.name,r=e.onClick,o=e.variant,a=e.color,l=e.enabled,u=e.id,c=[];return n&&c.push("h5p-hub-"+n),o&&c.push("h5p-hub-"+o),a&&c.push("h5p-hub-"+a),i.a.createElement("button",{id:u,type:"button",className:c.join(" "),onClick:r,disabled:!1===l},t)});h.propTypes={children:p.a.oneOfType([p.a.string,p.a.object]),name:p.a.string,onClick:p.a.func.isRequired,variant:p.a.string,color:p.a.string,enabled:p.a.bool,id:p.a.string};var m=h,v=(n(31),function(e){var t=e.label,n=e.description,r=e.mandatory,o=e.children,a=e.link,l=e.className,u=e.id;return i.a.createElement("div",{className:"h5p-hub-form-element ".concat(r?"h5p-hub-mandatory":""," ").concat(l||"")},i.a.createElement("label",{htmlFor:o.props.id?o.props.id:u},t),i.a.createElement("div",{className:"h5p-hub-details-row"},n&&i.a.createElement("div",{className:"h5p-hub-description"},n),a&&i.a.createElement("button",{className:"h5p-hub-link-button",onClick:a.onClick},a.linkText)),o)});v.propTypes={label:p.a.string.isRequired,description:p.a.string,mandatory:p.a.bool,children:p.a.shape({props:p.a.shape({id:p.a.string})}),link:p.a.shape({onClick:p.a.func.isRequired,linkText:p.a.string.isRequired}),className:p.a.string};var g=v,y=n(5),b=n.n(y);p.a.shape({title:p.a.string.isRequired,license:p.a.string.isRequired,licenseVersion:p.a.string.isRequired,language:p.a.string.isRequired}),p.a.shape({age:p.a.string,keywords:p.a.array,shortDescription:p.a.string,longDescription:p.a.string,icon:p.a.object,screenshots:p.a.array,disciplines:p.a.array,level:p.a.string}),n(49),n(50),n(51),n(52);var w=function(e){var t=e.src;if(!t)return null;var n=Object(r.useMemo)((function(){var e=new Image;return e.src=t,e}),[t]),o={backgroundImage:"url('".concat(n.src,"')")};return i.a.createElement("span",{className:"h5p-hub-image-preview",style:o})};w.propTypes={src:p.a.string};var k=w,x=(n(53),function(e){var t=e.onFile,n=e.clearImage,r=e.img,o=e.ariaLabel,a=e.removeImageLabel,l=e.id,u=i.a.createRef(),c=function(){t({}),u.current.value=null,n&&n()};return i.a.createElement("div",{className:"h5p-hub-image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?u.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&c()},"aria-label":o},r&&r.src&&i.a.createElement(i.a.Fragment,null,i.a.createElement(k,{src:r.src}),i.a.createElement("button",{className:"h5p-hub-icon-close","aria-label":a,onKeyDown:function(e){-1!==["Enter","Space"].indexOf(e.key)&&(e.stopPropagation(),c())},onClick:c,tabIndex:"0"})),i.a.createElement("div",{className:"h5p-hub-image-upload ".concat(r&&r.src?"h5p-hub-image-selected":"")},i.a.createElement("input",{id:l,tabIndex:"-1",ref:u,type:"file",accept:".png,.jpg,.jpeg,.jfif,.pjpeg,.pjp",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});x.propTypes={onFile:p.a.func.isRequired,clearImage:p.a.func,img:p.a.object,ariaLabel:p.a.string,removeImageLabel:p.a.string.isRequired,id:p.a.string};var E=x,T=(n(54),function(e){var t=e.title,n=e.description,r=e.mainText;return i.a.createElement("div",{className:"h5p-hub-text-field"},i.a.createElement("div",{className:"h5p-hub-title"},t),i.a.createElement("div",{className:"h5p-hub-description"},n),i.a.createElement("div",{className:"h5p-hub-main-text"},r))});T.propTypes={text:p.a.string,description:p.a.string,mainText:p.a.string};n(55);var S=function(e){var t=e.checked,n=void 0!==t&&t,r=e.onChange,o=void 0===r?null:r,a=e.children,l=void 0===a?null:a,u="h5p-hub-checkbox";return n&&(u+=" h5p-hub-checked"),i.a.createElement("label",{className:u,tabIndex:"0",onKeyPress:function(e){" "!==e.key&&"Enter"!==e.key||(o(!n),e.preventDefault())}},i.a.createElement("input",{type:"checkbox",checked:n,onChange:function(e){o(e.target.checked)}}),i.a.createElement("span",{className:"h5p-hub-icon"}),l)};S.propTypes={checked:p.a.bool,onChange:p.a.func};var C=S,_=(n(56),function(e){var t=e.severity,n=e.children;return i.a.createElement("div",{className:"h5p-hub-message h5p-hub-".concat(t)},n)});_.propTypes={severity:p.a.string.isRequired,children:p.a.node};var P=_;function N(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 O(e){for(var t=1;t0,A=function(e,t){M((function(n){return O(O({},n),{},c()({},t,e))}))},F=""!==D.publisher&&""!==D.emailAddress&&h;return i.a.createElement("div",{className:"h5p-hub-registration"},"failed"===k&&i.a.createElement(P,{severity:"error"},i.a.createElement("div",{className:"h5p-hub-message-header",tabIndex:"-1",ref:T},s.registrationFailed),i.a.createElement("div",{className:"h5p-hub-message-description"},N||s.registrationFailedDescription)),"finished"===k?i.a.createElement(P,{severity:"success"},i.a.createElement("div",{className:"h5p-hub-message-header",tabIndex:"-1",ref:z},j?s.successfullyUpdated:s.successfullyRegistred),i.a.createElement("div",{className:"h5p-hub-message-description"},s.successfullyRegistredDescription,i.a.createElement("a",{href:o},s.accountDetailsLinkText))):i.a.createElement("div",{className:"h5p-hub-registration-wrapper"},i.a.createElement("div",{className:"h5p-hub-step-panel"},i.a.createElement("div",{className:"h5p-hub-step-title",role:"heading"},s.registrationTitle),i.a.createElement("div",{className:"h5p-hub-step-content"},i.a.createElement(g,{label:s.publisherFieldTitle,mandatory:!0,description:s.publisherFieldDescription},i.a.createElement("input",{id:"h5p-hub-form-publisher",onChange:function(e){return A(e.target.value,"publisher")},value:D.publisher,maxLength:"255"})),i.a.createElement(g,{label:s.emailAddress,description:s.emailAddressDescription,mandatory:!0,className:"h5p-hub-email-address"},i.a.createElement("input",{id:"h5p-hub-form-email-address",onChange:function(e){return A(e.target.value,"emailAddress")},value:D.emailAddress,maxLength:"255",type:"email"})),i.a.createElement(g,{label:s.publisherDescription,description:s.publisherDescriptionText,mandatory:!1},i.a.createElement("textarea",{value:D.publisherDescription,id:"h5p-hub-form-publisher-description",placeholder:"",onChange:function(e){return A(e.target.value,"publisherDescription")},className:"h5p-hub-publisher-description",maxLength:"65535"})),i.a.createElement(g,{label:s.contactPerson,description:s.contactPersonDescription,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-contact-person",onChange:function(e){return A(e.target.value,"contactPerson")},value:D.contactPerson,maxLength:"255"})),i.a.createElement("div",{className:"h5p-hub-row"},i.a.createElement(g,{label:s.phone,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-phone",onChange:function(e){return A(e.target.value,"phone")},value:D.phone,maxLength:"255",type:"tel"})),i.a.createElement(g,{label:s.address,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-address",onChange:function(e){return A(e.target.value,"address")},value:D.address,maxLength:"255"}))),i.a.createElement("div",{className:"h5p-hub-row"},i.a.createElement(g,{label:s.city,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-city",onChange:function(e){return A(e.target.value,"city")},value:D.city,maxLength:"255"})),i.a.createElement(g,{label:s.zip,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-zip",onChange:function(e){return A(e.target.value,"zip")},value:D.zip,maxLength:"255"})),i.a.createElement(g,{label:s.country,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-country",onChange:function(e){return A(e.target.value,"country")},value:D.country,maxLength:"255"}))),i.a.createElement("div",{className:"h5p-hub-logo-upload-text"},s.logoUploadText),i.a.createElement(E,{img:D.logo,onFile:function(e){A(!1,"removeLogo"),A(e,"logo")},clearImage:A.bind(void 0,!0,"removeLogo"),ariaLabel:s.logoUploadText,removeImageLabel:s.removeImage,id:"h5p-hub-form-logo"}),i.a.createElement(C,{checked:h,onChange:v},i.a.createElement("span",{dangerouslySetInnerHTML:{__html:s.acceptTerms.replace(":url","https://h5p.org/H5P-Hub-terms-of-use")}})))),i.a.createElement("div",{className:"h5p-hub-footer"},i.a.createElement(m,{onClick:function(){window.history.back()}},s.cancel),i.a.createElement(m,{variant:"register-hub",onClick:function(){x("in-process"),function(e,t,n,r,i){var o=new FormData;o.append("_token",t),o.append("name",n.publisher),o.append("email",n.emailAddress),o.append("description",n.publisherDescription),o.append("contact_person",n.contactPerson),o.append("phone",n.phone),o.append("address",n.address),o.append("city",n.city),o.append("zip",n.zip),o.append("country",n.country),o.append("remove_logo",n.removeLogo?"1":"0"),n.logo.file&&o.append("logo",n.logo.file),b.a.post(e,o,{headers:{"Content-Type":"multipart/form-data"},timeout:2e4}).then(r).catch(i)}(t,a,D,(function(e){if(e.data&&e.data.success){if(n)return void window.location.assign(n);x("finished"),R(null),z.current&&z.current.focus()}else{var t=e.data&&e.data.message||null;R(t),x("failed"),T.current&&T.current.focus()}}),(function(e){x("failed");var t=e.response&&e.response.data&&e.response.data.message||null;R(t),T.current&&T.current.focus()}))},enabled:F&&"in-process"!==k},j?s.updateRegistrationOnHub:s.registerOnHub))))};R.propTypes={postUrl:p.a.string.isRequired,redirectUrl:p.a.string,accountSettingsUrl:p.a.string.isRequired,accountInfo:p.a.object};var z=R;n(17).polyfill(),window.H5PHub=window.H5PHub||{},window.H5PHub.createRegistrationUI=function(e){var t=e.container,n=e.l10n,r=e.licenseLink,o=e.registrationURL,u=e.redirectURL,c=e.accountSettingsUrl,s=e.token,f=e.accountInfo;a.a.render(i.a.createElement(l.Provider,{value:n},i.a.createElement(z,{licenseLink:r,postUrl:o,redirectUrl:u,accountSettingsUrl:c,token:s,accountInfo:f||{}})),t)}}]); \ No newline at end of file + */var r,i,o,a,l;if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,c=null,s=function(){if(null!==u)try{var e=t.unstable_now();u(!0,e),u=null}catch(e){throw setTimeout(s,0),e}},f=Date.now();t.unstable_now=function(){return Date.now()-f},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(s,0))},i=function(e,t){c=setTimeout(e,t)},o=function(){clearTimeout(c)},a=function(){return!1},l=t.unstable_forceFrameRate=function(){}}else{var d=window.performance,p=window.Date,h=window.setTimeout,m=window.clearTimeout;if("undefined"!=typeof console){var v=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)t.unstable_now=function(){return d.now()};else{var g=p.now();t.unstable_now=function(){return p.now()-g}}var y=!1,b=null,w=-1,k=5,x=0;a=function(){return t.unstable_now()>=x},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0P(a,n))void 0!==u&&0>P(u,a)?(e[r]=u,e[l]=n,r=l):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var N=[],O=[],R=1,z=null,L=3,I=!1,D=!1,M=!1;function j(e){for(var t=C(O);null!==t;){if(null===t.callback)_(O);else{if(!(t.startTime<=e))break;_(O),t.sortIndex=t.expirationTime,S(N,t)}t=C(O)}}function A(e){if(M=!1,j(e),!D)if(null!==C(N))D=!0,r(F);else{var t=C(O);null!==t&&i(A,t.startTime-e)}}function F(e,n){D=!1,M&&(M=!1,o()),I=!0;var r=L;try{for(j(n),z=C(N);null!==z&&(!(z.expirationTime>n)||e&&!a());){var l=z.callback;if(null!==l){z.callback=null,L=z.priorityLevel;var u=l(z.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?z.callback=u:z===C(N)&&_(N),j(n)}else _(N);z=C(N)}if(null!==z)var c=!0;else{var s=C(O);null!==s&&i(A,s.startTime-n),c=!1}return c}finally{z=null,L=r,I=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var B=l;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){D||I||(D=!0,r(F))},t.unstable_getCurrentPriorityLevel=function(){return L},t.unstable_getFirstCallbackNode=function(){return C(N)},t.unstable_next=function(e){switch(L){case 1:case 2:case 3:var t=3;break;default:t=L}var n=L;L=t;try{return e()}finally{L=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=B,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=L;L=e;try{return t()}finally{L=n}},t.unstable_scheduleCallback=function(e,n,a){var l=t.unstable_now();if("object"==typeof a&&null!==a){var u=a.delay;u="number"==typeof u&&0l?(e.sortIndex=u,S(O,e),null===C(N)&&e===C(O)&&(M?o():M=!0,i(A,u-l))):(e.sortIndex=a,S(N,e),D||I||(D=!0,r(F))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();j(e);var n=C(N);return n!==z&&null!==z&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTimee.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(15);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),o=n(16),a=n.n(o),l=i.a.createContext(),u=n(4),c=n.n(u),s=n(3),f=n.n(s),d=n(1),p=n.n(d),h=(n(30),function(e){var t=e.children,n=e.name,r=e.onClick,o=e.variant,a=e.color,l=e.enabled,u=e.id,c=[];return n&&c.push("h5p-hub-"+n),o&&c.push("h5p-hub-"+o),a&&c.push("h5p-hub-"+a),i.a.createElement("button",{id:u,type:"button",className:c.join(" "),onClick:r,disabled:!1===l},t)});h.propTypes={children:p.a.oneOfType([p.a.string,p.a.object]),name:p.a.string,onClick:p.a.func.isRequired,variant:p.a.string,color:p.a.string,enabled:p.a.bool,id:p.a.string};var m=h,v=(n(31),function(e){var t=e.label,n=e.description,r=e.mandatory,o=e.children,a=e.link,l=e.className,u=e.id;return i.a.createElement("div",{className:"h5p-hub-form-element ".concat(r?"h5p-hub-mandatory":""," ").concat(l||"")},i.a.createElement("label",{htmlFor:o.props.id?o.props.id:u},t),i.a.createElement("div",{className:"h5p-hub-details-row"},n&&i.a.createElement("div",{className:"h5p-hub-description"},n),a&&i.a.createElement("button",{className:"h5p-hub-link-button",onClick:a.onClick},a.linkText)),o)});v.propTypes={label:p.a.string.isRequired,description:p.a.string,mandatory:p.a.bool,children:p.a.shape({props:p.a.shape({id:p.a.string})}),link:p.a.shape({onClick:p.a.func.isRequired,linkText:p.a.string.isRequired}),className:p.a.string};var g=v,y=n(5),b=n.n(y);p.a.shape({title:p.a.string.isRequired,license:p.a.string.isRequired,licenseVersion:p.a.string.isRequired,language:p.a.string.isRequired}),p.a.shape({age:p.a.string,keywords:p.a.array,shortDescription:p.a.string,longDescription:p.a.string,icon:p.a.object,screenshots:p.a.array,disciplines:p.a.array,level:p.a.string}),n(49),n(50),n(51),n(52);var w=function(e){var t=e.src;if(!t)return null;var n=Object(r.useMemo)((function(){var e=new Image;return e.src=t,e}),[t]),o={backgroundImage:"url('".concat(n.src,"')")};return i.a.createElement("span",{className:"h5p-hub-image-preview",style:o})};w.propTypes={src:p.a.string};var k=w,x=(n(53),function(e){var t=e.onFile,n=e.clearImage,r=e.img,o=e.ariaLabel,a=e.removeImageLabel,l=e.id,u=i.a.createRef(),c=function(){t({}),u.current.value=null,n&&n()};return i.a.createElement("div",{className:"h5p-hub-image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?u.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&c()},"aria-label":o},r&&r.src&&i.a.createElement(i.a.Fragment,null,i.a.createElement(k,{src:r.src}),i.a.createElement("button",{className:"h5p-hub-icon-close","aria-label":a,onKeyDown:function(e){-1!==["Enter","Space"].indexOf(e.key)&&(e.stopPropagation(),c())},onClick:c,tabIndex:"0"})),i.a.createElement("div",{className:"h5p-hub-image-upload ".concat(r&&r.src?"h5p-hub-image-selected":"")},i.a.createElement("input",{id:l,tabIndex:"-1",ref:u,type:"file",accept:".png,.jpg,.jpeg,.jfif,.pjpeg,.pjp",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});x.propTypes={onFile:p.a.func.isRequired,clearImage:p.a.func,img:p.a.object,ariaLabel:p.a.string,removeImageLabel:p.a.string.isRequired,id:p.a.string};var E=x,T=(n(54),function(e){var t=e.title,n=e.description,r=e.mainText;return i.a.createElement("div",{className:"h5p-hub-text-field"},i.a.createElement("div",{className:"h5p-hub-title"},t),i.a.createElement("div",{className:"h5p-hub-description"},n),i.a.createElement("div",{className:"h5p-hub-main-text"},r))});T.propTypes={text:p.a.string,description:p.a.string,mainText:p.a.string};n(55);var S=function(e){var t=e.checked,n=void 0!==t&&t,r=e.onChange,o=void 0===r?null:r,a=e.children,l=void 0===a?null:a,u="h5p-hub-checkbox";return n&&(u+=" h5p-hub-checked"),i.a.createElement("label",{className:u,tabIndex:"0",onKeyPress:function(e){" "!==e.key&&"Enter"!==e.key||(o(!n),e.preventDefault())}},i.a.createElement("input",{type:"checkbox",checked:n,onChange:function(e){o(e.target.checked)}}),i.a.createElement("span",{className:"h5p-hub-icon"}),l)};S.propTypes={checked:p.a.bool,onChange:p.a.func};var C=S,_=(n(56),function(e){var t=e.severity,n=e.children;return i.a.createElement("div",{className:"h5p-hub-message h5p-hub-".concat(t)},n)});_.propTypes={severity:p.a.string.isRequired,children:p.a.node};var P=_;function N(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 O(e){for(var t=1;t0,A=function(e,t){M((function(n){return O(O({},n),{},c()({},t,e))}))},F=""!==D.publisher&&""!==D.emailAddress&&h;return i.a.createElement("div",{className:"h5p-hub-registration"},"failed"===k&&i.a.createElement(P,{severity:"error"},i.a.createElement("div",{className:"h5p-hub-message-header",tabIndex:"-1",ref:T},s.registrationFailed),i.a.createElement("div",{className:"h5p-hub-message-description"},N||s.registrationFailedDescription)),"finished"===k?i.a.createElement(P,{severity:"success"},i.a.createElement("div",{className:"h5p-hub-message-header",tabIndex:"-1",ref:z},j?s.successfullyUpdated:s.successfullyRegistred),i.a.createElement("div",{className:"h5p-hub-message-description"},s.successfullyRegistredDescription,i.a.createElement("a",{href:o},s.accountDetailsLinkText))):i.a.createElement("div",{className:"h5p-hub-registration-wrapper"},i.a.createElement("div",{className:"h5p-hub-step-panel"},i.a.createElement("div",{className:"h5p-hub-step-title",role:"heading"},s.registrationTitle),i.a.createElement("div",{className:"h5p-hub-step-content"},i.a.createElement(g,{label:s.publisherFieldTitle,mandatory:!0,description:s.publisherFieldDescription},i.a.createElement("input",{id:"h5p-hub-form-publisher",onChange:function(e){return A(e.target.value,"publisher")},value:D.publisher,maxLength:"255"})),i.a.createElement(g,{label:s.emailAddress,description:s.emailAddressDescription,mandatory:!0,className:"h5p-hub-email-address"},i.a.createElement("input",{id:"h5p-hub-form-email-address",onChange:function(e){return A(e.target.value,"emailAddress")},value:D.emailAddress,maxLength:"255",type:"email",onBlur:function(e){return e.target.reportValidity()}})),i.a.createElement(g,{label:s.publisherDescription,description:s.publisherDescriptionText,mandatory:!1},i.a.createElement("textarea",{value:D.publisherDescription,id:"h5p-hub-form-publisher-description",placeholder:"",onChange:function(e){return A(e.target.value,"publisherDescription")},className:"h5p-hub-publisher-description",maxLength:"65535"})),i.a.createElement(g,{label:s.contactPerson,description:s.contactPersonDescription,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-contact-person",onChange:function(e){return A(e.target.value,"contactPerson")},value:D.contactPerson,maxLength:"255"})),i.a.createElement("div",{className:"h5p-hub-row"},i.a.createElement(g,{label:s.phone,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-phone",onChange:function(e){return A(e.target.value,"phone")},value:D.phone,maxLength:"255",type:"tel"})),i.a.createElement(g,{label:s.address,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-address",onChange:function(e){return A(e.target.value,"address")},value:D.address,maxLength:"255"}))),i.a.createElement("div",{className:"h5p-hub-row"},i.a.createElement(g,{label:s.city,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-city",onChange:function(e){return A(e.target.value,"city")},value:D.city,maxLength:"255"})),i.a.createElement(g,{label:s.zip,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-zip",onChange:function(e){return A(e.target.value,"zip")},value:D.zip,maxLength:"255"})),i.a.createElement(g,{label:s.country,mandatory:!1},i.a.createElement("input",{id:"h5p-hub-form-country",onChange:function(e){return A(e.target.value,"country")},value:D.country,maxLength:"255"}))),i.a.createElement("div",{className:"h5p-hub-logo-upload-text"},s.logoUploadText),i.a.createElement(E,{img:D.logo,onFile:function(e){A(!1,"removeLogo"),A(e,"logo")},clearImage:A.bind(void 0,!0,"removeLogo"),ariaLabel:s.logoUploadText,removeImageLabel:s.removeImage,id:"h5p-hub-form-logo"}),i.a.createElement(C,{checked:h,onChange:v},i.a.createElement("span",{dangerouslySetInnerHTML:{__html:s.acceptTerms.replace(":url","https://h5p.org/H5P-Hub-terms-of-use")}})))),i.a.createElement("div",{className:"h5p-hub-footer"},i.a.createElement(m,{onClick:function(){window.history.back()}},s.cancel),i.a.createElement(m,{variant:"register-hub",onClick:function(){x("in-process"),function(e,t,n,r,i){var o=new FormData;o.append("_token",t),o.append("name",n.publisher),o.append("email",n.emailAddress),o.append("description",n.publisherDescription),o.append("contact_person",n.contactPerson),o.append("phone",n.phone),o.append("address",n.address),o.append("city",n.city),o.append("zip",n.zip),o.append("country",n.country),o.append("remove_logo",n.removeLogo?"1":"0"),n.logo.file&&o.append("logo",n.logo.file),b.a.post(e,o,{headers:{"Content-Type":"multipart/form-data"},timeout:2e4}).then(r).catch(i)}(t,a,D,(function(e){if(e.data&&e.data.success){if(n)return void window.location.assign(n);x("finished"),R(null),z.current&&z.current.focus()}else{var t=e.data&&e.data.message||null;R(t),x("failed"),T.current&&T.current.focus()}}),(function(e){x("failed");var t=e.response&&e.response.data&&e.response.data.message||null;R(t),T.current&&T.current.focus()}))},enabled:F&&"in-process"!==k},j?s.updateRegistrationOnHub:s.registerOnHub))))};R.propTypes={postUrl:p.a.string.isRequired,redirectUrl:p.a.string,accountSettingsUrl:p.a.string.isRequired,accountInfo:p.a.object};var z=R;n(17).polyfill(),window.H5PHub=window.H5PHub||{},window.H5PHub.createRegistrationUI=function(e){var t=e.container,n=e.l10n,r=e.licenseLink,o=e.registrationURL,u=e.redirectURL,c=e.accountSettingsUrl,s=e.token,f=e.accountInfo;a.a.render(i.a.createElement(l.Provider,{value:n},i.a.createElement(z,{licenseLink:r,postUrl:o,redirectUrl:u,accountSettingsUrl:c,token:s,accountInfo:f||{}})),t)}}]); \ No newline at end of file