diff --git a/h5p.classes.php b/h5p.classes.php index 9463db1..871f9b0 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -3712,6 +3712,32 @@ class H5PCore { ); } + /** + * Publish content on the H5P Hub. + * + * @param bigint $id + * @return stdClass + */ + public function hubRetrieveContent($id) { + $headers = array( + 'Authorization' => $this->hubGetAuthorizationHeader(), + 'Accept' => 'application/json', + ); + + $response = $this->h5pF->fetchExternalData( + H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT . "/{$id}"), + NULL, TRUE, NULL, TRUE, $headers + ); + + if (empty($response['data'])) { + throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.')); + } + + $hub_content = json_decode($response['data'])->data; + $hub_content->id = "$hub_content->id"; + return $hub_content; + } + /** * Publish content on the H5P Hub. * diff --git a/js/h5p-hub-sharing.js b/js/h5p-hub-sharing.js index ddcbeec..bfacf96 100644 --- a/js/h5p-hub-sharing.js +++ b/js/h5p-hub-sharing.js @@ -51,4 +51,4 @@ var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0 Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. -*/!function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpClassLists=function(){0};var r={},o={};t.add=function(e,t){return n=e.classList,a="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(a,e),n.add(e)}));var n,a},t.remove=function(e,t){return n=e.classList,a="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(a,e),0===a[e]&&n.remove(e)}));var n,a}},function(e,t,n){"use strict";var r,o=n(27),a=(r=o)&&r.__esModule?r:{default:r};var i=void 0,l=void 0,u=[];function s(){0!==u.length&&u[u.length-1].focusContent()}a.default.subscribe((function(e,t){i&&l||((i=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),i.style.position="absolute",i.style.opacity="0",i.setAttribute("tabindex","0"),i.addEventListener("focus",s),(l=i.cloneNode()).addEventListener("focus",s)),(u=t).length>0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==l&&document.body.appendChild(l)):(i.parentElement&&i.parentElement.removeChild(i),l.parentElement&&l.parentElement.removeChild(l))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function a(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function i(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,i=null,l=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?i="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(i="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?l="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(l="UNSAFE_componentWillUpdate"),null!==n||null!==i||null!==l){var u=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==i?"\n "+i:"")+(null!==l?"\n "+l:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=a;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return i})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0},function(e,t,n){},function(e,t,n){var r=n(16);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=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){},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){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(6),i=n.n(a),l=o.a.createContext(),u=o.a.createContext(),s=n(2),c=n.n(s),f=n(3),d=n.n(f),p=n(1),h=n.n(p),m=(n(43),function(e){var t=e.children,n=e.name,r=e.onClick,a=e.variant,i=e.color,l=e.enabled,u=e.id,s=[];return n&&s.push(n),a&&s.push(a),i&&s.push(i),o.a.createElement("button",{id:u,type:"button",className:s.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:h.a.oneOfType([h.a.string,h.a.object]),name:h.a.string,onClick:h.a.func.isRequired,variant:h.a.string,color:h.a.string,enabled:h.a.bool,id:h.a.string};var v=m;n(44);function y(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 g(e){for(var t=1;tn&&(a.completed=!0),[n>0?o.a.createElement(b,{key:"connector-".concat(n)}):null,o.a.cloneElement(e,g(g({key:"step-".concat(n)},a),e.props))]}));return o.a.createElement("div",{className:"stepper","aria-hidden":!0},a)};w.propTypes={activeStep:h.a.number.isRequired,children:h.a.array.isRequired,completed:h.a.bool};var E=w,k=(n(45),function(e){var t=e.active,n=e.label,r=e.index,a=e.completed,i=["step"];return t&&i.push("active"),a&&i.push("completed"),o.a.createElement("div",{className:i.join(" ")},o.a.createElement("div",{className:"step-icon"},a?o.a.createElement("i",{className:"icon-check"}):r+1),o.a.createElement("div",{className:"step-label"},n))});k.propTypes={active:h.a.bool,label:h.a.string.isRequired,index:h.a.number.isRequired,completed:h.a.bool};var x=k,C=(n(46),function(e){var t=e.label,n=e.description,r=e.mandatory,a=e.children,i=e.link,l=e.className;return o.a.createElement("div",{className:"form-element ".concat(r?"mandatory":""," ").concat(l||"")},o.a.createElement("label",{htmlFor:a.props.id},t),o.a.createElement("div",{className:"details-row"},n&&o.a.createElement("div",{className:"description"},n),i&&o.a.createElement("button",{className:"link-button",onClick:i.onClick},i.linkText)),a)});C.propTypes={label:h.a.string.isRequired,description:h.a.string,mandatory:h.a.bool,children:h.a.shape(),link:h.a.shape({onClick:h.a.func.isRequired,linkText:h.a.string.isRequired}),className:h.a.string};var S=C,T=(n(47),function(e){var t=e.selected,n=e.options,r=e.onChange,a=e.allowNone;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"icon-arrow-down"}),o.a.createElement("select",{value:t,onChange:r,disabled:0===n.length},function(e,t){var n=o.a.createElement("option",{value:"",key:"-"},"-");if(e.length>0){var r=t?[n]:[];return r=r.concat(e.map((function(e){return o.a.createElement("option",{value:e.id,key:e.id},e.name)})))}return n}(n,a)))});T.prototypes={selected:h.a.string,options:h.a.array,onchange:h.a.func.isRequired,allowNone:h.a.bool},T.defaultProps={allowNone:!1};var O=T,_=n(11),P=n.n(_),N=function(e,t){for(var n in t)e=e.replace(n,t[n]);return e},R=h.a.shape({title:h.a.string.isRequired,license:h.a.string.isRequired,licenseVersion:h.a.string.isRequired,disciplines:h.a.array.isRequired,language:h.a.string.isRequired,level:h.a.string}),D=h.a.shape({keywords:h.a.array,shortDescription:h.a.string,longDescription:h.a.string,icon:h.a.object,screenshots:h.a.array}),j=n(28),I=n.n(j),L=(n(73),function(e){var t=e.isOpen,n=e.closeModal,r=e.children,a=e.onAfterOpen;return o.a.createElement("div",null,o.a.createElement(I.a,{isOpen:t,className:"modal-content",onRequestClose:function(){document.querySelector(".h5p-hub-publish").removeAttribute("aria-hidden"),n()},onAfterOpen:a,overlayClassName:"modal-overlay",appElement:document.getElementById("h5p-hub-publish-modal-wrapper"),parentSelector:function(){return document.querySelector(".h5p-hub-publish")}},r))});L.propTypes={isOpen:h.a.bool.isRequired,closeModal:h.a.func.isRequired,children:h.a.shape(),onAfterOpen:h.a.func};var M=L,A=n(7),F=n.n(A),z=(n(77),function(e){var t=e.chips,n=e.setChips,r=o.a.useContext(l),a=o.a.useRef([]);o.a.useEffect((function(){a.current=a.current.slice(0,t.length)}),[t]);var i=function(e){"Backspace"!==e.key&&"Delete"!==e.key||u(function(e){for(var n=0;n1&&a.current[0!==r?r-1:1]&&a.current[0!==r?r-1:1].focus(),n(t.filter((function(t){return t.id!==e.id})).map((function(e){return e.id})))};return t.length>0?o.a.createElement("ul",{className:"chips-list"},t.map((function(e,t){return o.a.createElement("li",{key:e.id},o.a.createElement("span",{className:"sr-only"},e.name),o.a.createElement("button",{ref:function(e){return a.current[t]=e},"aria-label":N(r.removeChip,{":chip":e.name}),onClick:function(){return u(e)},onKeyDown:function(e){return i(e)},id:e.id},e.name,o.a.createElement("div",{className:"icon-close"})))}))):null});z.propTypes={chips:h.a.array.isRequired,setChips:h.a.func.isRequired};var U=z,q=n(8),V=n.n(q),B=n(9),W=n.n(B),H=n(4),$=n.n(H),Q=n(29),K=n.n(Q),Y=n(30),X=n.n(Y),G=n(12),J=n.n(G),Z=(n(80),o.a.forwardRef((function(e,t){var n=e.id,r=e.label,a=e.checked,i=e.filter,l=e.onChecked,u=e.focused,s=e.checkboxChildren,c=e.navigateToChildren,f=e.parent,d=e.descendantsChecked,p=e.tabIndex,h=e.children;return o.a.createElement("li",{ref:t,id:n,key:i+n,className:"checkbox ".concat(a?"checked ":""," ").concat(u?"highlighted":""," ").concat(s?"parent":""),role:"checkbox","aria-checked":a,onClick:function(){return s?c(n,s):l(i,n,!a)},tabIndex:p||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(l(i,n,!a),e.preventDefault())}},o.a.createElement("div",{className:"content",key:"label"+n},o.a.createElement("div",{className:"icon",onClick:function(e){return s?function(e,t,n,r){r.stopPropagation(),l(e,t,n,f)}(i,n,!a,e):{}}}),o.a.createElement("div",{className:"label-text"},h||r,d>0&&" (".concat(d,")"))))})));Z.propTypes={id:h.a.string.isRequired,label:h.a.string.isRequired,onChecked:h.a.func.isRequired,checked:h.a.bool.isRequired,filter:h.a.string.isRequired,focused:h.a.bool,children:h.a.any,checkboxChildren:h.a.array,navigateToChildren:h.a.func,parent:h.a.string,tabIndex:h.a.string,descendantsChecked:h.a.any};var ee=Z,te=function(e,t){return-1!==t.indexOf(e)},ne=function(e,t,n){return e?e.filter((function(e){return te(e.id,t)&&-1===n.indexOf(e.id)})).length:0},re=(n(81),o.a.forwardRef((function(e,t){var n=e.items,r=e.onChecked,a=e.checkedParents,i=e.checked,l=e.filter,u=e.focused,s=e.navigateToChildren,c=e.parent,f=e.listRefId,d=e.getDescendants,p=e.tabIndex,h=e.inSearch;return o.a.createElement("ul",{className:"checkbox-list",id:"checkbox-list",role:"group","aria-labelledby":l.name,ref:t&&t[f]},n.map((function(e){return o.a.createElement(ee,{key:c+e.id,id:e.id,label:e.name,checked:te(e.id,i),filter:l,onChecked:r,focused:u==e.id,checkboxChildren:h?null:e.children,navigateToChildren:s,parent:c,descendantsChecked:e.children&&ne(d(e),i,a),ref:t&&t[e.id],tabIndex:p})})))})));re.propTypes={items:h.a.array,onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,navigateToChildren:h.a.func,parent:h.a.string,listRefId:h.a.string,tabIndex:h.a.string,inSearch:h.a.bool};var oe=re,ae=(n(82),o.a.forwardRef((function(e,t){var n=e.onChecked,r=e.checkedParents,a=e.checked,i=e.filter,l=e.focused,u=e.parent,s=e.listRefId,c=e.getDescendants,f=e.tabIndex,d=e.categoryList,p=e.searchValue,h=e.categoryRefId,m=e.dictionary,v=function(e){return e.map((function(e){return o.a.createElement("div",{key:u+e.id},o.a.createElement(ee,{key:u+e.id,id:e.id,label:e.name,checked:te(e.id,a),filter:i,onChecked:n,focused:l===e.id,parent:u,descendantsChecked:ne(c(e),a,r),ref:t&&t[e.id],tabIndex:f},p.length>1&&function(e,t){for(var n=[],r=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:0;i.push(o.a.createElement("span",{key:"checkbox-span-"+a,className:"non-bold"},e.slice(t,t+r))),n[a+1]?i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"bold"},e.slice(t+r,n[a+1]))):i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"bold"},e.slice(t+r))),a+=1})),i.map((function(e){return e}))}(e.name,p)))}))};return o.a.createElement("ul",{className:"checkbox-list",id:"checkbox-list",role:"group","aria-labelledby":i.name,ref:t&&t[s]},d.map((function(e){return o.a.createElement("div",{key:"headers-"+e.id,className:e.noLine?"":"bottom-line"},o.a.createElement("div",null,null!==e.catNoParent?v([e.catNoParent]):null),e.children&&o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{key:e,ref:t[h+e.id],className:"category-header"},m.in," ",e.name),v(e.children)))})))})));ae.propTypes={onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,parent:h.a.string,listRefId:h.a.string.isRequired,tabIndex:h.a.string,categoryRefId:h.a.string.isRequired,checkedParents:h.a.array,getDescendants:h.a.func.isRequired,categoryList:h.a.array.isRequired,searchValue:h.a.string.isRequired,dictionary:h.a.object.isRequired};var ie=ae,le=(n(83),o.a.forwardRef((function(e,t){var n=e.value,r=e.onSearch,a=e.onNavigateVertical,i=e.onSelect,l=e.placeholder,u=e.onClick,s=e.onNavigateSideway,c=e.onFocus,f=e.inSearch,d=e.dictionary,p=e.closeDropdown;return o.a.createElement("div",{onMouseDown:u,className:"search-button",role:"button","aria-label":d.dropdownButton},o.a.createElement("div",{className:"search-field",role:"search"},o.a.createElement("input",{id:"filter-search-bar",type:"text",value:n,"aria-label":l,placeholder:l,ref:t,onKeyDown:function(e){return function(e){switch(e.key){case"ArrowUp":a(-1),e.preventDefault();break;case"ArrowDown":a(1),e.preventDefault();break;case"ArrowRight":f||(s(1),e.preventDefault());break;case"ArrowLeft":f||(s(-1),e.preventDefault());break;case"Enter":i(),e.preventDefault();break;case"Escape":p(),e.preventDefault()}}(e)},onChange:function(e){var t=e.target;r(t.value)},onFocus:c}),o.a.createElement("div",{className:"icon-arrow"})))})));le.propTypes={value:h.a.string,onSearch:h.a.func.isRequired,onNavigateVertical:h.a.func.isRequired,onNavigateSideway:h.a.func.isRequired,onSelect:h.a.func.isRequired,placeholder:h.a.string.isRequired,onClick:h.a.func.isRequired,onFocus:h.a.func,inSearch:h.a.bool},le.defaultProps={onNavigateVertical:function(){},onNavigateSideway:function(){},onSelect:function(){}};var ue=le;n(84);function se(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,i=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?n.push({id:o.id,name:o.name,children:i,catNoParent:a?o:null}):a&&n.push({id:o.id,name:o.name,catNoParent:o})}for(var l=0;l0){l=t.checkboxRefs[t.categoryRefId+t.state.categoryList[0].id].current.offsetHeight;var s,c=0,f=se(t.state.categoryList);try{for(f.s();!(s=f.n()).done;){var d=s.value;if(d.catNoParent&&(c+=1),c>n)break;d.children&&(c+=d.children.length),u+=1}}catch(e){f.e(e)}finally{f.f()}}var p=i+(n+1)*o+u*l-a;t.checkboxRefs[t.listRefId].current.scrollTop=p}})),c()($()(t),"handleNavigateSideway",(function(e){t.state.dropdownOpen&&-1==e&&t.state.parent?t.navigateToParent():t.state.dropdownOpen&&1==e&&t.state.focused&&t.getCheckboxFromId(t.state.focused,t.parents)&&t.navigateToChildren(t.state.focused,t.getCheckboxFromId(t.state.focused,t.parents).children)})),c()($()(t),"navigateToChildren",(function(e,n){t.setState({checkboxElements:n,parent:[].concat(F()(t.state.parent),[e])}),t.searchRef.current.focus()})),c()($()(t),"navigateToParent",(function(){var e=t.state.parent[t.state.parent.length-2],n=t.getCheckboxFromId(e,t.parents)&&t.getCheckboxFromId(e,t.parents).children,r=t.state.parent,o=r.pop();t.setState({parent:r,checkboxElements:n||t.props.items.sort(t.compare),focused:o}),t.searchRef.current.focus()})),c()($()(t),"compare",(function(e,t){var n=e.name.toUpperCase(),r=t.name.toUpperCase();return nr?1:void 0})),c()($()(t),"getDescendants",(function(e){if(null===e)return[];for(var t=[],n=[e];n.length>0;){var r=n.pop();r&&r.children&&(t.concat(r.children),r.children.forEach((function(e){t.push(e),n.push(e)})))}return t})),c()($()(t),"setParentsAndLeafs",(function(e){for(var n=0;n0:-1!=this.props.checked.indexOf(e)||-1!==this.state.checkedParents.indexOf(e)}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"search-filter",ref:this.selfRef},o.a.createElement(ue,{ref:this.searchRef,value:this.state.searchValue,onSearch:this.handleOnSearch,placeholder:this.props.dictionary.searchPlaceholder,onClick:this.handleSearchClick,onNavigateVertical:this.handleNavigateVertical,onSelect:function(){return e.handleChecked(e.props.filter,e.state.focused,!e.checkedOf(e.state.focused),e.state.parent[e.state.parent.length-1])},onNavigateSideway:this.handleNavigateSideway,onFocus:this.handleSearchFocus,inSearch:this.state.inSearch,dictionary:this.props.dictionary,closeDropdown:this.closeDropdown}),this.state.parent.length>0&&this.state.dropdownOpen&&o.a.createElement("div",{className:"navigate-parent"},o.a.createElement("button",{onClick:this.navigateToParent}),this.getCheckboxFromId(this.state.parent[this.state.parent.length-1],this.parents).name),this.state.searchValue.length>0&&o.a.createElement("button",{onClick:this.handleClearSearch,className:"clear-button"}),this.state.dropdownOpen&&this.props.items&&(!this.props.category||this.state.searchValue.length<2)&&o.a.createElement(oe,{onChecked:this.handleChecked,items:this.state.checkboxElements,checked:this.props.checked.concat(this.state.checkedParents),checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,navigateToChildren:this.navigateToChildren,parent:this.state.parent[this.state.parent.length-1],ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",inSearch:this.state.inSearch}),this.state.dropdownOpen&&this.props.items&&this.props.category&&(this.state.categoryList.length>0||this.state.categoryList.topCategories)&&this.state.inSearch&&o.a.createElement(ie,{onChecked:this.handleChecked,checked:this.props.checked.concat(this.state.checkedParents),checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",categoryList:this.state.categoryList,searchValue:this.state.searchValue,categoryRefId:this.categoryRefId,dictionary:this.props.dictionary}))}}]),r}(o.a.Component);he.propTypes={items:h.a.array,handleChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,dictionary:h.a.object.isRequired,category:h.a.bool,dropdownAlwaysOpen:h.a.bool,setFocus:h.a.bool};var me=he,ve=function(e){var t=e.disciplines,n=e.setDisciplines,a=Object(r.useContext)(u),i=Object(r.useContext)(l),s=o.a.useState(!1),c=d()(s,2),f=c[0],p=c[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(U,{chips:t.map((function(e){return{id:e,name:a.getDiscipline(e).name}})),setChips:function(e){n(e),0===e.length&&p((function(e){return!e}))}}),o.a.createElement(me,{items:a.disciplines,handleChecked:function(e,r,o){if(Array.isArray(r)&&null!==r){var a=o?t.filter((function(e){return-1===r.indexOf(e)})).concat(r):t.filter((function(e){return-1===r.indexOf(e)}));n(a)}else if(null!=r){var i=o?[].concat(F()(t),[r]):t.filter((function(e){return e!==r}));n(i)}},checked:t,filter:"discipline",dictionary:i.discipline,category:!0,dropdownAlwaysOpen:!1,setFocus:f}))};ve.propTypes={disciplines:h.a.array.isRequired,setDisciplines:h.a.func.isRequired};var ye=ve;function ge(){return(ge=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function we(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ee(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var ke=!1,xe=o.a.createContext(null),Ce=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus="entering"):o="entered":o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}we(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?"entering"!==n&&"entered"!==n&&(t="entering"):"entering"!==n&&"entered"!==n||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),"entering"===t?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[i.a.findDOMNode(this),r],a=o[0],l=o[1],u=this.getTimeouts(),s=r?u.appear:u.enter;!e&&!n||ke?this.safeSetState({status:"entered"},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:"entering"},(function(){t.props.onEntering(a,l),t.onTransitionEnd(s,(function(){t.safeSetState({status:"entered"},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:i.a.findDOMNode(this);t&&!ke?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:i.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,be(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.a.createElement(xe.Provider,{value:null},"function"==typeof n?n(e,r):o.a.cloneElement(o.a.Children.only(n),r))},t}(o.a.Component);function Se(){}Ce.contextType=xe,Ce.propTypes={},Ce.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Se,onEntering:Se,onEntered:Se,onExit:Se,onExiting:Se,onExited:Se},Ce.UNMOUNTED="unmounted",Ce.EXITED="exited",Ce.ENTERING="entering",Ce.ENTERED="entered",Ce.EXITING="exiting";var Te=Ce,Oe=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=Ee(n.className,r):n.setAttribute("class",Ee(n.className&&n.className.baseVal||"",r)));var n,r}))},_e=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o0?(c(!0),console.log("hei")):-1===t.indexOf(o)&&""!==o&&(n([].concat(F()(t),[o])),r.current.value="")}else c(!1)}(e)},ref:r,onFocus:function(){return m(!0)},onBlur:function(){return m(!1)}}),o.a.createElement(je,{text:a.keywordExists,open:s&&h,className:"tip-keywords"}))});We.propTypes={chips:h.a.array.isRequired,setKeywords:h.a.func.isRequired};var He=We,$e=(n(91),function(e){var t=e.src,n=new Image;n.src=t;var r={backgroundImage:"url('".concat(n.src,"')")};return o.a.createElement("span",{className:"image-preview",style:r})});$e.propTypes={src:h.a.string};var Qe=$e,Ke=(n(92),function(e){var t=e.onFile,n=e.clearImage,r=e.img,a=e.ariaLabel,i=o.a.createRef(),l=function(){t({}),n&&n()};return o.a.createElement("div",{className:"image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?i.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&l()},"aria-label":a},r.src&&o.a.createElement(o.a.Fragment,null,o.a.createElement(Qe,{src:r.src}),o.a.createElement("span",{className:"icon-close",onClick:l})),o.a.createElement("div",{className:"image-upload ".concat(r.src?"image-selected":"")},o.a.createElement("input",{tabIndex:"-1",ref:i,type:"file",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});Ke.propTypes={onFile:h.a.func.isRequired,clearImage:h.a.func,img:h.a.object.isRequired,ariaLabel:h.a.string.isRequired};var Ye=Ke;n(93);function Xe(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 Ge(e){for(var t=1;t0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==l&&document.body.appendChild(l)):(i.parentElement&&i.parentElement.removeChild(i),l.parentElement&&l.parentElement.removeChild(l))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function a(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function i(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,i=null,l=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?i="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(i="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?l="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(l="UNSAFE_componentWillUpdate"),null!==n||null!==i||null!==l){var u=e.displayName||e.name,s="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==i?"\n "+i:"")+(null!==l?"\n "+l:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=a;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return i})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0},function(e,t,n){},function(e,t,n){var r=n(16);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=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){},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){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(6),i=n.n(a),l=o.a.createContext(),u=o.a.createContext(),s=n(2),c=n.n(s),f=n(3),d=n.n(f),p=n(1),h=n.n(p),m=(n(43),function(e){var t=e.children,n=e.name,r=e.onClick,a=e.variant,i=e.color,l=e.enabled,u=e.id,s=[];return n&&s.push(n),a&&s.push(a),i&&s.push(i),o.a.createElement("button",{id:u,type:"button",className:s.join(" "),onClick:r,disabled:!1===l},t)});m.propTypes={children:h.a.oneOfType([h.a.string,h.a.object]),name:h.a.string,onClick:h.a.func.isRequired,variant:h.a.string,color:h.a.string,enabled:h.a.bool,id:h.a.string};var v=m;n(44);function y(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 g(e){for(var t=1;tn&&(a.completed=!0),[n>0?o.a.createElement(b,{key:"connector-".concat(n)}):null,o.a.cloneElement(e,g(g({key:"step-".concat(n)},a),e.props))]}));return o.a.createElement("div",{className:"stepper","aria-hidden":!0},a)};w.propTypes={activeStep:h.a.number.isRequired,children:h.a.array.isRequired,completed:h.a.bool};var E=w,k=(n(45),function(e){var t=e.active,n=e.label,r=e.index,a=e.completed,i=["step"];return t&&i.push("active"),a&&i.push("completed"),o.a.createElement("div",{className:i.join(" ")},o.a.createElement("div",{className:"step-icon"},a?o.a.createElement("i",{className:"icon-check"}):r+1),o.a.createElement("div",{className:"step-label"},n))});k.propTypes={active:h.a.bool,label:h.a.string.isRequired,index:h.a.number.isRequired,completed:h.a.bool};var x=k,C=(n(46),function(e){var t=e.label,n=e.description,r=e.mandatory,a=e.children,i=e.link,l=e.className;return o.a.createElement("div",{className:"form-element ".concat(r?"mandatory":""," ").concat(l||"")},o.a.createElement("label",{htmlFor:a.props.id},t),o.a.createElement("div",{className:"details-row"},n&&o.a.createElement("div",{className:"description"},n),i&&o.a.createElement("button",{className:"link-button",onClick:i.onClick},i.linkText)),a)});C.propTypes={label:h.a.string.isRequired,description:h.a.string,mandatory:h.a.bool,children:h.a.shape(),link:h.a.shape({onClick:h.a.func.isRequired,linkText:h.a.string.isRequired}),className:h.a.string};var S=C,T=(n(47),function(e){var t=e.selected,n=e.options,r=e.onChange,a=e.allowNone;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"icon-arrow-down"}),o.a.createElement("select",{value:t,onChange:r,disabled:0===n.length},function(e,t){var n=o.a.createElement("option",{value:"",key:"-"},"-");if(e.length>0){var r=t?[n]:[];return r=r.concat(e.map((function(e){return o.a.createElement("option",{value:e.id,key:e.id},e.name)})))}return n}(n,a)))});T.prototypes={selected:h.a.string,options:h.a.array,onchange:h.a.func.isRequired,allowNone:h.a.bool},T.defaultProps={allowNone:!1};var O=T,_=n(11),P=n.n(_),N=function(e,t){for(var n in t)e=e.replace(n,t[n]);return e},R=h.a.shape({title:h.a.string.isRequired,license:h.a.string.isRequired,licenseVersion:h.a.string.isRequired,disciplines:h.a.array.isRequired,language:h.a.string.isRequired,level:h.a.string}),D=h.a.shape({keywords:h.a.array,shortDescription:h.a.string,longDescription:h.a.string,icon:h.a.object,screenshots:h.a.array}),j=n(28),I=n.n(j),L=(n(73),function(e){var t=e.isOpen,n=e.closeModal,r=e.children,a=e.onAfterOpen;return o.a.createElement("div",null,o.a.createElement(I.a,{isOpen:t,className:"modal-content",onRequestClose:function(){document.querySelector(".h5p-hub-publish").removeAttribute("aria-hidden"),n()},onAfterOpen:a,overlayClassName:"modal-overlay",appElement:document.getElementById("h5p-hub-publish-modal-wrapper"),parentSelector:function(){return document.querySelector(".h5p-hub-publish")}},r))});L.propTypes={isOpen:h.a.bool.isRequired,closeModal:h.a.func.isRequired,children:h.a.shape(),onAfterOpen:h.a.func};var M=L,A=n(7),F=n.n(A),z=(n(77),function(e){var t=e.chips,n=e.setChips,r=o.a.useContext(l),a=o.a.useRef([]);o.a.useEffect((function(){a.current=a.current.slice(0,t.length)}),[t]);var i=function(e){"Backspace"!==e.key&&"Delete"!==e.key||u(function(e){for(var n=0;n1&&a.current[0!==r?r-1:1]&&a.current[0!==r?r-1:1].focus(),n(t.filter((function(t){return t.id!==e.id})).map((function(e){return e.id})))};return t.length>0?o.a.createElement("ul",{className:"chips-list"},t.map((function(e,t){return o.a.createElement("li",{key:e.id},o.a.createElement("span",{className:"sr-only"},e.name),o.a.createElement("button",{ref:function(e){return a.current[t]=e},"aria-label":N(r.removeChip,{":chip":e.name}),onClick:function(){return u(e)},onKeyDown:function(e){return i(e)},id:e.id},e.name,o.a.createElement("div",{className:"icon-close"})))}))):null});z.propTypes={chips:h.a.array.isRequired,setChips:h.a.func.isRequired};var U=z,q=n(8),V=n.n(q),B=n(9),W=n.n(B),H=n(4),$=n.n(H),Q=n(29),K=n.n(Q),Y=n(30),X=n.n(Y),G=n(12),J=n.n(G),Z=(n(80),o.a.forwardRef((function(e,t){var n=e.id,r=e.label,a=e.checked,i=e.filter,l=e.onChecked,u=e.focused,s=e.checkboxChildren,c=e.navigateToChildren,f=e.parent,d=e.descendantsChecked,p=e.tabIndex,h=e.children;return o.a.createElement("li",{ref:t,id:n,key:i+n,className:"checkbox ".concat(a?"checked ":""," ").concat(u?"highlighted":""," ").concat(s?"parent":""),role:"checkbox","aria-checked":a,onClick:function(){return s?c(n,s):l(i,n,!a)},tabIndex:p||"0",onKeyDown:function(e){"Enter"!==e.key&&" "!=e.key||(l(i,n,!a),e.preventDefault())}},o.a.createElement("div",{className:"content",key:"label"+n},o.a.createElement("div",{className:"icon",onClick:function(e){return s?function(e,t,n,r){r.stopPropagation(),l(e,t,n,f)}(i,n,!a,e):{}}}),o.a.createElement("div",{className:"label-text"},h||r,d>0&&" (".concat(d,")"))))})));Z.propTypes={id:h.a.string.isRequired,label:h.a.string.isRequired,onChecked:h.a.func.isRequired,checked:h.a.bool.isRequired,filter:h.a.string.isRequired,focused:h.a.bool,children:h.a.any,checkboxChildren:h.a.array,navigateToChildren:h.a.func,parent:h.a.string,tabIndex:h.a.string,descendantsChecked:h.a.any};var ee=Z,te=function(e,t){return-1!==t.indexOf(e)},ne=function(e,t,n){return e?e.filter((function(e){return te(e.id,t)&&-1===n.indexOf(e.id)})).length:0},re=(n(81),o.a.forwardRef((function(e,t){var n=e.items,r=e.onChecked,a=e.checkedParents,i=e.checked,l=e.filter,u=e.focused,s=e.navigateToChildren,c=e.parent,f=e.listRefId,d=e.getDescendants,p=e.tabIndex,h=e.inSearch;return o.a.createElement("ul",{className:"checkbox-list",id:"checkbox-list",role:"group","aria-labelledby":l.name,ref:t&&t[f]},n.map((function(e){return o.a.createElement(ee,{key:c+e.id,id:e.id,label:e.name,checked:te(e.id,i),filter:l,onChecked:r,focused:u==e.id,checkboxChildren:h?null:e.children,navigateToChildren:s,parent:c,descendantsChecked:e.children&&ne(d(e),i,a),ref:t&&t[e.id],tabIndex:p})})))})));re.propTypes={items:h.a.array,onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,navigateToChildren:h.a.func,parent:h.a.string,listRefId:h.a.string,tabIndex:h.a.string,inSearch:h.a.bool};var oe=re,ae=(n(82),o.a.forwardRef((function(e,t){var n=e.onChecked,r=e.checkedParents,a=e.checked,i=e.filter,l=e.focused,u=e.parent,s=e.listRefId,c=e.getDescendants,f=e.tabIndex,d=e.categoryList,p=e.searchValue,h=e.categoryRefId,m=e.dictionary,v=function(e){return e.map((function(e){return o.a.createElement("div",{key:u+e.id},o.a.createElement(ee,{key:u+e.id,id:e.id,label:e.name,checked:te(e.id,a),filter:i,onChecked:n,focused:l===e.id,parent:u,descendantsChecked:ne(c(e),a,r),ref:t&&t[e.id],tabIndex:f},p.length>1&&function(e,t){for(var n=[],r=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:0;i.push(o.a.createElement("span",{key:"checkbox-span-"+a,className:"non-bold"},e.slice(t,t+r))),n[a+1]?i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"bold"},e.slice(t+r,n[a+1]))):i.push(o.a.createElement("span",{key:"checkbox-span-bold-"+a,className:"bold"},e.slice(t+r))),a+=1})),i.map((function(e){return e}))}(e.name,p)))}))};return o.a.createElement("ul",{className:"checkbox-list",id:"checkbox-list",role:"group","aria-labelledby":i.name,ref:t&&t[s]},d.map((function(e){return o.a.createElement("div",{key:"headers-"+e.id,className:e.noLine?"":"bottom-line"},o.a.createElement("div",null,null!==e.catNoParent?v([e.catNoParent]):null),e.children&&o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{key:e,ref:t[h+e.id],className:"category-header"},m.in," ",e.name),v(e.children)))})))})));ae.propTypes={onChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,focused:h.a.string,parent:h.a.string,listRefId:h.a.string.isRequired,tabIndex:h.a.string,categoryRefId:h.a.string.isRequired,checkedParents:h.a.array,getDescendants:h.a.func.isRequired,categoryList:h.a.array.isRequired,searchValue:h.a.string.isRequired,dictionary:h.a.object.isRequired};var ie=ae,le=(n(83),o.a.forwardRef((function(e,t){var n=e.value,r=e.onSearch,a=e.onNavigateVertical,i=e.onSelect,l=e.placeholder,u=e.onClick,s=e.onNavigateSideway,c=e.onFocus,f=e.inSearch,d=e.dictionary,p=e.closeDropdown;return o.a.createElement("div",{onMouseDown:u,className:"search-button",role:"button","aria-label":d.dropdownButton},o.a.createElement("div",{className:"search-field",role:"search"},o.a.createElement("input",{id:"filter-search-bar",type:"text",value:n,"aria-label":l,placeholder:l,ref:t,onKeyDown:function(e){return function(e){switch(e.key){case"ArrowUp":a(-1),e.preventDefault();break;case"ArrowDown":a(1),e.preventDefault();break;case"ArrowRight":f||(s(1),e.preventDefault());break;case"ArrowLeft":f||(s(-1),e.preventDefault());break;case"Enter":i(),e.preventDefault();break;case"Escape":p(),e.preventDefault()}}(e)},onChange:function(e){var t=e.target;r(t.value)},onFocus:c}),o.a.createElement("div",{className:"icon-arrow"})))})));le.propTypes={value:h.a.string,onSearch:h.a.func.isRequired,onNavigateVertical:h.a.func.isRequired,onNavigateSideway:h.a.func.isRequired,onSelect:h.a.func.isRequired,placeholder:h.a.string.isRequired,onClick:h.a.func.isRequired,onFocus:h.a.func,inSearch:h.a.bool},le.defaultProps={onNavigateVertical:function(){},onNavigateSideway:function(){},onSelect:function(){}};var ue=le;n(84);function se(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,i=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?n.push({id:o.id,name:o.name,children:i,catNoParent:a?o:null}):a&&n.push({id:o.id,name:o.name,catNoParent:o})}for(var l=0;l0){l=t.checkboxRefs[t.categoryRefId+t.state.categoryList[0].id].current.offsetHeight;var s,c=0,f=se(t.state.categoryList);try{for(f.s();!(s=f.n()).done;){var d=s.value;if(d.catNoParent&&(c+=1),c>n)break;d.children&&(c+=d.children.length),u+=1}}catch(e){f.e(e)}finally{f.f()}}var p=i+(n+1)*o+u*l-a;t.checkboxRefs[t.listRefId].current.scrollTop=p}})),c()($()(t),"handleNavigateSideway",(function(e){t.state.dropdownOpen&&-1==e&&t.state.parent?t.navigateToParent():t.state.dropdownOpen&&1==e&&t.state.focused&&t.getCheckboxFromId(t.state.focused,t.parents)&&t.navigateToChildren(t.state.focused,t.getCheckboxFromId(t.state.focused,t.parents).children)})),c()($()(t),"navigateToChildren",(function(e,n){t.setState({checkboxElements:n,parent:[].concat(F()(t.state.parent),[e])}),t.searchRef.current.focus()})),c()($()(t),"navigateToParent",(function(){var e=t.state.parent[t.state.parent.length-2],n=t.getCheckboxFromId(e,t.parents)&&t.getCheckboxFromId(e,t.parents).children,r=t.state.parent,o=r.pop();t.setState({parent:r,checkboxElements:n||t.props.items.sort(t.compare),focused:o}),t.searchRef.current.focus()})),c()($()(t),"compare",(function(e,t){var n=e.name.toUpperCase(),r=t.name.toUpperCase();return nr?1:void 0})),c()($()(t),"getDescendants",(function(e){if(null===e)return[];for(var t=[],n=[e];n.length>0;){var r=n.pop();r&&r.children&&(t.concat(r.children),r.children.forEach((function(e){t.push(e),n.push(e)})))}return t})),c()($()(t),"setParentsAndLeafs",(function(e){for(var n=0;n0:-1!=this.props.checked.indexOf(e)||-1!==this.state.checkedParents.indexOf(e)}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"search-filter",ref:this.selfRef},o.a.createElement(ue,{ref:this.searchRef,value:this.state.searchValue,onSearch:this.handleOnSearch,placeholder:this.props.dictionary.searchPlaceholder,onClick:this.handleSearchClick,onNavigateVertical:this.handleNavigateVertical,onSelect:function(){return e.handleChecked(e.props.filter,e.state.focused,!e.checkedOf(e.state.focused),e.state.parent[e.state.parent.length-1])},onNavigateSideway:this.handleNavigateSideway,onFocus:this.handleSearchFocus,inSearch:this.state.inSearch,dictionary:this.props.dictionary,closeDropdown:this.closeDropdown}),this.state.parent.length>0&&this.state.dropdownOpen&&o.a.createElement("div",{className:"navigate-parent"},o.a.createElement("button",{onClick:this.navigateToParent}),this.getCheckboxFromId(this.state.parent[this.state.parent.length-1],this.parents).name),this.state.searchValue.length>0&&o.a.createElement("button",{onClick:this.handleClearSearch,className:"clear-button"}),this.state.dropdownOpen&&this.props.items&&(!this.props.category||this.state.searchValue.length<2)&&o.a.createElement(oe,{onChecked:this.handleChecked,items:this.state.checkboxElements,checked:this.props.checked.concat(this.state.checkedParents),checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,navigateToChildren:this.navigateToChildren,parent:this.state.parent[this.state.parent.length-1],ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",inSearch:this.state.inSearch}),this.state.dropdownOpen&&this.props.items&&this.props.category&&(this.state.categoryList.length>0||this.state.categoryList.topCategories)&&this.state.inSearch&&o.a.createElement(ie,{onChecked:this.handleChecked,checked:this.props.checked.concat(this.state.checkedParents),checkedParents:this.state.checkedParents,filter:this.props.filter,focused:this.state.focused,ref:this.checkboxRefs,listRefId:this.listRefId,getDescendants:this.getDescendants,tabIndex:"-1",categoryList:this.state.categoryList,searchValue:this.state.searchValue,categoryRefId:this.categoryRefId,dictionary:this.props.dictionary}))}}]),r}(o.a.Component);he.propTypes={items:h.a.array,handleChecked:h.a.func.isRequired,checked:h.a.array,filter:h.a.string.isRequired,dictionary:h.a.object.isRequired,category:h.a.bool,dropdownAlwaysOpen:h.a.bool,setFocus:h.a.bool};var me=he,ve=function(e){var t=e.disciplines,n=e.setDisciplines,a=Object(r.useContext)(u),i=Object(r.useContext)(l),s=o.a.useState(!1),c=d()(s,2),f=c[0],p=c[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(U,{chips:t.map((function(e){return{id:e,name:a.getDiscipline(e).name}})),setChips:function(e){n(e),0===e.length&&p((function(e){return!e}))}}),o.a.createElement(me,{items:a.disciplines,handleChecked:function(e,r,o){if(Array.isArray(r)&&null!==r){var a=o?t.filter((function(e){return-1===r.indexOf(e)})).concat(r):t.filter((function(e){return-1===r.indexOf(e)}));n(a)}else if(null!=r){var i=o?[].concat(F()(t),[r]):t.filter((function(e){return e!==r}));n(i)}},checked:t,filter:"discipline",dictionary:i.discipline,category:!0,dropdownAlwaysOpen:!1,setFocus:f}))};ve.propTypes={disciplines:h.a.array.isRequired,setDisciplines:h.a.func.isRequired};var ye=ve;function ge(){return(ge=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function we(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ee(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var ke=!1,xe=o.a.createContext(null),Ce=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var o,a=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?a?(o="exited",r.appearStatus="entering"):o="entered":o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",r.state={status:o},r.nextCallback=null,r}we(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?"entering"!==n&&"entered"!==n&&(t="entering"):"entering"!==n&&"entered"!==n||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),"entering"===t?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[i.a.findDOMNode(this),r],a=o[0],l=o[1],u=this.getTimeouts(),s=r?u.appear:u.enter;!e&&!n||ke?this.safeSetState({status:"entered"},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,l),this.safeSetState({status:"entering"},(function(){t.props.onEntering(a,l),t.onTransitionEnd(s,(function(){t.safeSetState({status:"entered"},(function(){t.props.onEntered(a,l)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:i.a.findDOMNode(this);t&&!ke?(this.props.onExit(r),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:i.a.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=o[0],l=o[1];this.props.addEndListener(a,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,be(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.a.createElement(xe.Provider,{value:null},"function"==typeof n?n(e,r):o.a.cloneElement(o.a.Children.only(n),r))},t}(o.a.Component);function Se(){}Ce.contextType=xe,Ce.propTypes={},Ce.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Se,onEntering:Se,onEntered:Se,onExit:Se,onExiting:Se,onExited:Se},Ce.UNMOUNTED="unmounted",Ce.EXITED="exited",Ce.ENTERING="entering",Ce.ENTERED="entered",Ce.EXITING="exiting";var Te=Ce,Oe=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=Ee(n.className,r):n.setAttribute("class",Ee(n.className&&n.className.baseVal||"",r)));var n,r}))},_e=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o0?c(!0):-1===t.indexOf(o)&&""!==o&&(n([].concat(F()(t),[o])),r.current.value="")}else c(!1)}(e)},ref:r,onFocus:function(){return m(!0)},onBlur:function(){return m(!1)}}),o.a.createElement(je,{text:a.keywordExists,open:s&&h,className:"tip-keywords"}))});We.propTypes={chips:h.a.array.isRequired,setKeywords:h.a.func.isRequired};var He=We,$e=(n(91),function(e){var t=e.src,n=new Image;n.src=t;var r={backgroundImage:"url('".concat(n.src,"')")};return o.a.createElement("span",{className:"image-preview",style:r})});$e.propTypes={src:h.a.string};var Qe=$e,Ke=(n(92),function(e){var t=e.onFile,n=e.clearImage,r=e.img,a=e.ariaLabel,i=o.a.createRef(),l=function(){t({}),n&&n()};return o.a.createElement("div",{className:"image-upload-container",role:"button",tabIndex:"0",onKeyDown:function(e){"Enter"===e.key?i.current.click():-1!==["Delete","Backspace"].indexOf(e.key)&&l()},"aria-label":a},r.src&&o.a.createElement(o.a.Fragment,null,o.a.createElement(Qe,{src:r.src}),o.a.createElement("span",{className:"icon-close",onClick:l})),o.a.createElement("div",{className:"image-upload ".concat(r.src?"image-selected":"")},o.a.createElement("input",{tabIndex:"-1",ref:i,type:"file",onChange:function(e){if(0!==e.target.files.length){var n=e.target.files[0];t({src:URL.createObjectURL(n),file:n})}}})))});Ke.propTypes={onFile:h.a.func.isRequired,clearImage:h.a.func,img:h.a.object.isRequired,ariaLabel:h.a.string.isRequired};var Ye=Ke;n(93);function Xe(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 Ge(e){for(var t=1;t