@clickview/curator 1.0.1-alpha.0 → 1.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/curator-app.css.map +1 -1
- package/dist/curator-app.js +1 -1
- package/dist/curator-app.js.map +1 -1
- package/dist/en.json +1 -0
- package/package.json +5 -5
package/dist/curator-app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("Backbone"),require("ReactRedux"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","ReactBootstrap","Formik","Backbone","ReactRedux","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("Backbone"),require("ReactRedux"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.ReactBootstrap,e.Formik,e.Backbone,e.ReactRedux,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,l,u){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t){e.exports=a},function(e,t,n){"use strict";var r=n(13);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}));var i=n(15);n.d(t,"DomainOptionKind",(function(){return i.a})),n.d(t,"DomainOptionType",(function(){return i.b}))},function(e,t,n){e.exports={tree:"_1abau",text:"f13wK",chevron:"_25eVA",disabled:"_1qyCo",parentOfSelected:"_1fgN6",selected:"cVZit",actions:"_2BGWp",node:"rJVbQ",collapsed:"vc2by"}},function(e,t){e.exports=o},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=c},function(e,t){e.exports=s},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){"use strict";var r=n(14);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}))},function(e,t){},function(e,t,n){"use strict";var r,i;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(r||(r={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(i||(i={})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}))},function(e,t,n){var r=n(20);e.exports=(r.default||r).template({compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){return'<div class="layout-region"></div>'},useData:!0})},function(e,t){e.exports=l},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e,t){e.exports=u},function(e,t,n){"use strict";n.r(t);var r={UPLOAD_IMAGE:"upload:image"},i={Subjects:Object.assign({SUBJECTS:"subjects",NEW_SUBJECT:"new:subject",EDIT_SUBJECT:"edit:subject",EDIT_SUBJECT_PLAYLISTS:"edit:subject:playlists",EDIT_SUBJECT_SERIES:"edit:subject:series",EDIT_SUBJECT_VIDEOS:"edit:subject:videos",SUBJECT_CLASSIFICATIONS:"subject:classifications",DELETE_SUBJECT:"delete:subject",ADD_SUBJECT_MEMBERS:"add:subject:members",REMOVE_SUBJECT_MEMBER:"remove:subject:member",CLASSIFICATIONS:"classifications",PRESENTATION_CLASSIFICATIONS:"presentation:classifications",NEW_CLASSIFICATION:"new:classification",EDIT_CLASSIFICATION:"edit:classification",EDIT_CLASSIFICATION_PLAYLISTS:"edit:classification:playlists",EDIT_CLASSIFICATION_SERIES:"edit:classification:series",EDIT_CLASSIFICATION_VIDEOS:"edit:classification:videos",DELETE_CLASSIFICATION:"delete:classification",REMOVE_CLASSIFICATION_MEMBER:"remove:classification:member",LEVELS:"levels",NEW_LEVEL:"new:level",EDIT_LEVEL:"edit:level",AUDIENCES:"audiences",PRESENTATION_AUDIENCES:"presentation:audiences",NEW_AUDIENCE:"new:audience",EDIT_AUDIENCE:"edit:audience",DELETE_AUDIENCE:"delete:audience",PRESENTATIONS:"presentations",NEW_PRESENTATION:"new:presentation",EDIT_PRESENTATION:"edit:presentation"},r),Playlists:Object.assign({PLAYLISTS:"index",NEW_PLAYLIST:"new:playlist",EDIT_PLAYLIST:"edit:playlist",EDIT_PLAYLIST_VIDEOS:"edit:playlist:videos",EDIT_PLAYLIST_SUBJECTS:"edit:playlist:subjects",EDIT_PLAYLIST_AUDIENCES:"edit:playlist:audiences",DELETE_PLAYLIST:"delete:playlist",REMOVE_VIDEO:"remove:video",REMOVE_FROM_SUBJECT:"remove:from:subject"},r),Series:Object.assign({EDIT_SERIES:"edit:series",EDIT_SERIES_VIDEOS:"edit:series:videos",EDIT_SERIES_SUBJECTS:"edit:series:subjects",EDIT_SERIES_AUDIENCES:"edit:series:audiences"},r),Videos:{EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects"},DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"}},a={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={DOMAIN_OPTIONS:"domain:options:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},l={IMAGE_UPLOAD:"image:upload:data:service",PLAYLIST:"playlist:data:service",SERIES:"series:data:service",SUBJECT:"subject:data:service",USER:"user:data:service",VIDEO:"video:data:service"},u={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService"},p=n(0),f=n(2),d=n(1),m=n(16),b=n.n(m),y=n(12),v=n.n(y);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return!t||"object"!==S(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e,t,n){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=j(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,j(t).call(this,e))).childComponents={},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(t,e),n=t,i=[{key:"getCacheKey",value:function(e){var t="".concat(this.name),n=[];return Object.keys(e).forEach((function(t){n.push("".concat(t,":").concat(e[t]))})),n.length&&(n.sort(),t+=":".concat(n.join(":"))),t}}],(r=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[d.LayoutRegions.TOP_NAV],className:v.a.topNavRegion},leftNav:{component:this.childComponents[d.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(v.a.leftNavRegion)},content:{component:this.childComponents[d.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[d.LayoutRegions.POPUP]},alert:{component:this.childComponents[d.LayoutRegions.ALERT]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){f.FunctionHelper.isFunction(this.options.getTopNavView)&&(this.childComponents[d.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(d.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(d.LayoutRegions.POPUP)}},{key:"showChildView",value:function(e,t){this.childComponents[e]=t,this.renderTopNav(),this.renderLayout()}},{key:"renderLayout",value:function(){var e=Object.assign({provider:this.options.provider},this.getChildComponents());g(j(t.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(p.createElement(P,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return b.a}},{key:"className",get:function(){return"container-fluid ".concat(v.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.ReactLayoutView),I=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},C=function(e){var t=e.className,n=e.children;return p.createElement("div",{className:t},n)},A=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},L=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return p.createElement(p.Fragment,null,p.createElement("div",{className:"position-relative"},!!t.component&&p.createElement(C,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(C,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(C,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(C,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(C,{className:A("alert-region",a.className)},a.component))},P=function(e){var t=e.provider,n=I(e,["provider"]);return t?p.createElement(t,null,p.createElement(L,Object.assign({},n))):p.createElement(L,Object.assign({},n))};function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function D(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),D(this,F(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.listenTo(f.CommonChannels.SHELL,f.Core.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=f.Core.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var r=document.querySelector(this.options.navSelector);r&&r.children&&k(r.children).forEach((function(t){var r=t.querySelector("a");r&&(r.classList.remove(e.options.currentItemClassName),r.text===n&&r.classList.add(e.options.currentItemClassName))}))}}}},{key:"name",get:function(){return"CuratorAppNavService"}}])&&w(n.prototype,r),i&&w(n,i),t}(f.Core.Service);function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var M=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),B(this,V(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,e),n=t,(r=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:a.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return u.IMAGE_UPLOAD}},{key:"channelName",get:function(){return l.IMAGE_UPLOAD}}])&&U(n.prototype,r),i&&U(n,i),t}(f.BaseDataService);function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function q(e,t){return!t||"object"!==H(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var W,G=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),q(this,z(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(t,e),n=t,(r=[{key:"getCurrentUser",value:function(e,t){return this.get({resource:"/api/currentuser",eventPrefix:a.CURRENT_USER,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return u.USER}},{key:"channelName",get:function(){return l.USER}}])&&Y(n.prototype,r),i&&Y(n,i),t}(f.BaseDataService),Z={dataServiceName:u.USER,dataChannelName:l.USER},Q={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},Z),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}},X={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return X.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=d.ImageMinDimensions[t].width,a=d.ImageMinDimensions[t].height;r.addEventListener("load",(function(){X.isImageValid(t,r)&&f.FunctionHelper.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=d.ImageMinDimensions[e].width,r=d.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},$={isItemActive:function(e,t){return t||(t=f.Core.AppLinkHelper.getCurrentAppLink()),t.application===e.appLink.application&&(Array.isArray(e.activeActions)?e.activeActions.includes(t.action):t.action===e.appLink.action)}};!function(e){e.Developer="Curator Devs",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(W||(W={}));var ee=function(){return[{value:"protected",access:"r"}]},te=function(e){return oe.getGroupNames(e).includes(W.Developer)},ne={propsLoaded:function(e){return Object.values(e).every((function(e){return!!e}))}},re={isEqual:function(e,t){return!!e&&!!t&&e.toString()===t.toString()},capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}};function ie(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var ae={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(re.isEqual(n.id,t))return n;var r=n.children;if(r&&r.length)for(var i=0;i<r.length;i++){var a=e(r[i]);if(a)return a}},r=0;r<e.children.length;r++){var i=n(e.children[r]);if(i)return i}},getPath:function(e,t){for(var n=[t],r=function(e){return e.hasOwnProperty("parentIds")&&Array.isArray(e.parentIds)&&e.parentIds.length?e.parentIds[0]:e.hasOwnProperty("parentId")?e.parentId:null},i=r(t);i;){var a=ae.find(e,i);a&&(n=[a].concat(ie(n))),i=a?r(a):null}return n}},oe={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function ce(e){return(ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function le(e,t){return!t||"object"!==ce(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ue(e){return(ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner")},de=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},me=function(){return"/api/master/v2/series"},be=function(e){return"/api/master/v2/objects/".concat(e)},ye=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),le(this,ue(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pe(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:fe(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:de(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:me(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:d.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:be(r.id),data:{permissions:ee()},callback:t,eventPrefix:a.SERIES,successHandler:i.alertService.success("Successfully created series")})})).run()}},{key:"updateSeries",value:function(e,t,n,r){this.update({resource:be(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SERIES,":").concat(e),invalidationKeys:["".concat(a.SERIES,":").concat(e),a.SERIES_BY_ID],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return u.SERIES}},{key:"channelName",get:function(){return l.SERIES}}])&&se(n.prototype,r),i&&se(n,i),t}(f.BaseDataService),ve={dataServiceName:u.SERIES,dataChannelName:l.SERIES},Se={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ve),{eventPrefix:"".concat(a.SERIES,":").concat(e),fetchData:function(t){return t.getSeries(e)},setData:t,onError:n})},getSeriesByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ve),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}},Ee=n(8);function he(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ge=p.createContext(void 0),je=function(e){var t=e.children,n=he(p.useState(),2),r=n[0],i=n[1],a=he(p.useState(!1),2),o=a[0],c=a[1],s=he(p.useState(),2),l=s[0],u=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=l;return u(null),c(!1),e},setImage:function(e){u(e),c(!0)}};return p.createElement(ge.Provider,{value:f},t)};function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Te=p.createContext(void 0);function Ie(e){var t=e.children,n=Oe(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(d.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Te.Provider,{value:r},t)}function Ce(e){var t=e.backToName,n=e.appLink;return p.createElement(d.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ArrowLeft,size:d.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}var Ae=n(4);function Le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Pe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ne(e){var t=e.selected,n=e.onToggle,r=Pe(e,["selected","onToggle"]),i=Le(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(Ae.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var ke,we=n(5),De=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Fe(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=De(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var l=Object.assign({type:"file",className:s,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&f.FunctionHelper.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return p.createElement("div",{className:"form-group"},p.createElement("div",{className:"custom-file"},p.createElement(we.Field,Object.assign({},l,c),e.children),p.createElement(Ae.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}function _e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Ue=(xe(ke={},d.ImageType.Thumbnails,"Thumbnail"),xe(ke,d.ImageType.Banners,"Banner"),xe(ke,d.ImageType.Avatars,"Avatar"),xe(ke,d.ImageType.Logos,"Logo"),xe(ke,d.ImageType.Covers,"Cover"),xe(ke,d.ImageType.Posters,"Poster"),ke);function Be(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=Re(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(ge),l=s.setDataUrl,u=s.getImage,m=s.imageUploaded,b=_e(p.useState(!1),2),y=b[0],v=b[1],S=_e(p.useState(n),2),E=S[0],h=S[1],g=_e(p.useState(!1),2),j=g[0],O=g[1],T=function(e){v(!0),l(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=u();e&&(v(!1),h(e),r({fileId:e.id,fileIdType:d.FileIdType.ImageAPIv2}))}}),[m]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,Ue[t]),p.createElement(Fe,Object.assign({label:"Choose a ".concat(Ue[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return X.onFileSelect(t,e,T)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!j&&p.createElement("div",{className:"pb-2 ".concat(t===d.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:d.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(d.SvgContainer,{svgName:j?d.cvSvgLibrary.ChevronDown:d.cvSvgLibrary.ChevronUp,size:d.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return O(!j)},title:j?"Show image":"Hide image",tooltipPlacement:"top"})))))}var Ve,Je=n(17),Me=n.n(Je);function He(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(Ve||(Ve={}));var Ye=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/,qe=function(e){var t=e.match(Ye);if(t)return t[1]};function ze(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=He(p.useState(!1),2),l=s[0],u=s[1],m=He(p.useState(!1),2),b=m[0],y=m[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new Me.a(o.current,{viewMode:Ve.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return u(!0)}}),function(){return c.current.destroy()}}),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),p.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},p.createElement(Ae.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(d.SpinnerButton,{onClick:function(){if(l){y(!0);var e=c.current.getCroppedCanvas().toDataURL(qe(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!l,showSpinner:b},"Crop")))}function Ke(e){var t=e.object,n=e.actions;return p.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&p.createElement("h5",null,t.name),!!n&&p.createElement("span",null,p.createElement(d.Actions,{actions:n})))}function We(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?p.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return p.createElement("li",{key:t,className:"border rounded mb-3"},p.createElement(d.AppLink,{appLink:n(e),className:"d-block p-3"},e.name))}))):p.createElement("div",{className:"py-3"},p.createElement("p",null,r)):p.createElement(p.Fragment,null)}function Ge(e){var t=e.tabs,n=e.isItemActive;return p.createElement(Ae.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}We.defaultProps={emptyMessage:"There is nothing here."},Ge.defaultProps={isItemActive:$.isItemActive};var Ze=n(7),Qe=n.n(Ze);function Xe(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=Qe.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(Qe.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(d.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(d.Actions,{className:Qe.a.actions,actions:o}))}function $e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function et(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,c=Array.isArray(n)&&n.some((function(e){return re.isEqual(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return ae.find(t,e)}))}),[t,n]),l=$e(p.useState(s),2),u=l[0],m=l[1],b=!!t.children&&!!t.children.length,y={name:t.name,appLink:f.FunctionHelper.isFunction(r)?r(t):null,onSelect:f.FunctionHelper.isFunction(i)?function(){return i(t)}:null,isDisabled:!!f.FunctionHelper.isFunction(a)&&a(t),className:c&&Qe.a.selected||s&&Qe.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return p.createElement("li",{className:"position-relative".concat(u?"":" ".concat(Qe.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:Qe.a.node},b&&p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.ChevronDown,size:d.SvgContainerSize.Small,className:"svg-container ".concat(Qe.a.chevron),onClick:function(){return m(!u)}}),p.createElement(Xe,Object.assign({},y))),u&&p.createElement(nt,Object.assign({},e))))}var tt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function nt(e){var t=e.tree,n=tt(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(Qe.a.tree)},t.children.map((function(e){return p.createElement(et,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var rt={getChord:function(e,t){return ae.getPath(e,t).map((function(e){return e.name})).join(" -> ")},getState:function(e,t){var n={};return Array.isArray(e)&&e.forEach((function(e){var r,i,a,o=ae.find(t,e);o&&(n=Object.assign((r={},i=e,a=rt.getChord(t,o),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r),n))})),n}};function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var at=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function ot(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=at(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),l=s.tree,u=s.selectedIds,m=it(p.useState(rt.getState(u,l)),2),b=m[0],y=m[1];p.useEffect((function(){return y(rt.getState(u,l))}),[u,l]);var v=it(p.useState(!!i),2),S=v[0],E=v[1];p.useEffect((function(){return E(!!i)}),[i]);var h=!r||!!n;return p.createElement(p.Fragment,null,h&&p.createElement("div",{className:"pb-2"},!!n&&p.createElement("label",{className:"m-0"},n),!r&&p.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return E(!S)}},S?"Expand":"Collapse")),!S&&p.createElement("div",{className:"py-2 border-top"},p.createElement(nt,Object.assign({onSelect:function(e){return f.FunctionHelper.isFunction(t)&&t(e)},isDisabled:o},s))),(!f.ObjectHelper.isEmpty(b)||!!a)&&p.createElement("div",{className:"py-2 border-top"},p.createElement("label",null,"Selected:"),p.createElement("ul",{className:"m-0"},f.ObjectHelper.isEmpty(b)?p.createElement("li",null,a):Object.keys(b).map((function(e,t){return p.createElement("li",{key:t},f.FunctionHelper.isFunction(c)?p.createElement(d.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var ct=n(11),st=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function lt(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,c=f.FunctionHelper.isFunction(n)&&n(t);return p.createElement("tr",{className:st(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(d.AppLink,{appLink:c},t.name):t.name),f.FunctionHelper.isFunction(r)&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(d.Actions,{actions:r(t)}))))}var ut=Object(ct.SortableElement)((function(e){return p.createElement(lt,Object.assign({sortable:!0},e))})),pt=n(9),ft=n.n(pt),dt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},mt=function(e){var t=e.sortable,n=e.getVideoActions;return p.createElement("thead",null,p.createElement("tr",null,!!t&&p.createElement("th",null,"#"),p.createElement("th",null,"Name"),!!n&&p.createElement("th",null)))},bt=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=dt(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!d.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(ut,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:ft.a.draggableVideoItem},i)):p.createElement(lt,Object.assign({video:e},i))})))}));var yt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},vt=Object(ct.SortableContainer)((function(e){var t=e.forwardedRef,n=yt(e,["forwardedRef"]);return p.createElement(bt,Object.assign({sortable:!0,ref:t},n))})),St=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(ft.a.sortingContainer);var i=r.querySelector(".".concat(ft.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},Et=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(ft.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function ht(e){var t=e.onSortEnd,n=e.emptyMessage,r=yt(e,["onSortEnd","emptyMessage"]),i=p.useRef();return d.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(Ae.Table,{responsive:!0},p.createElement(mt,Object.assign({sortable:!0},e)),p.createElement(vt,Object.assign({forwardedRef:i,onSortStart:St(i),onSortEnd:Et(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:ft.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}function gt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function jt(e){var t=e.imageType,n=e.closePopup,r=p.useContext(ge),i=r.getDataUrl,a=r.setImage,o=gt(p.useState(i()),1)[0],c=gt(p.useState(!1),2),s=c[0],l=c[1],m=Object(f.useService)(u.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:d.ImageMinDimensions[t].width,minHeight:d.ImageMinDimensions[t].height,onCrop:function(e){return m.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(d.Popup,{title:"Crop Image",closePopup:n,onEntered:function(){return l(!0)}},s&&p.createElement(ze,Object.assign({},y)))}ht.defaultProps={emptyMessage:"There are no videos in this list."};var Ot=function(e){var t=e.children;return p.createElement(Ie,null,p.createElement(je,null,t))},Tt=n(3),It=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Tt.string().trim().max(65535,"Description is too long").default(""),poster:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown(),banner:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown()}).noUnknown(),Ct={getEditSeriesTabs:function(e,t){var n=s.SERIES,r=i.Series,a=[{label:"Edit Series Details",appLink:{application:n,action:r.EDIT_SERIES,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_SERIES_VIDEOS,args:[t]}}];return te(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),a}};function At(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(Be,{imageType:d.ImageType.Posters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(Be,{imageType:d.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SERIES,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(d.Actions,{actions:e.actions})))}function Lt(e){return p.createElement(d.FormWrapper,{initialValues:e.series,validationSchema:It,onSubmit:e.saveSeries},p.createElement(At,{id:e.series&&e.series.id}))}var Pt,Nt,kt,wt,Dt=function(e){return function(t){return t.appLink.action===e}};function Ft(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Te);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(Ge,{tabs:Ct.getEditSeriesTabs(r,t),isItemActive:Dt(n)}))}function _t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xt(e){var t=e.seriesId,n=_t(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SERIES);Object(f.useFetch)(Se.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Ft,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&p.createElement(Lt,{series:r,saveSeries:function(e,n){return o.updateSeries(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Pt||(Pt={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(Nt||(Nt={})),function(e){e.Root="0"}(kt||(kt={})),function(e){e.Root="root"}(wt||(wt={}));var Rt=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Tt.array().of(Tt.string()).required("A level is required").default([])}).noUnknown(),Ut=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Tt.array().of(Tt.string()).default([wt.Root]),subjectIds:Tt.array().of(Tt.string()).min(1,"A classification must be mapped to at least one subject").required("A classification must be mapped to at least one subject").default([]),type:Tt.mixed().required("Type is required").default(d.ClassificationType.Subject),emphasize:Tt.boolean().default(!1),cover:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown(),banner:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown()}).noUnknown(),Bt=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),Vt=Tt.object().shape({name:Tt.string().max(255,"Name is too long").required("Name is required"),description:Tt.string().max(65535,"Description is too long").required("Description is required")}),Jt=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Tt.string().default(kt.Root)}).noUnknown(),Mt={singularizeMemberType:function(e){switch(e){case Nt.Playlists:return"playlist";case Nt.Series:return"series";case Nt.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case Nt.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case Nt.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case Nt.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(Mt.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===Pt.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},Ht={getTopNavItems:function(){var e=s.SUBJECTS,t=i.Subjects;return[{label:"Classifications",appLink:{application:e,action:t.CLASSIFICATIONS},activeActions:[t.CLASSIFICATIONS,t.PRESENTATION_CLASSIFICATIONS,t.NEW_CLASSIFICATION,t.EDIT_CLASSIFICATION,t.EDIT_CLASSIFICATION_PLAYLISTS,t.EDIT_CLASSIFICATION_SERIES,t.EDIT_CLASSIFICATION_VIDEOS,t.DELETE_CLASSIFICATION,t.REMOVE_CLASSIFICATION_MEMBER]},{label:"Subjects",appLink:{application:e,action:t.SUBJECTS},activeActions:[t.SUBJECTS,t.NEW_SUBJECT,t.EDIT_SUBJECT,t.EDIT_SUBJECT_PLAYLISTS,t.EDIT_SUBJECT_SERIES,t.EDIT_SUBJECT_VIDEOS,t.SUBJECT_CLASSIFICATIONS,t.DELETE_SUBJECT,t.ADD_SUBJECT_MEMBERS,t.REMOVE_SUBJECT_MEMBER]},{label:"Audiences",appLink:{application:e,action:t.AUDIENCES},activeActions:[t.AUDIENCES,t.PRESENTATION_AUDIENCES,t.NEW_AUDIENCE,t.EDIT_AUDIENCE]},{label:"Levels",appLink:{application:e,action:t.LEVELS},activeActions:[t.LEVELS,t.NEW_LEVEL,t.EDIT_LEVEL]},{label:"Presentations",appLink:{application:e,action:t.PRESENTATIONS},activeActions:[t.PRESENTATIONS,t.NEW_PRESENTATION,t.EDIT_PRESENTATION]}]},getEditSubjectTabs:function(e){var t=s.SUBJECTS,n=i.Subjects;return[{label:"Edit Subject Details",appLink:{application:t,action:n.EDIT_SUBJECT,args:[e]}},{label:"Classifications",appLink:{application:t,action:n.SUBJECT_CLASSIFICATIONS,args:[e]}},{label:"Playlists",appLink:{application:t,action:n.EDIT_SUBJECT_PLAYLISTS,args:[e]}},{label:"Series",appLink:{application:t,action:n.EDIT_SUBJECT_SERIES,args:[e]}},{label:"Videos",appLink:{application:t,action:n.EDIT_SUBJECT_VIDEOS,args:[e]}}]},getEditClassificationTabs:function(e,t){var n=s.SUBJECTS,r=i.Subjects;return[{label:"Edit Classification Details",appLink:{application:n,action:r.EDIT_CLASSIFICATION,args:[e,t]}},{label:"Playlists",appLink:{application:n,action:r.EDIT_CLASSIFICATION_PLAYLISTS,args:[e,t]}},{label:"Series",appLink:{application:n,action:r.EDIT_CLASSIFICATION_SERIES,args:[e,t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_CLASSIFICATION_VIDEOS,args:[e,t]}}]}};function Yt(e){return(Yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qt(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function zt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Kt(e,t){return!t||"object"!==Yt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Wt(e){return(Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Gt(e,t){return(Gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Zt=function(){return"/api/subjects/v1/subjects/tree"},Qt=function(e){return"/api/subjects/v1/subjects/".concat(e)},Xt=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},$t=function(e,t,n){var r="/api/subjects/v1/subjects/".concat(e,"/classifications"),i=[];return t&&i.push("presentationId=".concat(t)),n&&i.push("query=".concat(n,"{limit:100}")),i.length?"".concat(r,"?").concat(i.join("&")):r},en=function(){return"/api/subjects/v1/subjects"},tn=function(e){return"/api/subjects/v1/subjects/".concat(e)},nn=function(e){return"/api/subjects/v1/subjects/".concat(e)},rn=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},an=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},on=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},cn=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},sn=function(){return"/api/subjects/v1/presentations"},ln=function(e){return"/api/subjects/v1/presentations/".concat(e)},un=function(){return"/api/subjects/v1/presentations"},pn=function(e){return"/api/subjects/v1/presentations/".concat(e)},fn=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},dn=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},mn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},bn=function(){return"/api/subjects/v1/classifications"},yn=function(e){return"/api/subjects/v1/classifications/".concat(e)},vn=function(e){return"/api/subjects/v1/classifications/".concat(e)},Sn=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},En=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},hn=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},gn=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},jn=function(){return"/api/subjects/v1/levels"},On=function(e){return"/api/subjects/v1/levels/".concat(e)},Tn=function(){return"/api/subjects/v1/levels"},In=function(e){return"/api/subjects/v1/levels/".concat(e)},Cn=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},An=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},Ln=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},Pn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Nn=function(){return"/api/subjects/v1/audiences"},kn=function(e){return"/api/subjects/v1/audiences/".concat(e)},wn=function(e){return"/api/subjects/v1/audiences/".concat(e)},Dn=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Fn=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},_n=function(e,t,n){var r="".concat(a.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(a.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},xn=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Kt(this,Wt(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Gt(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:sn(),eventPrefix:a.PRESENTATIONS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:ln(e),eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:un(),data:e,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created presentation."),errorHandler:this.alertService.error("Failed to create presentation.")})}},{key:"updatePresentation",value:function(e,t,n,r){return this.update({resource:pn(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated presentation."),errorHandler:this.alertService.error("Failed to update presentation.")})}},{key:"getSubjectTree",value:function(e,t){return this.get({resource:Zt(),formatData:function(e){return{children:e,name:kt.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:Qt(e),eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:Xt(e,t),eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:$t(e,t,n),eventPrefix:_n(e,t,n),expiryTime:d.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:en(),data:e,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created subject."),errorHandler:this.alertService.error("Failed to create subject.")})}},{key:"updateSubject",value:function(e,t,n,r){return this.update({resource:tn(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){return this.delete({resource:nn(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_SUBJECT,invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject"),errorHandler:this.alertService.error("Failed to delete subject")})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:rn(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=Mt.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.SUBJECTS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)),s.push.apply(s,qt(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:an(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(c," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,o){var c=1===t.length?Mt.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(qt(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),qt(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:on(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var o=1===t.length?Mt.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(qt(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:cn(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(o," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(o," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:fn(e),formatData:function(e){return{children:e,name:wt.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:dn(e),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:mn(e,t),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:bn(),data:e,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created classification."),errorHandler:this.alertService.error("Failed to create classification.")})}},{key:"updateClassification",value:function(e,t,n,r){return this.update({resource:yn(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated classification."),errorHandler:this.alertService.error("Failed to save classification.")})}},{key:"deleteClassification",value:function(e,t,n){return this.delete({resource:vn(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_CLASSIFICATION,invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],successHandler:this.alertService.success("Successfully deleted classification"),errorHandler:this.alertService.error("Failed to delete classification")})}},{key:"getObjectClassifications",value:function(e,t,n,r){return this.get({resource:Sn(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=Mt.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,qt(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:En(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(c," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?Mt.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(_n(r,i,n)),l.push.apply(l,qt(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:hn(e),data:t,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(s," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(s," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?Mt.singularizeMemberType(n):n,l=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&l.push(_n(r,i,n)),l.push.apply(l,qt(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:gn(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:l,expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(s," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(s," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:jn(),eventPrefix:a.LEVELS,expiryTime:d.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:On(e),eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Tn(),data:e,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created level."),errorHandler:this.alertService.error("Failed to create level.")})}},{key:"updateLevel",value:function(e,t,n,r){return this.update({resource:In(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated level."),errorHandler:this.alertService.error("Failed to save level.")})}},{key:"getObjectLevels",value:function(e,t,n,r){return this.get({resource:Cn(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=Mt.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:An(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(c," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:Ln(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:Pn(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:d.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Nn(),data:e,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created audience."),errorHandler:this.alertService.error("Failed to create audience.")})}},{key:"updateAudience",value:function(e,t,n,r){return this.update({resource:kn(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated audience."),errorHandler:this.alertService.error("Failed to update audience.")})}},{key:"deleteAudience",value:function(e,t,n){return this.delete({resource:wn(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_AUDIENCE,invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],successHandler:this.alertService.success("Successfully deleted audience"),errorHandler:this.alertService.error("Failed to delete audience")})}},{key:"getObjectAudiences",value:function(e,t,n,r){return this.get({resource:Dn(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:d.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=Mt.singularizeMemberType(r);return this.update({resource:Fn(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(a.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(c," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(c," audiences."))})}},{key:"name",get:function(){return u.SUBJECT}},{key:"channelName",get:function(){return l.SUBJECT}}])&&zt(n.prototype,r),i&&zt(n,i),t}(f.BaseDataService),Rn={dataServiceName:u.SUBJECT,dataChannelName:l.SUBJECT},Un={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},Rn),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),fetchData:function(n){return n.getSubjectMemberIds(e,t)},setData:n,onError:r})},getSubjectClassificationFetchOptions:function(e,t,n,r,i){return Object.assign(Object.assign({},Rn),{eventPrefix:_n(e,n,r),fetchData:function(t){return t.getSubjectClassifications(e,n,r)},setData:t,onError:i})},getObjectSubjectsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},Rn),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),fetchData:function(n){return n.getClassificationMembers(e,t)},setData:n,onError:r})},getObjectClassificationsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},Rn),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.LEVEL,":").concat(e),fetchData:function(t){return t.getLevel(e)},setData:t,onError:n})},getObjectLevelsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(a.AUDIENCE,":").concat(e),fetchData:function(t){return t.getAudience(e)},setData:t,onError:n})},getObjectAudiencesFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Rn),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}};function Bn(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&d.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}var Vn=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e.presentationId,e.masterId]}},Jn=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},Mn=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function Hn(e){var t=e.showLevels;return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Audiences"),!!t&&p.createElement("th",null,"Mapped Level(s)")))}function Yn(e){var t=e.audience,n=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.AppLink,{appLink:Vn(t)},t.name)),p.createElement("td",null,n.map((function(e){return p.createElement(d.AppLink,{key:e.id,appLink:Jn(e),className:"mr-2"},e.name)}))))}function qn(e){var t=e.audiences,n=e.levels;return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(Hn,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(Yn,{key:e.masterId,audience:e,levels:Mn(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function zn(e){var t=null===e.masterId||void 0===e.masterId,n=Object(we.useFormikContext)(),r=Object(d.useCanSubmitForm)(n);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(d.FormField,{label:"Mapped Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function Kn(e){return p.createElement(d.FormWrapper,{initialValues:e.audience,validationSchema:Rt,onSubmit:e.saveAudience},p.createElement(zn,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function Wn(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function Gn(e){var t,n,r,i,a,o=Mt.singularizeMemberType(e.memberType),c=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return f.ArrayHelper.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Levels"),p.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),p.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),p.createElement(br,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),p.createElement("h6",null,"Audiences"),p.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Er,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),p.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),p.createElement(qn,{levels:e.levels,audiences:e.presentationAudiences}),p.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!c.length&&p.createElement(Qn,{initialValues:{audienceIds:Wn(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function Zn(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Audience(s)",as:"select",name:"audienceIds",id:"audience-ids",multiple:!0,size:e.audiences.length,value:t.values.audienceIds},e.audiences.map((function(e){return p.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function Qn(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(Zn,{audiences:e.audiences}))}function Xn(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return p.createElement("tr",null,p.createElement("td",null,p.createElement(d.AppLink,{appLink:n(t)},t.name)),i.isPinnable&&p.createElement("td",null,p.createElement(Ne,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(d.Actions,{actions:r}))))}function $n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function tr(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,c=er(p.useState(!1),2),s=c[0],l=c[1],u=function(e,t){var n=e.pinnedVideoMasterId||null,r=$n(p.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===Nt.Videos}}(r,n);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var m="".concat(re.capitalizeFirstLetter(Mt.singularizeMemberType(n))," Name");return p.createElement(p.Fragment,null,p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,m),u.isPinnable&&p.createElement("th",null,"Pinned"),f.FunctionHelper.isFunction(a)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(Xn,{item:e,key:e.id,getItemAppLink:i,actions:f.FunctionHelper.isFunction(a)&&a(e),pinState:u})})))),u.isPinnable&&p.createElement(d.SpinnerButton,{showSpinner:s,onClick:function(){l(!0),o(u.currentPinnedVideo,(function(){return l(!1)}))},disabled:!u.canSubmit||s},"Save"))}function nr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var rr=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}},ir=function(e,t){return function(n){if(n.id===t)return!0;var r=ae.find(e,t);return!!ae.find(r,n.id)}};function ar(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=nr(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var u=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},m=function(e){return t.setFieldValue("subjectIds",f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},b=function(e){return"".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(d.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(d.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:d.ClassificationType[e]},e)}))),p.createElement(d.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(d.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(ot,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:u,collapse:c,noSelectionMessage:"No parent selected, this will be a root classification.",isNodeDisabled:ir(e.classificationTree,e.id)}))})),p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(ot,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:m,collapse:!r,getSelectedItemAppLink:rr}))})),p.createElement(Be,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(Be,{imageType:d.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(Ae.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function or(e){return p.createElement(d.FormWrapper,{initialValues:e.classification,validationSchema:Ut,onSubmit:e.saveClassification},p.createElement(ar,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var cr=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case Nt.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case Nt.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case Nt.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function sr(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?p.createElement(p.Fragment,null,p.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),p.createElement("div",{className:"py-2"},p.createElement(Ge,{tabs:Ht.getEditClassificationTabs(t.id,n),isItemActive:cr(r)}))):p.createElement(p.Fragment,null)}var lr=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,t]}}};function ur(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t),r=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},i="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(we.Form,null,p.createElement(d.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:i},p.createElement(ot,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:lr(e.presentationId),isNodeDisabled:e.isClassificationDisabled}))})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function pr(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(ur,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function fr(e){var t=null===e.id||void 0===e.id,n=Object(we.useFormikContext)(),r=Object(d.useCanSubmitForm)(n);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function dr(e){return p.createElement(d.FormWrapper,{initialValues:e.level,validationSchema:Bt,onSubmit:e.saveLevel},p.createElement(fr,{id:e.level&&e.level.id}))}function mr(e){var t=Mt.singularizeMemberType(e.memberType),n=Object(we.useFormikContext)(),r=Object(d.useCanSubmitForm)(n);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement(d.FormField,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(t," to a level, all of that level's")+" audiences across all presentations will also be added to.")),p.createElement("p",null,p.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),p.createElement("strong",null,"will not")," be automatically removed from."),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function br(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(mr,{levels:e.levels,memberType:e.memberType}))}function yr(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(d.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function vr(e){var t=e.presentation,n=(t=void 0===t?{}:t).id,r=void 0===n?null:n,i=t.name,a=void 0===i?"":i,o=t.description,c=void 0===o?"":o,s=e.savePresentation;return p.createElement(we.Formik,{initialValues:{name:a,description:c},validationSchema:Vt,onSubmit:s},(function(e){return p.createElement(yr,Object.assign({id:r},e))}))}var Sr=function(e,t){return f.ArrayHelper.first(t.filter((function(t){return t.id.toString()===e.toString()})))};function Er(e){var t=e.presentations,n=e.currentPresentation,r=e.setCurrentPresentation,i=e.label;return p.useEffect((function(){t&&!n&&r(t[0])}),[t]),p.createElement(p.Fragment,null,!!n&&p.createElement(p.Fragment,null,p.createElement(Ae.Form.Label,null,i),p.createElement(Ae.Form.Control,{as:"select",value:n.id,onChange:function(e){return n=e.target.value,i=Sr(n,t),void r(i);var n,i},className:"cursor-pointer"},t.map((function(e){return p.createElement("option",{value:e.id,key:e.id},e.name)})))))}function hr(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(re.capitalizeFirstLetter(e.memberType))),p.createElement(Ae.Table,{responsive:!0},p.createElement("tbody",null,e.objects&&e.objects.map((function(t){return p.createElement("tr",{key:t.id},p.createElement("td",null,p.createElement(d.AppLink,{appLink:Mt.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(wr,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function gr(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function jr(e){var t=Mt.singularizeMemberType(e.memberType),n=[].concat(gr(e.objectClassifications),gr(e.objectSubjectClassifications)).map((function(e){return e.id}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Subjects"),p.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),p.createElement(wr,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),p.createElement("h6",null,"Classifications"),p.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Er,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?p.createElement(p.Fragment,null,p.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),p.createElement(pr,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):p.createElement("p",null,"This presentation has no classifications."))}function Or(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Er.defaultProps={label:"Presentation"};var Tr=function(e,t){return function(n){if(n.id===t)return!0;var r=ae.find(e,t);return!!ae.find(r,n.id)}};function Ir(e){var t=!e.id,n=Object(we.useFormikContext)(),r=Object(d.useCanSubmitForm)(n),a=!t||!!n.values.parentId,o=Or(p.useState(a),2),c=o[0],l=o[1];p.useEffect((function(){return l(a)}),[e.id,n.values.parentId]);var u=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(d.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(d.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(ot,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:u,collapse:c,noSelectionMessage:"No parent selected, this will be a root subject.",isNodeDisabled:Tr(e.subjectTree,e.id)}))})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Cr(e){return p.createElement(d.FormWrapper,{initialValues:e.subject,validationSchema:Jt,onSubmit:e.saveSubject},p.createElement(Ir,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var Ar=function(e){return function(t){return t.appLink.action===e}};function Lr(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(Ae.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(Ge,{tabs:Ht.getEditSubjectTabs(t),isItemActive:Ar(n)})))}var Pr=function(e){return Tt.object().shape({subjectIds:e?Tt.array().of(Tt.string()).min(1,"A subject is required").required("A subject is required"):Tt.array().of(Tt.string()),addToClassifications:Tt.boolean().default(!0)}).noUnknown()},Nr=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function kr(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t),r=function(n){var r=e.allowMultiple?f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=Mt.singularizeMemberType(e.memberType),a="".concat(d.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(we.Form,null,p.createElement(d.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:a},p.createElement(ot,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:Nr}))})),p.createElement(d.FormField,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function wr(e){return p.createElement(d.FormWrapper,{initialValues:e.initialValues,validationSchema:Pr(e.subjectRequired),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(kr,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}kr.defaultProps={saveBtnText:"Save"};var Dr=function(e){return p.createElement("div",{className:"border rounded p-2 mb-3"},p.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?p.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return p.createElement("li",{key:t.id,className:"py-1"},p.createElement(d.AppLink,{appLink:(n=e.presentation.id,r=t.id,{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):p.createElement("p",null,p.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},Fr=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Dr,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},_r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},xr=function(e,t){return t?e.name:"Classification: ".concat(e.name)};function Rr(e){return p.createElement(p.Fragment,null,e.classifications.map((function(t){return p.createElement("th",{key:t.id},p.createElement("span",{className:"d-inline-block"},p.createElement(Ne,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(d.AppLink,{appLink:e.getClassificationAppLink(t.id)},xr(t,e.showClassificationSubHeader)))})))}function Ur(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=_r(e,["memberType","hasActions","classifications"]),a="".concat(re.capitalizeFirstLetter(Mt.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,l=Object.assign({classifications:r,showClassificationSubHeader:c},i);return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{rowSpan:s},a),o&&(c?p.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):p.createElement(Rr,Object.assign({},l))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(Rr,Object.assign({},l))))}function Br(e){var t=e.member,n=t.id,r=t.name,i=t.classifications,a=void 0===i?[]:i,o=e.getMemberAppLink,c=e.onToggleClassification,s=e.actions,l=f.FunctionHelper.isFunction(o)&&o(n);return a.length&&!f.FunctionHelper.isFunction(c)&&f.Core.ErrorHelper.throw(new f.DevError("onToggleClassification must be passed to SubjectMemberItem")),p.createElement("tr",null,p.createElement("td",null,l?p.createElement(d.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ne,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),s&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(d.Actions,{actions:s}))))}var Vr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Jr(e,t){return function(n){var r=n[e],i=d.CollectionHelper.length(r);return!!i&&i===t.length}}function Mr(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Vr(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var s=f.FunctionHelper.isFunction(r),l={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:Jr(n,t),onToggleClassification:o,hasActions:s};return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(Ur,Object.assign({},l)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(Br,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function Hr(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(Ae.Container,null,p.createElement(Ae.Navbar,{className:"justify-content-between align-items-center"},p.createElement(Ae.Nav,null,!!t&&t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:d.AppLink,appLink:e.appLink,active:$.isItemActive(e,n),className:$.isItemActive(e,n)?"text-primary":""},e.label))})))))}function Yr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function qr(e){var t=e.seriesId,n=Yr(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Se.getSeriesFetchOptions(e,r("series")),Un.getObjectLevelsFetchOptions(e,Nt.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(Un.getObjectAudiencesFetchOptions(e,Nt.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([Un.getPresentationsFetchOptions(r("presentations")),Un.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Un.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Bn(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(Ft,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(Ke,{object:r.series}),!!c&&p.createElement(Gn,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Nt.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Nt.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Nt.Series,n,n)}}))}function zr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Kr(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Wr(e){var t=e.seriesId,n=zr(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Un.getSubjectTreeFetchOptions(r("subjectTree")),Un.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Se.getSeriesFetchOptions(e,r("series")),Un.getObjectSubjectsFetchOptions(e,Nt.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Un.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(Kr(t.subjectClassifications||[]),Kr(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return Un.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(Un.getObjectClassificationsFetchOptions(e,Nt.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),Bn(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Ft,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(Ke,{object:r.series}),c&&p.createElement(jr,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:Nt.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Nt.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Nt.Series,n,n)}}))}var Gr=function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SERIES,action:i.Series.EDIT_SERIES,args:[t.id]})}};function Zr(){var e=Object(f.useService)(u.SERIES);return p.createElement(Lt,{saveSeries:function(t,n){return e.createSeries(t,Gr(n),n)}})}function Qr(e){return(Qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ei(e,t,n){return t&&$r(e.prototype,t),n&&$r(e,n),e}function ti(e,t){return!t||"object"!==Qr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ni(e){return(ni=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ri(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ii(e,t)}function ii(e,t){return(ii=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ai=function(e){function t(){return Xr(this,t),ti(this,ni(t).apply(this,arguments))}return ri(t,e),ei(t,[{key:"channelName",get:function(){return s.SERIES}},{key:"appRoutes",get:function(){return{"manage/series/new(/)":"newSeries","manage/series/:id(/)":"editSeries","manage/series/:id/videos(/)":"editSeriesVideos","manage/series/:id/subjects(/)":"editSeriesSubjects","manage/series/:id/audiences(/)":"editSeriesAudiences"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),t}(f.Core.AppRouter),oi=function(e){function t(){return Xr(this,t),ti(this,ni(t).apply(this,arguments))}return ri(t,e),ei(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Zr,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(xt,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){f.Core.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Wr,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qr,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(jt,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Ee.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Series Application"}},{key:"channelName",get:function(){return s.SERIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Ot}}}}],[{key:"router",get:function(){return ai}}]),t}(f.Core.Application);function ci(e){return(ci="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function si(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function li(e,t){return!t||"object"!==ci(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ui(e){return(ui=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pi(e,t){return(pi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fi,di=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},mi=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},bi=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},yi=function(e){return"/api/master/v2/objects/".concat(e)},vi=function(e){return"/api/master/v1/playlists/".concat(e)},Si=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},Ei=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},hi=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(fi||(fi={}));var gi=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),li(this,ui(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pi(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:di(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:mi(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:bi(t),data:Object.assign(Object.assign({},e),{permissions:ee()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created playlist."),errorHandler:this.alertService.error("Failed to create playlist.")})}},{key:"updatePlaylist",value:function(e,t,n,r){return this.update({resource:yi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:d.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated playlist"),errorHandler:this.alertService.error("Failed to update playlist")})}},{key:"deletePlaylist",value:function(e,t,n){return this.delete({resource:vi(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_PLAYLIST,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e)],successHandler:this.alertService.success("Successfully deleted playlist"),errorHandler:this.alertService.error("Failed to delete playlist.")})}},{key:"getPlaylistVideos",value:function(e,t,n){return this.get({resource:Si(e,fi.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(fi.Videos),expiryTime:d.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:Ei(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:d.CacheDurations.STANDARD,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorHandler:this.alertService.error("Failed to update playlist order.")})}},{key:"removeVideoFromPlaylist",value:function(e,t,n,r){return this.delete({resource:hi(e,t),eventPrefix:"".concat(a.REMOVE_PLAYLIST_VIDEO,":").concat(e,":").concat(t),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorCallback:r})}},{key:"name",get:function(){return u.PLAYLIST}},{key:"channelName",get:function(){return l.PLAYLIST}}])&&si(n.prototype,r),i&&si(n,i),t}(f.BaseDataService),ji={dataServiceName:u.PLAYLIST,dataChannelName:l.PLAYLIST},Oi={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ji),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e),fetchData:function(t){return t.getPlaylist(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_PLAYLIST})},getPlaylistsByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ji),{eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),fetchData:function(t){return t.getPlaylistsById(e)},setData:t,onError:n})},getPlaylistVideosFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ji),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(fi.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}},Ti=function(e){var t=e.children;return p.createElement(Ie,null,p.createElement(je,null,t))};function Ii(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ci(e){var t=e.playlistId,n=e.closePopup,r=Ii(p.useState(),2),a=r[0],o=r[1],c=Ii(p.useState(!1),2),l=c[0],m=c[1],b=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(Oi.getPlaylistFetchOptions(t,o),[t]);var y=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),v=p.useCallback((function(){m(!0),b.deletePlaylist(t,y,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:v,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:l}],E=!!a;return p.createElement(d.Popup,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Please ensure it is not being used in any widgets.")),p.createElement(d.PopupButtons,{buttons:S})))}var Ai=Tt.object().shape({name:Tt.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Tt.string().trim().max(65535,"Description is too long").default(""),cover:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown(),banner:Tt.object().shape({fileId:Tt.string(),fileIdType:Tt.mixed(),url:Tt.string()}).default({}).noUnknown()}).noUnknown(),Li={onSort:function(e,t,n,r){if(f.FunctionHelper.isFunction(r)){if(t!==n){var i=f.ArrayHelper.moveItem(e,t,n),a=n<e.length-1?i[n+1].id:null;r(i,{sourceMemberId:i[n].id,destinationMemberId:a})}}else f.Core.ErrorHelper.throw(new f.DevError("A callback function must be passed to onSort"))}},Pi={getEditPlaylistTabs:function(e,t){var n=s.PLAYLISTS,r=i.Playlists,a=[{label:"Edit Playlist Details",appLink:{application:n,action:r.EDIT_PLAYLIST,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_PLAYLIST_VIDEOS,args:[t]}}];return te(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),a}};function Ni(e){var t=Object(we.useFormikContext)(),n=Object(d.useCanSubmitForm)(t);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(d.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(Be,{imageType:d.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(Be,{imageType:d.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(d.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(d.Actions,{actions:e.actions})))}var ki=function(e){return[{label:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[e]},className:"text-danger"}]};function wi(e){var t=e.playlist&&e.playlist.id;return p.createElement(d.FormWrapper,{initialValues:e.playlist,validationSchema:Ai,onSubmit:e.savePlaylist},p.createElement(Ni,{id:t,actions:!!t&&ki(t)}))}var Di=function(e){return function(t){return t.appLink.action===e}};function Fi(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Te);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(Ge,{tabs:Pi.getEditPlaylistTabs(r,t),isItemActive:Di(n)}))}function _i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xi(e){var t=e.playlistId,n=_i(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(Oi.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Fi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(wi,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}function Ri(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ui(e){var t=e.playlistId,n=Ri(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Oi.getPlaylistFetchOptions(e,r("playlist")),Un.getObjectLevelsFetchOptions(e,Nt.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(Un.getObjectAudiencesFetchOptions(e,Nt.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([Un.getPresentationsFetchOptions(r("presentations")),Un.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Un.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Bn(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(Fi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(Ke,{object:r.playlist}),!!c&&p.createElement(Gn,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Nt.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Nt.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Nt.Playlists,n,n)}}))}function Bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Vi(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Ji(e){var t=e.playlistId,n=Bi(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Un.getSubjectTreeFetchOptions(r("subjectTree")),Un.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Oi.getPlaylistFetchOptions(e,r("playlist")),Un.getObjectSubjectsFetchOptions(e,Nt.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Un.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(Vi(t.subjectClassifications||[]),Vi(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return Un.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(Un.getObjectClassificationsFetchOptions(e,Nt.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),Bn(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Fi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(Ke,{object:r.playlist}),c&&p.createElement(jr,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:Nt.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Nt.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Nt.Playlists,n,n)}}))}function Mi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Hi=function(e){return function(t){return[{label:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},Yi=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function qi(e){var t=e.playlistId,n=Mi(p.useState(),2),r=n[0],a=n[1],o=Mi(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([Oi.getPlaylistFetchOptions(e,t),Oi.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(Fi,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(Ke,{object:r}),!!c&&p.createElement(ht,{onSortEnd:function(e,n){if(c.data&&c.data[e]){Li.onSort(c.data,e,n,(function(e,n){l.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:Yi,getVideoActions:Hi(t),emptyMessage:"There are no videos in this playlist."}))}function zi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ki=function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:[t.id]})}};function Wi(){var e=zi(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(Q.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(wi,{savePlaylist:function(e,n){return r.createPlaylist(e,t.id,Ki(n),n)}}))}function Gi(e){return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qi(e,t){return!t||"object"!==Gi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Xi(e){return(Xi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $i(e,t){return($i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ea=function(e){return"/api/master/v2/objects/".concat(e)},ta=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},na=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Qi(this,Xi(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$i(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:ea(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:ta(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:d.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"name",get:function(){return u.VIDEO}},{key:"channelName",get:function(){return l.VIDEO}}])&&Zi(n.prototype,r),i&&Zi(n,i),t}(f.BaseDataService),ra={dataServiceName:u.VIDEO,dataChannelName:l.VIDEO},ia={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ra),{eventPrefix:"".concat(a.VIDEO,":").concat(e),fetchData:function(t){return t.getVideo(e)},setData:t,onError:n})},getVideosByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},ra),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})}};function aa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function oa(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=aa(p.useState(),2),a=i[0],o=i[1],c=aa(p.useState(),2),s=c[0],l=c[1],m=aa(p.useState(!1),2),b=m[0],y=m[1],v=Object(f.useService)(u.PLAYLIST);Object(f.useFetch)(ia.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(Oi.getPlaylistFetchOptions(n,l),[n]);var S=p.useCallback((function(){y(!0),v.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),E=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:b}],h=s&&a;return p.createElement(d.Popup,{title:"Remove Video",closePopup:r,showLoadingSpinner:!h},!!h&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(d.PopupButtons,{buttons:E})))}function ca(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var sa=function(e,t,n){return[{variant:"link",onClick:t,buttonText:"Cancel"},{variant:"danger",onClick:e,buttonText:"Yes, delete this audience",isSpinnerButton:!0,showSpinner:n}]};function la(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=ca(p.useState(),2),a=i[0],o=i[1],c=ca(p.useState(!1),2),s=c[0],l=c[1],m=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Un.getAudienceFetchOptions(t,o),[t]);return p.createElement(d.Popup,{title:"Delete Audience",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(d.PopupButtons,{buttons:sa((function(){l(!0);m.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function ua(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var pa=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function fa(e){var t=e.presentationId,n=e.audienceId,r=ua(p.useState(),2),i=r[0],a=r[1],o=ua(p.useState(),2),c=o[0],s=o[1],l=ua(p.useState(),2),d=l[0],m=l[1],b=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Un.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(Un.getLevelsFetchOptions(s),[]),Object(f.useFetch)(Un.getPresentationFetchOptions(t,m),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ce,{appLink:pa(t),backToName:"audiences"})),!!d&&p.createElement("h6",null,"Presentation: ".concat(d.name)),!!i&&!!c&&p.createElement(Kn,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function da(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ma=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},ba=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},ya={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function va(e){var t=e.presentationId,n=da(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(Un.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ce,{appLink:ya,backToName:"presentations"})),p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),p.createElement(d.AppLink,{appLink:ba(t),className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(We,{objects:r,getAppLink:ma(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function Sa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ea=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}},ha=function(e,t){return function(n){t(),f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}};function ga(e){var t=e.presentationId,n=Sa(p.useState(),2),r=n[0],i=n[1],a=Sa(p.useState(),2),o=a[0],c=a[1],s=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Un.getLevelsFetchOptions(i),[]),Object(f.useFetch)(Un.getPresentationFetchOptions(t,c),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(Ce,{appLink:Ea(t),backToName:"audiences"})),!!o&&p.createElement("h6",null,"Presentation: ".concat(o.name)),!!r&&p.createElement(Kn,{levels:r,presentationId:t,saveAudience:function(e,n){return s.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),ha(t,n),n)}}))}function ja(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function Oa(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},ja(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Ta=n(18),Ia=n.n(Ta);function Ca(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Aa(e){var t=e.presentationId,n=e.selectedClassificationId,r=Ca(p.useState(),2),a=r[0],o=r[1],c=Ca(p.useState(),2),l=c[0],u=c[1];return function(e,t,n){var r=Un.getClassificationTreeFetchOptions(e,t),i=Un.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,u),p.createElement("div",{className:"".concat(Ia.a.navContainer," h-auto pr-2 border-right")},!!l&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(l.name,")")),p.createElement(d.AppLink,{appLink:ja(t),className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(nt,{tree:a,getAppLink:function(e){return function(e,t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:Oa(t)})))}function La(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Pa(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=La(p.useState(),2),a=i[0],o=i[1],c=La(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(Un.getClassificationFetchOptions(t,o),[]);var m=Object(f.useService)(u.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!0);m.deleteClassification(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:s}];return p.createElement(d.Popup,{title:"Delete Classification",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(d.PopupButtons,{buttons:b})))}function Na(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ka(e){var t=e.presentationId,n=e.classificationId,r=Na(p.useState(),2),i=r[0],a=r[1],o=Na(p.useState(),2),c=o[0],s=o[1],l=Na(p.useState(),2),d=l[0],m=l[1],b=Na(p.useState(),2),y=b[0],v=b[1],S=Object(f.useService)(u.SUBJECT),E=Un.getClassificationFetchOptions(n,a),h=Un.getPresentationFetchOptions(t,s),g=Un.getClassificationTreeFetchOptions(t,m),j=Un.getSubjectTreeFetchOptions(v);Object(f.useFetch)(j,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(sr,{presentation:c,classificationId:n}),!!i&&!!d&&!!y&&p.createElement(or,{classification:i,presentationId:t,subjectTree:y,classificationTree:d,saveClassification:function(e,t){return S.updateClassification(n,e,t,t)}}))}function wa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Da(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=wa(p.useState(),2),a=i[0],o=i[1],c=wa(p.useState(),2),s=c[0],l=c[1],d=wa(p.useState(),2),m=d[0],b=d[1];Object(f.useFetch)(Un.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(Un.getClassificationFetchOptions(n,l),[n]),Object(f.useFetch)(Un.getClassificationMembersFetchOptions(n,r,b),[n,r]);var y=Object(f.useService)(u.SUBJECT),v={items:m&&m.data,memberType:r,classification:s,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},s),{pinnedVideoMasterId:e});y.updateClassification(n,r,t)},getItemAppLink:function(e){return Mt.getMemberAppLink(r,e.id)},getActions:function(e){return Mt.getMemberActions(n,Pt.Classification,r,e.id)}},S={presentation:a,classificationId:n},E=ne.propsLoaded(v);return p.createElement(p.Fragment,null,p.createElement(sr,Object.assign({},S,{memberType:r})),E&&p.createElement(tr,Object.assign({},v)))}function Fa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var _a=function(e,t){return function(n){t(),n&&n.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}};function xa(e){var t=e.presentationId,n=e.parentId,r=Fa(p.useState(),2),i=r[0],a=r[1],o=Fa(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.SUBJECT),d=Un.getClassificationTreeFetchOptions(t,a),m=Un.getSubjectTreeFetchOptions(s);Object(f.useFetch)(m,[]),Object(f.useFetch)(d,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!c&&!!i&&p.createElement(or,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:c,classificationTree:i,saveClassification:function(e,n){return l.createClassification(Object.assign(Object.assign({},e),{presentationId:t}),_a(t,n),n)}}))}function Ra(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ua=function(e,t,n){switch(e){case Nt.Playlists:return Oi.getPlaylistFetchOptions(t,n);case Nt.Series:return Se.getSeriesFetchOptions(t,n);case Nt.Videos:return ia.getVideoFetchOptions(t,n)}},Ba=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(Mt.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Va(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Ra(p.useState(),2),o=a[0],c=a[1],s=Ra(p.useState(),2),l=s[0],m=s[1],b=Ra(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Ua(r,n,m),[n]),Object(f.useFetch)(Un.getClassificationFetchOptions(t,c),[t]);var E=!!o&&!!l,h="Remove ".concat(re.capitalizeFirstLetter(Mt.singularizeMemberType(r)));return p.createElement(d.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(d.PopupButtons,{buttons:Ba(i,(function(){v(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i),o.pinnedVideoMasterId===n&&S.updateClassification(t,Object.assign(Object.assign({},o),{pinnedVideoMasterId:null}))}),r,y)})))}function Ja(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ma(e){var t=e.id,n=Ja(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Un.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(dr,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function Ha(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Ya=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},qa={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function za(){var e=Ha(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(Un.getLevelsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),p.createElement(d.AppLink,{appLink:qa,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(We,{objects:t,getAppLink:Ya}))}var Ka=function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[t.id]})}};function Wa(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(dr,{saveLevel:function(t,n){return e.createLevel(t,Ka(n),n)}}))}function Ga(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Za(e){var t=e.id,n=Ga(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(Un.getPresentationFetchOptions(t,i),[t]);var o={presentation:r,savePresentation:function(e,n){var r=n.setSubmitting;return a.updatePresentation(t,e,(function(){return r(!1)}),(function(){return r(!1)}))}},c=ne.propsLoaded(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(vr,Object.assign({},o)))}function Qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Xa=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},$a={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function eo(){var e=Qa(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(Un.getPresentationsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),p.createElement(d.AppLink,{appLink:$a,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(We,{objects:t,getAppLink:Xa}))}function to(){var e=Object(f.useService)(u.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(vr,{savePresentation:function(t,n){var r=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,r)}),(function(){return r(!1)}))}}))}function no(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ro(e){var t=e.objectType,n=e.getAppLink,r=no(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(Un.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,"Select a presentation to view its ".concat(t,":")),p.createElement(We,{objects:i,getAppLink:n}))}function io(e,t){return d.StateHelper.getSetStateByKey(e,t)}function ao(e,t){var n=e.memberType,r=e.objectIds,i=Un.getSubjectTreeFetchOptions(io(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case Nt.Playlists:return Oi.getPlaylistsByIdFetchOptions(t,n);case Nt.Series:return Se.getSeriesByIdFetchOptions(t,n);case Nt.Videos:return ia.getVideosByIdFetchOptions(t,n)}}(n,r,io(t,"objects"));Object(f.useFetch)(a,[n,r])}function oo(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return io(r,"showConfirmationPopup")(!1)};e.addObjectsToSubject(a.id,o.map((function(e){return e.id})),t.memberType,n.addToClassifications,(function(){c(),f.Core.AppLinkHelper.trigger(function(e,t){var n={application:s.SUBJECTS,args:[e]};switch(t){case Nt.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case Nt.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case Nt.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function co(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(Mt.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function so(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var lo=function(e){return re.capitalizeFirstLetter(Mt.singularizeMemberType(e))},uo=function(e,t){return function(n,r,i){i(),io(t,"selectedSubject")(ae.find(e.subjectTree,f.ArrayHelper.first(n))),io(t,"addToClassifications")(r),io(t,"showConfirmationPopup")(!0)}};function po(e){var t=so(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(u.SUBJECT);ao(e,r);return p.createElement(p.Fragment,null,!!n.objects&&!!n.subjectTree&&p.createElement(hr,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:uo(n,r)}),n.showConfirmationPopup&&p.createElement(d.ConfirmationPopup,{title:co(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return oo(i,e,n,r)},closePopup:function(){return e=!1,io(r,"showConfirmationPopup")(e);var e}},p.createElement("p",null,"The following ".concat(e.memberType," will be added to "),p.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),p.createElement("ul",null,n.objects.map((function(e){return p.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&p.createElement("p",null,"".concat(1===n.objects.length?"It":"They"," will not be added to its mapped classifications.")),p.createElement("p",null,"".concat(lo(e.memberType)," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(re.capitalizeFirstLetter(e.memberType)," ")),"page.")))}function fo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function mo(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=fo(p.useState(),2),a=i[0],o=i[1],c=fo(p.useState(!1),2),s=c[0],l=c[1];Object(f.useFetch)(Un.getSubjectFetchOptions(t,o),[]);var m=Object(f.useService)(u.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){l(!0);m.deleteSubject(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:s}];return p.createElement(d.Popup,{title:"Delete Subject",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),p.createElement(d.PopupButtons,{buttons:b})))}function bo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function yo(e){var t=e.subjectId,n=bo(p.useState(),2),r=n[0],a=n[1],o=bo(p.useState(),2),c=o[0],s=o[1],l=Object(f.useService)(u.SUBJECT),d=Un.getSubjectFetchOptions(t,a),m=Un.getSubjectTreeFetchOptions(s);Object(f.useFetch)(m,[]),Object(f.useFetch)(d,[t]);return p.createElement(p.Fragment,null,p.createElement(Lr,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Cr,{subject:r,subjectTree:c,saveSubject:function(e,n){return l.updateSubject(t,e,n,n)}}))}function vo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var So=p.createContext(void 0);function Eo(e){var t=e.children,n=vo(p.useState(),2),r=n[0],i=n[1];return p.createElement(So.Provider,{value:[r,i]},t)}var ho=function(e){var t=e.children;return p.createElement(Ie,null,p.createElement(Eo,null,p.createElement(je,null,t)))};function go(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function jo(e,t){return d.StateHelper.getSetStateByKey(e,t)}function Oo(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=go(p.useContext(So),1)[0];Object(f.useFetch)(Un.getPresentationsFetchOptions(jo(n,"presentations")),[]),Object(f.useFetch)(Un.getSubjectMemberIdsFetchOptions(r,i,jo(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case Nt.Playlists:return Oi.getPlaylistsByIdFetchOptions(t,n);case Nt.Series:return Se.getSeriesByIdFetchOptions(t,n);case Nt.Videos:return ia.getVideosByIdFetchOptions(t,n)}}(i,a,jo(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&Un.getSubjectClassificationFetchOptions(r,jo(n,"classifications"),o.id,i),[r,i,o],!!o)}var To=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case Nt.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case Nt.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case Nt.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function Io(e){switch(e){case Nt.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case Nt.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case Nt.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}function Co(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ao(e){var t=e.subjectId,n=e.memberType,r=Co(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,l=i.membersWithClassifications,d=Co(p.useContext(So),2),m=d[0],b=d[1],y=Object(f.useService)(u.SUBJECT);Oo(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){jo(n,"membersWithClassifications")(function(e,t,n){if(!t||!n)return;return t.map((function(t){return{id:t.id,name:t.name,classifications:n.map((function(n){return{id:n.id,selected:(r=t,i=n,!!i[e]&&!!i[e].data.filter((function(e){return e.id===r.id})).length)};var r,i}))}}))}(e.memberType,i,a))}),[i,a]),p.useEffect((function(){i&&i.length&&r&&!r.length&&jo(n,"members")([])}),[r])}(e,i,a);var v={presentations:o,currentPresentation:m,setCurrentPresentation:b},S={members:l||[],memberType:n,getMemberAppLink:function(e){return Mt.getMemberAppLink(n,e)},getActions:function(e){return Mt.getMemberActions(t,Pt.Subject,n,e)},classifications:c,getClassificationAppLink:m&&To(n,m.id),onToggleClassification:function(e,r,i){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,n,i?[i]:s,t,m&&m.id,e,r)}},E=!!m&&!!c;return p.createElement(p.Fragment,null,p.createElement(Lr,{subjectId:t,activeAction:Io(n)}),p.createElement(Ae.Alert,{variant:"info",className:"m-0"},"Select which ".concat(n," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),p.createElement("div",{className:"w-50 py-2"},!!o&&p.createElement(Er,Object.assign({},v))),E&&p.createElement(Mr,Object.assign({},S)))}function Lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Po=function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]})}};function No(e){var t=e.parentId,n=Lo(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT),c=Un.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var l={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(Ce,{backToName:"Presentations",appLink:l})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Cr,{subject:{parentId:t},subjectTree:r,saveSubject:function(e,t){return o.createSubject(e,Po(t),t)}}))}function ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var wo=function(e,t,n){switch(e){case Nt.Playlists:return Oi.getPlaylistFetchOptions(t,n);case Nt.Series:return Se.getSeriesFetchOptions(t,n);case Nt.Videos:return ia.getVideoFetchOptions(t,n)}},Do=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(Mt.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function Fo(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=ko(p.useState(),2),o=a[0],c=a[1],s=ko(p.useState(),2),l=s[0],m=s[1],b=ko(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(u.SUBJECT);Object(f.useFetch)(wo(r,n,m),[n]),Object(f.useFetch)(Un.getSubjectFetchOptions(t,c),[t]);var E=!!o&&!!l,h="Remove ".concat(re.capitalizeFirstLetter(Mt.singularizeMemberType(r)));return p.createElement(d.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,l.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),p.createElement(d.PopupButtons,{buttons:Do(i,(function(){v(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,y)})))}function _o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function xo(e){var t=e.subjectId,n=_o(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return d.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(Un.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(Un.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Lr,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(Fr,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var Ro=n(19),Uo=n.n(Ro);function Bo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Vo(e){var t=e.selectedSubjectId,n=Bo(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(Un.getSubjectTreeFetchOptions(a),[]);var o=p.useCallback((function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),c={application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},l=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return p.createElement("div",{className:"".concat(Uo.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(d.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(nt,{tree:r,getAppLink:o,selectedIds:[t],actions:l})))}function Jo(e){var t=e.currentAppLink;return p.createElement(Hr,{navItems:Ht.getTopNavItems(),currentAppLink:t})}function Mo(e){return(Mo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ho(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qo(e,t,n){return t&&Yo(e.prototype,t),n&&Yo(e,n),e}function zo(e,t){return!t||"object"!==Mo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ko(e){return(Ko=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wo(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Go(e,t)}function Go(e,t){return(Go=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Zo=function(e){function t(){return Ho(this,t),zo(this,Ko(t).apply(this,arguments))}return Wo(t,e),qo(t,[{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/:id(/)":"editPlaylist","manage/playlists/:id/videos(/)":"editPlaylistVideos","manage/playlists/:id/subjects(/)":"editPlaylistSubjects","manage/playlists/:id/audiences(/)":"editPlaylistAudiences"}}},{key:"appLinks",get:function(){return["deletePlaylist","removeVideo","uploadImage","removeFromSubject"]}}]),t}(f.Core.AppRouter),Qo=function(e){function t(){return Ho(this,t),zo(this,Ko(t).apply(this,arguments))}return Wo(t,e),qo(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Wi,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(xi,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(qi,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ji,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ui,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Ci,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(oa,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:Nt.Playlists},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Fo,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(jt,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Ee.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"navigate",value:function(e){f.Core.LocationUtils.PageLoad(e)}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Ti}}}}],[{key:"router",get:function(){return Zo}}]),t}(f.Core.Application);function Xo(e){return(Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tc(e,t,n){return t&&ec(e.prototype,t),n&&ec(e,n),e}function nc(e,t){return!t||"object"!==Xo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function rc(e){return(rc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ic(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ac(e,t)}function ac(e,t){return(ac=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var oc=function(e){function t(){return $o(this,t),nc(this,rc(t).apply(this,arguments))}return ic(t,e),tc(t,[{key:"channelName",get:function(){return s.SUBJECTS}},{key:"appRoutes",get:function(){return{"manage/subjects(/)":"subjects","manage/subjects/add-objects(/)":"addSubjectMembers","manage/subjects/new(/)":"newSubject","manage/subjects/:id/edit(/)":"editSubject","manage/subjects/:id/edit/playlists(/)":"editSubjectPlaylists","manage/subjects/:id/edit/series(/)":"editSubjectSeries","manage/subjects/:id/edit/videos(/)":"editSubjectVideos","manage/subjects/:id/classifications(/)":"subjectClassifications","manage/subjects/classifications(/)":"classifications","manage/subjects/presentations/:id/classifications(/)":"presentationClassifications","manage/subjects/presentations/:id/classifications/new(/)":"newClassification","manage/subjects/presentations/:id/classifications/:id/edit(/)":"editClassification","manage/subjects/presentations/:id/classifications/:id/edit/playlists(/)":"editClassificationPlaylists","manage/subjects/presentations/:id/classifications/:id/edit/series(/)":"editClassificationSeries","manage/subjects/presentations/:id/classifications/:id/edit/videos(/)":"editClassificationVideos","manage/subjects/levels(/)":"levels","manage/subjects/levels/new(/)":"newLevel","manage/subjects/levels/:id(/)":"editLevel","manage/subjects/audiences(/)":"audiences","manage/subjects/presentations/:id/audiences(/)":"presentationAudiences","manage/subjects/presentations/:id/audiences/new(/)":"newAudience","manage/subjects/presentations/:id/audiences/:id/edit(/)":"editAudience","manage/subjects/presentations(/)":"presentations","manage/subjects/presentations/new":"newPresentation","manage/subjects/presentations/:id(/)":"editPresentation"}}},{key:"appLinks",get:function(){return["deleteClassification","removeClassificationMember","deleteSubject","removeSubjectMember","deleteAudience","uploadImage"]}}]),t}(f.Core.AppRouter),cc=function(e){function t(){return $o(this,t),nc(this,rc(t).apply(this,arguments))}return ic(t,e),tc(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(u.SUBJECT,this),f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(No,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(yo,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:Nt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ao,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:Nt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ao,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:Nt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ao,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(xo,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"addSubjectMembers",value:function(e){var t=e.memberType,n=e.objectIds;if(t&&n){var r={memberType:t,objectIds:Array.isArray(n)?n:[n]};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(po,Object.assign({},r))),this.hideLeftNav()}}},{key:"removeSubjectMember",value:function(e,t,n){var r=Object.assign({subjectId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Fo,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(mo,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ro,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(xa,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ka,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Nt.Playlists};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Da,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Nt.Series};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Da,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Nt.Videos};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Da,Object.assign({key:"".concat(t,":videos")},n))),this.renderClassificationLeftNav(e,t)}},{key:"removeClassificationMember",value:function(e,t,n){var r=Object.assign({classificationId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Va,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Pa,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(za,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Wa,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Ma,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ro,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(va,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(ga,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(fa,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(la,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(eo,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(to,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Za,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(jt,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Ee.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Aa,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(d.LayoutRegions.LEFT_NAV,p.createElement(Vo,{selectedSubjectId:e}))}},{key:"setCurrentLeftNavItem",value:function(e){this.currentLeftNavId=e||null}},{key:"hideLeftNav",value:function(){this.setCurrentLeftNavItem(),this.layout.hideLeftNav()}},{key:"getTopNav",value:function(e){return p.createElement(Jo,{currentAppLink:e})}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Subjects Application"}},{key:"channelName",get:function(){return s.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:ho,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return oc}}]),t}(f.Core.Application),sc=function(e){var t=e.children;return p.createElement(Ie,null,p.createElement(je,null,t))},lc={getEditVideoTabs:function(e){var t=s.VIDEOS,n=i.Videos;return[{label:"Edit Video Details",appLink:{application:t,action:n.EDIT_VIDEO,args:[e]}},{label:"Subjects",appLink:{application:t,action:n.EDIT_VIDEO_SUBJECTS,args:[e]}},{label:"Audiences",appLink:{application:t,action:n.EDIT_VIDEO_AUDIENCES,args:[e]}}]}},uc=function(e){return function(t){return t.appLink.action===e}};function pc(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(Ge,{tabs:lc.getEditVideoTabs(t),isItemActive:uc(n)}))}function fc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function dc(e){var t=e.videoId,n=fc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([ia.getVideoFetchOptions(e,r("video")),Un.getObjectLevelsFetchOptions(e,Nt.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(Un.getObjectAudiencesFetchOptions(e,Nt.Videos,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([Un.getPresentationsFetchOptions(r("presentations")),Un.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Un.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Bn(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(pc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(Ke,{object:r.video}),!!c&&p.createElement(Gn,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Nt.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Nt.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Nt.Videos,n,n)}}))}function mc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function bc(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function yc(e){var t=e.videoId,n=mc(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(u.SUBJECT);!function(e,t,n){var r=function(e){return d.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Un.getSubjectTreeFetchOptions(r("subjectTree")),Un.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([ia.getVideoFetchOptions(e,r("video")),Un.getObjectSubjectsFetchOptions(e,Nt.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Un.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(bc(t.subjectClassifications||[]),bc(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return Un.getSubjectClassificationFetchOptions(e.id,d.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(Un.getObjectClassificationsFetchOptions(e,Nt.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),Bn(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(pc,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(Ke,{object:r.video}),c&&p.createElement(jr,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:Nt.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:d.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Nt.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Nt.Videos,n,n)}}))}function vc(e){return(vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hc(e,t,n){return t&&Ec(e.prototype,t),n&&Ec(e,n),e}function gc(e,t){return!t||"object"!==vc(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jc(e){return(jc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tc(e,t)}function Tc(e,t){return(Tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ic=function(e){function t(){return Sc(this,t),gc(this,jc(t).apply(this,arguments))}return Oc(t,e),hc(t,[{key:"channelName",get:function(){return s.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects"}}}]),t}(f.Core.AppRouter),Cc=function(e){function t(){return Sc(this,t),gc(this,jc(t).apply(this,arguments))}return Oc(t,e),hc(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(u).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"editVideo",value:function(e){f.Core.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(dc,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(yc,{videoId:e}))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Ee.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return s.VIDEOS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:sc}}}}],[{key:"router",get:function(){return Ic}}]),t}(f.Core.Application),Ac=n(10),Lc={namespace:"domain_options"},Pc=function(){return"/api/domain/v3/settings/types"},Nc=function(e){return"/api/domain/v3/settings/types/".concat(e)},kc=function(){return"/api/domain/v3/settings/types"},wc=function(e){return"/api/domain/v3/settings/types/".concat(e)},Dc=function(e){return"/api/domain/v3/settings/types/".concat(e)},Fc="domain:options",_c="domain:option",xc="update:domain:option",Rc="delete:domain:option",Uc={getAllOptions:function(){return{key:Fc,url:Pc(),normalizeOptions:Lc}},getOption:function(e){return{key:"".concat(_c,":").concat(e),url:Nc(e),normalizeOptions:Lc}},createOption:function(e,t,n){return{key:_c,url:kc(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[Fc],normalizeOptions:Lc}},updateOption:function(e,t){return{key:"".concat(xc,":").concat(e.id),url:wc(e.id),data:e,type:f.HttpVerbs.PUT,always:t,formatData:function(){return e},normalizeOptions:Lc}},deleteOption:function(e,t){return{key:"".concat(Rc,":").concat(e),url:Dc(e),type:f.HttpVerbs.DELETE,invalidationKeys:[Fc],normalizeOptions:Lc,success:t}}};function Bc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Vc(e){var t=Bc(p.useState(!1),2),n=t[0],r=t[1],a=f.Flight.useBasicFetch(Uc.getOption(e.optionId)),o=Object(Ac.useDispatch)(),c=function(){e.closePopup(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DOMAIN_OPTIONS})};return p.createElement(d.Popup,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!a.data},a.data&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.data.name),"?")),p.createElement(d.PopupButtons,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){r(!0),f.Flight.fetch(o,Uc.deleteOption(e.optionId,c))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var Jc=function(e){return{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},Mc={application:s.DOMAIN_OPTIONS,action:i.DomainOptions.NEW_DOMAIN_OPTION};function Hc(){var e=f.Flight.useBasicFetch(Uc.getAllOptions());if(!e.data)return p.createElement(p.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),p.createElement(d.AppLink,{appLink:Mc,className:"d-block"},p.createElement(d.SvgContainer,{svgName:d.cvSvgLibrary.Plus,size:d.SvgContainerSize.Small}),p.createElement("span",null,"New Domain Option"))),p.createElement(We,{objects:t,getAppLink:Jc}))}var Yc=n(6),qc=Tt.object().shape({id:Tt.string(),name:Tt.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:Tt.string().trim().max(255,"Display name is too long").default(""),type:Tt.mixed().required("Type is required").default(Yc.DomainOptionType.Boolean),entityType:Tt.mixed().required("Entity type is required").default(d.MasterType.Customer),kind:Tt.mixed().required("Kind is required").default(Yc.DomainOptionKind.Temporary),defaultValue:Tt.mixed().required("Default value is required").default("false")}).noUnknown();function zc(e){var t=e.type,n=e.defaultValue;if(!t)return p.createElement(p.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===Yc.DomainOptionType.Boolean?p.createElement(d.FormField,Object.assign({as:"select"},r),p.createElement("option",{value:"true"},"True"),p.createElement("option",{value:"false"},"False")):t===Yc.DomainOptionType.Long||t===Yc.DomainOptionType.StaffRequest?p.createElement(d.FormField,Object.assign({as:"input",type:"number"},r)):t===Yc.DomainOptionType.String?p.createElement(d.FormField,Object.assign({as:"input"},r)):void 0}var Kc=[d.MasterType.Customer,d.MasterType.User];function Wc(e){var t=null===e.id||void 0===e.id,n=Object(we.useFormikContext)(),r=Object(d.useCanSubmitForm)(n);return p.createElement(we.Form,null,p.createElement(d.FormField,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),p.createElement(d.FormField,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),p.createElement(d.FormField,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},f.ObjectHelper.getEnumKeys(Yc.DomainOptionKind).map((function(e){return p.createElement("option",{key:e,value:Yc.DomainOptionKind[e]},e)}))),p.createElement(d.FormField,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},f.ObjectHelper.getEnumKeys(d.MasterType).filter((function(e){return Kc.includes(d.MasterType[e])})).map((function(e){return p.createElement("option",{key:e,value:d.MasterType[e]},e)}))),p.createElement(d.FormField,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},f.ObjectHelper.getEnumKeys(Yc.DomainOptionType).map((function(e){return p.createElement("option",{key:e,value:Yc.DomainOptionType[e]},e)}))),p.createElement(zc,{type:n.values.type,defaultValue:n.values.defaultValue}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(d.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:d.AppLink,variant:"danger",appLink:{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function Gc(e){return p.createElement(d.FormWrapper,{initialValues:e.domainOption,validationSchema:qc,onSubmit:e.saveDomainOption},p.createElement(Wc,{id:e.domainOption&&e.domainOption.id}))}function Zc(){var e=Object(Ac.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Domain Option"),p.createElement(Gc,{saveDomainOption:function(t,n){f.Flight.fetch(e,Uc.createOption(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function Qc(e){var t=e.optionId,n=f.Flight.useBasicFetch(Uc.getOption(t)),r=Object(Ac.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&p.createElement(Gc,{domainOption:n.data,saveDomainOption:function(e,t){return f.Flight.fetch(r,Uc.updateOption(e,t))}}))}function Xc(e){return(Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function es(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ts(e,t,n){return t&&es(e.prototype,t),n&&es(e,n),e}function ns(e,t){return!t||"object"!==Xc(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function rs(e){return(rs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function is(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&as(e,t)}function as(e,t){return(as=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var os=function(e){function t(){return $c(this,t),ns(this,rs(t).apply(this,arguments))}return is(t,e),ts(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),t}(f.Core.AppRouter),cs=function(e){function t(){return $c(this,t),ns(this,rs(t).apply(this,arguments))}return is(t,e),ts(t,[{key:"domainOptions",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Hc,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Zc,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(d.LayoutRegions.CONTENT,p.createElement(Qc,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(d.LayoutRegions.POPUP,p.createElement(Vc,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Ee.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(d.LayoutRegions.ALERT,p.createElement(d.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return os}}]),t}(f.Core.Application);n.d(t,"Actions",(function(){return i})),n.d(t,"DataPrefixes",(function(){return a})),n.d(t,"FileExtensions",(function(){return o})),n.d(t,"Layouts",(function(){return c})),n.d(t,"AppChannels",(function(){return s})),n.d(t,"DataChannels",(function(){return l})),n.d(t,"DataServices",(function(){return u})),n.d(t,"CuratorLayoutView",(function(){return T})),n.d(t,"LayoutComponent",(function(){return P})),n.d(t,"CuratorAppNavService",(function(){return x})),n.d(t,"ImageUploadDataService",(function(){return M})),n.d(t,"UserDataService",(function(){return G})),n.d(t,"UserDataServiceHelper",(function(){return Q})),n.d(t,"SeriesDataService",(function(){return ye})),n.d(t,"SeriesDataServiceHelper",(function(){return Se})),n.d(t,"SeriesApplication",(function(){return oi})),n.d(t,"PlaylistDataService",(function(){return gi})),n.d(t,"PlaylistDataServiceHelper",(function(){return Oi})),n.d(t,"PlaylistsApplication",(function(){return Qo})),n.d(t,"SubjectDataService",(function(){return xn})),n.d(t,"SubjectDataServiceHelper",(function(){return Un})),n.d(t,"SubjectsApplication",(function(){return cc})),n.d(t,"VideoDataService",(function(){return na})),n.d(t,"VideoDataServiceHelper",(function(){return ia})),n.d(t,"VideosApplication",(function(){return Cc})),n.d(t,"DomainOptionsApplication",(function(){return cs}))}])}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):"function"==typeof define&&define.amd?define(["React","@clickview/shared","@clickview/common","Yup","ReactBootstrap","Formik","ReactRedux","Backbone","SortableHOC","Cropper","Handlebars"],t):"object"==typeof exports?exports["@clickview/curator"]=t(require("React"),require("@clickview/shared"),require("@clickview/common"),require("Yup"),require("ReactBootstrap"),require("Formik"),require("ReactRedux"),require("Backbone"),require("SortableHOC"),require("Cropper"),require("Handlebars")):e["@clickview/curator"]=t(e.React,e["@clickview/shared"],e["@clickview/common"],e.Yup,e.ReactBootstrap,e.Formik,e.ReactRedux,e.Backbone,e.SortableHOC,e.Cropper,e.Handlebars)}(window,(function(e,t,n,r,i,a,o,c,s,u,l){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=i},function(e,t){e.exports=a},function(e,t){e.exports=o},function(e,t,n){"use strict";var r=n(13);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}));var i=n(15);n.d(t,"DomainOptionKind",(function(){return i.a})),n.d(t,"DomainOptionType",(function(){return i.b}))},function(e,t,n){e.exports={tree:"_1abau",text:"f13wK",chevron:"_25eVA",disabled:"_1qyCo",parentOfSelected:"_1fgN6",selected:"cVZit",actions:"_2BGWp",node:"rJVbQ",collapsed:"vc2by"}},function(e,t){e.exports=c},function(e,t,n){e.exports={draggableVideoItem:"_1JMCe",draggedVideoItem:"_3jjle"}},function(e,t){e.exports=s},function(e,t,n){e.exports={curatorLayout:"XayF7",topNavRegion:"_3ewaZ",leftNavRegion:"_2c2o6"}},function(e,t,n){"use strict";var r=n(14);n.o(r,"DomainOptionKind")&&n.d(t,"DomainOptionKind",(function(){return r.DomainOptionKind})),n.o(r,"DomainOptionType")&&n.d(t,"DomainOptionType",(function(){return r.DomainOptionType}))},function(e,t){},function(e,t,n){"use strict";var r,i;!function(e){e.Boolean="System.Boolean",e.String="System.String",e.StaffRequest="ClickView.DomainApi.Models.Options.Enums.StaffRequestOption, ClickView.DomainApi.Models, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null",e.Long="System.Int64"}(r||(r={})),function(e){e[e.Permanent=0]="Permanent",e[e.Temporary=1]="Temporary"}(i||(i={})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}))},function(e,t,n){var r=n(21);e.exports=(r.default||r).template({compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){return'<div class="layout-region"></div>'},useData:!0})},function(e,t){e.exports=u},function(e,t,n){e.exports={navContainer:"_11O8h"}},function(e,t,n){e.exports={navContainer:"_3vLoN"}},function(e){e.exports=JSON.parse("{}")},function(e,t){e.exports=l},function(e,t,n){"use strict";n.r(t);n(20);var r={UPLOAD_IMAGE:"upload:image"},i={Subjects:Object.assign({SUBJECTS:"subjects",NEW_SUBJECT:"new:subject",EDIT_SUBJECT:"edit:subject",EDIT_SUBJECT_PLAYLISTS:"edit:subject:playlists",EDIT_SUBJECT_SERIES:"edit:subject:series",EDIT_SUBJECT_VIDEOS:"edit:subject:videos",SUBJECT_CLASSIFICATIONS:"subject:classifications",DELETE_SUBJECT:"delete:subject",ADD_SUBJECT_MEMBERS:"add:subject:members",REMOVE_SUBJECT_MEMBER:"remove:subject:member",CLASSIFICATIONS:"classifications",PRESENTATION_CLASSIFICATIONS:"presentation:classifications",NEW_CLASSIFICATION:"new:classification",EDIT_CLASSIFICATION:"edit:classification",EDIT_CLASSIFICATION_PLAYLISTS:"edit:classification:playlists",EDIT_CLASSIFICATION_SERIES:"edit:classification:series",EDIT_CLASSIFICATION_VIDEOS:"edit:classification:videos",DELETE_CLASSIFICATION:"delete:classification",REMOVE_CLASSIFICATION_MEMBER:"remove:classification:member",LEVELS:"levels",NEW_LEVEL:"new:level",EDIT_LEVEL:"edit:level",AUDIENCES:"audiences",PRESENTATION_AUDIENCES:"presentation:audiences",NEW_AUDIENCE:"new:audience",EDIT_AUDIENCE:"edit:audience",DELETE_AUDIENCE:"delete:audience",PRESENTATIONS:"presentations",NEW_PRESENTATION:"new:presentation",EDIT_PRESENTATION:"edit:presentation"},r),Playlists:Object.assign({PLAYLISTS:"index",NEW_PLAYLIST:"new:playlist",EDIT_PLAYLIST:"edit:playlist",EDIT_PLAYLIST_VIDEOS:"edit:playlist:videos",EDIT_PLAYLIST_SUBJECTS:"edit:playlist:subjects",EDIT_PLAYLIST_AUDIENCES:"edit:playlist:audiences",DELETE_PLAYLIST:"delete:playlist",REMOVE_VIDEO:"remove:video",REMOVE_FROM_SUBJECT:"remove:from:subject"},r),Series:Object.assign({EDIT_SERIES:"edit:series",EDIT_SERIES_VIDEOS:"edit:series:videos",EDIT_SERIES_SUBJECTS:"edit:series:subjects",EDIT_SERIES_AUDIENCES:"edit:series:audiences"},r),Videos:{EDIT_VIDEO:"edit:video",EDIT_VIDEO_AUDIENCES:"edit:video:audiences",EDIT_VIDEO_SUBJECTS:"edit:video:subjects"},DomainOptions:{DOMAIN_OPTIONS:"domain:options",NEW_DOMAIN_OPTION:"new:domain:option",EDIT_DOMAIN_OPTION:"edit:domain:option",DELETE_DOMAIN_OPTION:"delete:domain:option"},People:{PEOPLE:"people",NEW_PERSON:"new:person",EDIT_PERSON:"edit:person"},Companies:{COMPANIES:"companies",NEW_COMPANY:"new:company",EDIT_COMPANY:"edit:company"}},a={SUBJECT:"subject",SUBJECTS:"subjects",UPDATE_SUBJECT:"update:subject",DELETE_SUBJECT:"delete:subject",UPDATE_OBJECT_SUBJECTS:"update:object:subjects",ADD_TO_SUBJECT:"add:to:subject",REMOVE_FROM_SUBJECT:"remove:from:subject",CLASSIFICATION:"classification",CLASSIFICATIONS:"classifications",UPDATE_CLASSIFICATION:"update:classification",DELETE_CLASSIFICATION:"delete:classification",UPDATE_OBJECT_CLASSIFICATIONS:"update:object:classifications",ADD_TO_CLASSIFICATION:"add:to:classification",REMOVE_FROM_CLASSIFICATION:"remove:from:classification",PRESENTATION:"presentation",PRESENTATIONS:"presentations",UPDATE_PRESENTATION:"update:presentation",LEVEL:"level",LEVELS:"levels",UPDATE_LEVEL:"update:level",ADD_TO_LEVEL:"add:to:level",REMOVE_FROM_LEVEL:"remove:from:level",UPDATE_OBJECT_LEVELS:"update:object:levels",AUDIENCE:"audience",AUDIENCES:"audiences",UPDATE_AUDIENCE:"update:audience",DELETE_AUDIENCE:"delete:audience",UPDATE_OBJECT_AUDIENCES:"update:object:audiences",PLAYLIST:"playlist",PLAYLISTS:"playlists",UPDATE_PLAYLIST:"update:playlist",DELETE_PLAYLIST:"delete:playlist",PLAYLIST_VIDEOS:"playlist:videos",REORDER_PLAYLIST_VIDEOS:"reorder:playlist:videos",REMOVE_PLAYLIST_VIDEO:"remove:playlist:video",VIDEO:"video",SERIES:"series",SERIES_BY_ID:"series:by:id",UPDATE_SERIES:"update:series",CURRENT_USER:"current:user",UPLOAD_IMAGE:"upload:image",LOCALE:"locale",PHRASES:"PHRASES"},o={IMAGES:".".concat(["jpg","tif","png","bmp","gif","jpeg"].join(",."))},c={CURATOR_LAYOUT:"CuratorLayout"},s={COMPANIES:"companies:application",DOMAIN_OPTIONS:"domain:options:application",PEOPLE:"people:application",PLAYLISTS:"playlists:application",SERIES:"series:application",SUBJECTS:"subjects:application",VIDEOS:"videos:application"},u={IMAGE_UPLOAD:"image:upload:data:service",PLAYLIST:"playlist:data:service",SERIES:"series:data:service",SUBJECT:"subject:data:service",USER:"user:data:service",VIDEO:"video:data:service",LANGUAGE:"language:data:service"},l={IMAGE_UPLOAD:"ImageUploadDataService",PLAYLIST:"PlaylistDataService",SUBJECT:"SubjectDataService",USER:"UserDataService",VIDEO:"VideoDataService",SERIES:"SeriesDataService",LANGUAGE:"LanguageDataService"},p=n(0),f=n(2),m=n(1),d=n(16),b=n.n(d),y=n(12),v=n.n(y);function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return!t||"object"!==S(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e,t,n){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,O(t).call(this,e))).childComponents={},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(t,e),n=t,i=[{key:"getCacheKey",value:function(e){var t="".concat(this.name),n=[];return Object.keys(e).forEach((function(t){n.push("".concat(t,":").concat(e[t]))})),n.length&&(n.sort(),t+=":".concat(n.join(":"))),t}}],(r=[{key:"regions",value:function(){return{layout:".layout-region"}}},{key:"getChildComponents",value:function(){return{topNav:{component:this.childComponents[m.LayoutRegions.TOP_NAV],className:v.a.topNavRegion},leftNav:{component:this.childComponents[m.LayoutRegions.LEFT_NAV],className:"py-3 ".concat(v.a.leftNavRegion)},content:{component:this.childComponents[m.LayoutRegions.CONTENT],className:"position-relative container py-3"},popup:{component:this.childComponents[m.LayoutRegions.POPUP]},alert:{component:this.childComponents[m.LayoutRegions.ALERT]}}}},{key:"unsetRegion",value:function(e){delete this.childComponents[e],this.renderLayout()}},{key:"renderTopNav",value:function(){f.FunctionHelper.isFunction(this.options.getTopNavView)&&(this.childComponents[m.LayoutRegions.TOP_NAV]=this.options.getTopNavView(f.Core.AppLinkHelper.getCurrentAppLink()))}},{key:"hideLeftNav",value:function(){this.unsetRegion(m.LayoutRegions.LEFT_NAV)}},{key:"closePopup",value:function(){this.unsetRegion(m.LayoutRegions.POPUP)}},{key:"showChildView",value:function(e,t){this.childComponents[e]=t,this.renderTopNav(),this.renderLayout()}},{key:"renderLayout",value:function(){var e=Object.assign({provider:this.options.provider},this.getChildComponents());g(O(t.prototype),"showChildView",this).call(this,"layout",this.wrapWithStore(p.createElement(L,Object.assign({},e))))}},{key:"title",get:function(){return!1}},{key:"name",get:function(){return"CuratorLayoutView"}},{key:"template",get:function(){return b.a}},{key:"className",get:function(){return"container-fluid ".concat(v.a.curatorLayout)}}])&&E(n.prototype,r),i&&E(n,i),t}(f.ReactLayoutView),C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},I=function(e){var t=e.className,n=e.children;return p.createElement("div",{className:t},n)},A=function(e,t){return"".concat(e).concat(t?" ".concat(t):"")},P=function(e){var t=e.topNav,n=e.leftNav,r=e.content,i=e.popup,a=e.alert;return p.createElement(p.Fragment,null,p.createElement("div",{className:"position-relative"},!!t.component&&p.createElement(I,{className:A("top-nav-region",t.className)},t.component),!!n.component&&p.createElement(I,{className:A("left-nav-region",n.className)},n.component),!!r.component&&p.createElement("div",{className:"content-container"},p.createElement(I,{className:A("content-region",r.className)},r.component))),!!i.component&&p.createElement(I,{className:A("popup-region",i.className)},i.component),!!a.component&&p.createElement(I,{className:A("alert-region",a.className)},a.component))},L=function(e){var t=e.provider,n=C(e,["provider"]);return t?p.createElement(t,null,p.createElement(P,Object.assign({},n))):p.createElement(P,Object.assign({},n))};function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function F(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=function(e){function t(){return w(this,t),F(this,_(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.listenTo(f.CommonChannels.SHELL,f.Core.EventNames.ROUTING_END,this.updateNav)}},{key:"updateNav",value:function(){var e=this,t=f.Core.AppLinkHelper.getCurrentAppLink().application;if(t!==this.currentApplication){this.currentApplication=t;var n=this.options.navItemMappings[t];if(n){var r=document.querySelector(this.options.navSelector);r&&r.children&&k(r.children).forEach((function(t){var r=t.querySelector("a");r&&(r.classList.remove(e.options.currentItemClassName),r.text===n&&r.classList.add(e.options.currentItemClassName))}))}}}},{key:"name",get:function(){return"CuratorAppNavService"}}])&&D(n.prototype,r),i&&D(n,i),t}(f.Core.Service);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Y=function(e){function t(){return V(this,t),J(this,M(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,e),n=t,(r=[{key:"uploadBase64Image",value:function(e,t,n,r){return this.create({resource:"/api/image/upload?type=".concat(t),eventPrefix:a.UPLOAD_IMAGE,data:e,callback:n,errorCallback:r})}},{key:"name",get:function(){return l.IMAGE_UPLOAD}},{key:"channelName",get:function(){return u.IMAGE_UPLOAD}}])&&B(n.prototype,r),i&&B(n,i),t}(f.BaseDataService);function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t){return!t||"object"!==q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q=function(e){function t(){return K(this,t),W(this,G(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(t,e),n=t,(r=[{key:"getCurrentUser",value:function(e,t){return this.get({resource:"/api/currentuser",eventPrefix:a.CURRENT_USER,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"name",get:function(){return l.USER}},{key:"channelName",get:function(){return u.USER}}])&&z(n.prototype,r),i&&z(n,i),t}(f.BaseDataService),X={dataServiceName:l.USER,dataChannelName:u.USER},$={getCurrentUserFetchOptions:function(e,t){return Object.assign(Object.assign({},X),{eventPrefix:a.CURRENT_USER,fetchData:function(e){return e.getCurrentUser()},setData:e,onError:t})}};function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function re(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var oe=function(e){function t(){return te(this,t),re(this,ie(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,e),n=t,(r=[{key:"getLanguageConfig",value:function(e){var t={locale:"en",phrases:{}},n=new f.ConcurrencyHelper(3),r=function(){n.decrement(),n.getValue()>0||e(t)};this.get({resource:"/api/locale",eventPrefix:a.LOCALE,expiryTime:m.CacheDurations.STANDARD,callback:function(e){t.locale=e,r()}}),this.get({resource:"/api/phrases/shared",eventPrefix:"".concat(a.PHRASES,":shared"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.shared&&(e.shared={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}}),this.get({resource:"/api/phrases/subjects",eventPrefix:"".concat(a.PHRASES,":subjects"),expiryTime:m.CacheDurations.STANDARD,callback:function(e){null===e.subjects&&(e.subjects={}),t.phrases=Object.assign(Object.assign({},t.phrases),e),r()}})}},{key:"name",get:function(){return l.LANGUAGE}},{key:"channelName",get:function(){return u.LANGUAGE}}])&&ne(n.prototype,r),i&&ne(n,i),t}(f.BaseDataService),ce=n(6),se=function(e){var t="/api/master/v2/companies";return e?"".concat(t,"?cursor=").concat(e):t},ue=function(e){return"/api/master/v2/objects/".concat(e)},le=function(){return"/api/master/v2/companies"},pe=function(e){return"/api/master/v2/objects/".concat(e)},fe="companies",me="company",de="update:company",be=function(e){return{key:"".concat(fe).concat(e?":".concat(e):""),url:se(e)}},ye=function(e){return{key:"".concat(me,":").concat(e),url:ue(e)}},ve=function(e,t,n){return{key:me,url:le(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[fe]}},Se=function(e,t,n){return{key:"".concat(de,":").concat(e),url:pe(e),data:t,type:f.HttpVerbs.PUT,always:n}},Ee=n(3),he=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),ge=n(5);function Oe(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this company",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function je(e){return p.createElement(m.FormWrapper,{initialValues:e.company,validationSchema:he,onSubmit:e.saveCompany},p.createElement(Oe,{isNew:!(e.company&&e.company.id)}))}function Te(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(ye(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement(je,{company:n.data,saveCompany:function(n,r){return f.Flight.fetch(t,Se(e.id,n,r))}}))}function Ce(){var e=Object(ce.useDispatch)();return p.createElement(je,{saveCompany:function(t,n){f.Flight.fetch(e,ve(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.Companies.EDIT_COMPANY,args:[e.id]})}),n))}})}function Ie(e){var t=e.backToName,n=e.appLink;return p.createElement(m.AppLink,{appLink:n,className:"d-inline-flex align-items-center"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ArrowLeft,size:m.SvgContainerSize.Small}),p.createElement("span",{className:"ml-1"},"Back to ".concat(t)))}var Ae=n(4);function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Le=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ne(e){var t=e.selected,n=e.onToggle,r=Le(e,["selected","onToggle"]),i=Pe(p.useState(t),2),a=i[0],o=i[1];p.useEffect((function(){return o(t)}),[t]);return p.createElement(Ae.Form.Check,Object.assign({type:"checkbox",id:"checkbox-".concat(f.RandomHelper.getRandomInt()),checked:a,onChange:function(){o(!a),n(!a)}},r))}var ke=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function we(e){var t=e.onFileSelect,n=e.acceptMultiple,r=e.mimeType,i=e.label,a=e.error,o=e.touched,c=ke(e,["onFileSelect","acceptMultiple","mimeType","label","error","touched"]),s="custom-file-input cursor-pointer";a&&o&&(s+=" is-invalid");var u=Object.assign({type:"file",className:s,onChange:function(e){var n=e.currentTarget.files;n&&n.length&&f.FunctionHelper.isFunction(t)&&t(n)},autoComplete:"off",value:"",multiple:!!n},r?{accept:r}:{});return p.createElement("div",{className:"form-group"},p.createElement("div",{className:"custom-file"},p.createElement(ge.Field,Object.assign({},u,c),e.children),p.createElement(Ae.Form.Label,{className:"custom-file-label",htmlFor:c.id},i)))}var De,Fe={onFileSelect:function(e,t,n){if(t&&t.length){var r=new FileReader;r.addEventListener("load",(function(){return Fe.onReaderLoad(r,e,n)})),r.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n){var r=new Image;r.src=e.result;var i=m.ImageMinDimensions[t].width,a=m.ImageMinDimensions[t].height;r.addEventListener("load",(function(){Fe.isImageValid(t,r)&&f.FunctionHelper.isFunction(n)?n(r):alert("Image too small: minimum dimensions are ".concat(i," x ").concat(a))}))},isImageValid:function(e,t){var n=m.ImageMinDimensions[e].width,r=m.ImageMinDimensions[e].height;return!(n&&t.width<n)&&!(r&&t.height<r)}},_e={isItemActive:function(e,t){return t||(t=f.Core.AppLinkHelper.getCurrentAppLink()),t.application===e.appLink.application&&(Array.isArray(e.activeActions)?e.activeActions.includes(t.action):t.action===e.appLink.action)}};!function(e){e.Developer="Curator Devs",e.Curator="Curators",e.Support="Support",e.SalesSupport="Sales Support"}(De||(De={}));var Re=function(){return[{value:"protected",access:"r"}]},xe=function(e){return He.getGroupNames(e).includes(De.Developer)},Ue=function(e){return Object.values(e).every((function(e){return!!e}))},Ve=function(e,t){return!!e&&!!t&&e.toString()===t.toString()},Be=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function Je(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var Me={find:function(e,t){if(e&&e.children&&e.children.length)for(var n=function e(n){if(Ve(n.id,t))return n;var r=n.children;if(r&&r.length)for(var i=0;i<r.length;i++){var a=e(r[i]);if(a)return a}},r=0;r<e.children.length;r++){var i=n(e.children[r]);if(i)return i}},getPath:function(e,t){for(var n=[t],r=function(e){return e.hasOwnProperty("parentIds")&&Array.isArray(e.parentIds)&&e.parentIds.length?e.parentIds[0]:e.hasOwnProperty("parentId")?e.parentId:null},i=r(t);i;){var a=Me.find(e,i);a&&(n=[a].concat(Je(n))),i=a?r(a):null}return n}},He={getGroupNames:function(e){return e&&e.groups?e.groups.map((function(e){return e.name})):[]}};function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var qe=p.createContext(void 0),Ke=function(e){var t=e.children,n=Ye(p.useState(),2),r=n[0],i=n[1],a=Ye(p.useState(!1),2),o=a[0],c=a[1],s=Ye(p.useState(),2),u=s[0],l=s[1],f={getDataUrl:function(){var e=r;return i(null),e},setDataUrl:i,imageUploaded:o,getImage:function(){var e=u;return l(null),c(!1),e},setImage:function(e){l(e),c(!0)}};return p.createElement(qe.Provider,{value:f},t)};function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var We,Ge=p.createContext(void 0);function Ze(e){var t=e.children,n=ze(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(m.UserDataServiceHelper.getCurrentUserFetchOptions(i),[]),p.createElement(Ge.Provider,{value:r},t)}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},et=(Xe(We={},m.ImageType.Thumbnails,"Thumbnail"),Xe(We,m.ImageType.Banners,"Banner"),Xe(We,m.ImageType.Avatars,"Avatar"),Xe(We,m.ImageType.Logos,"Logo"),Xe(We,m.ImageType.Covers,"Cover"),Xe(We,m.ImageType.Posters,"Poster"),We);function tt(e){var t=e.imageType,n=e.currentImage,r=e.setNewImage,i=e.application,a=e.uploadAction,c=$e(e,["imageType","currentImage","setNewImage","application","uploadAction"]),s=p.useContext(qe),u=s.setDataUrl,l=s.getImage,d=s.imageUploaded,b=Qe(p.useState(!1),2),y=b[0],v=b[1],S=Qe(p.useState(n),2),E=S[0],h=S[1],g=Qe(p.useState(!1),2),O=g[0],j=g[1],T=function(e){v(!0),u(e.src),f.Core.AppLinkHelper.trigger({application:i,action:a,args:[t]})};return p.useEffect((function(){if(y){var e=l();e&&(v(!1),h(e),r({fileId:e.id,fileIdType:m.FileIdType.ImageAPIv2}))}}),[d]),p.createElement("div",{className:"form-group"},p.createElement("div",{className:"form-control h-auto py-2"},p.createElement("label",null,et[t]),p.createElement(we,Object.assign({label:"Choose a ".concat(et[t].toLowerCase()),name:"image",mimeType:o.IMAGES,onFileSelect:function(e){return Fe.onFileSelect(t,e,T)}},c)),!!E&&!!E.url&&p.createElement(p.Fragment,null,!O&&p.createElement("div",{className:"pb-2 ".concat(t===m.ImageType.Banners?"w-100":"w-50")},p.createElement("img",{src:m.ImageHelper.createUrl(E.url),className:"img img-fluid"})),p.createElement("div",{className:"d-flex justify-content-center"},p.createElement(m.SvgContainer,{svgName:O?m.cvSvgLibrary.ChevronDown:m.cvSvgLibrary.ChevronUp,size:m.SvgContainerSize.Large,className:"svg-container cursor-pointer",onClick:function(){return j(!O)},title:O?"Show image":"Hide image",tooltipPlacement:"top"})))))}var nt,rt=n(17),it=n.n(rt);function at(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}!function(e){e[e.NoRestrictions=0]="NoRestrictions",e[e.RestrictToCanvas=1]="RestrictToCanvas"}(nt||(nt={}));var ot=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function ct(e){var t=e.dataUrl,n=e.minHeight,r=e.minWidth,i=e.onCrop,a=e.onCancel,o=p.useRef(),c=p.useRef(),s=at(p.useState(!1),2),u=s[0],l=s[1],d=at(p.useState(!1),2),b=d[0],y=d[1];return p.useEffect((function(){var e=new Image;e.src=t;var i=o.current.offsetWidth/e.width;return c.current=new it.a(o.current,{viewMode:nt.RestrictToCanvas,autoCropArea:1,aspectRatio:r/n,minCropBoxWidth:r*i,minCropBoxHeight:n*i,ready:function(){return l(!0)}}),function(){return c.current.destroy()}}),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement("img",{ref:o,src:t,className:"img img-fluid mw-100"})),p.createElement("div",{className:"d-flex justify-content-end border-top pt-3"},p.createElement(Ae.Button,{variant:"link",onClick:a},"Cancel"),p.createElement(m.SpinnerButton,{onClick:function(){if(u){y(!0);var e=c.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(ot);if(t)return t[1]}(t));f.FunctionHelper.isFunction(i)&&i(e)}},disabled:!u,showSpinner:b},"Crop")))}function st(e){if(!e.collection)return p.createElement(p.Fragment,null);var t=e.collection,n=t.data,r=t.pagination;return p.createElement(p.Fragment,null,!!n&&p.createElement(pt,{objects:n,getObjectAppLink:e.getObjectAppLink,newObjectAppLink:e.newObjectAppLink,objectName:e.objectName}),!!r&&!!r.cursors&&p.createElement(m.Pagination,{cursors:r.cursors,appLink:e.collectionAppLink}))}function ut(e){var t=e.object,n=e.actions;return p.createElement("div",{className:"d-flex justify-content-between py-2"},!!t&&p.createElement("h5",null,t.name),!!n&&p.createElement("span",null,p.createElement(m.Actions,{actions:n})))}function lt(e){return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:e.appLink},e.object.name)),p.createElement("td",null))}function pt(e){return p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Name"),p.createElement("th",null,p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.AppLink,{appLink:e.newObjectAppLink},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New ".concat(e.objectName))))))),p.createElement("tbody",null,e.objects.map((function(t){return p.createElement(lt,{key:t.id,object:t,appLink:e.getObjectAppLink(t)})}))))}function ft(e){var t=e.objects,n=e.getAppLink,r=e.emptyMessage;return t?t.length?p.createElement("ul",{className:"list-unstyled"},t.map((function(e,t){return p.createElement("li",{key:t,className:"border rounded mb-3"},p.createElement(m.AppLink,{appLink:n(e),className:"d-block p-3"},e.name))}))):p.createElement("div",{className:"py-3"},p.createElement("p",null,r)):p.createElement(p.Fragment,null)}function mt(e){var t=e.tabs,n=e.isItemActive;return p.createElement(Ae.Nav,{fill:!0,variant:"tabs"},t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:n(e)},e.label))})))}ft.defaultProps={emptyMessage:"There is nothing here."},mt.defaultProps={isItemActive:_e.isItemActive};var dt=n(8),bt=n.n(dt);function yt(e){var t=e.name,n=e.appLink,r=e.onSelect,i=e.isDisabled,a=e.className,o=e.actions,c=bt.a.text;return a&&(c+=" ".concat(a)),i?p.createElement("a",{className:"".concat(c," text-muted ").concat(bt.a.disabled)},t):p.createElement(p.Fragment,null,n?p.createElement(m.AppLink,{appLink:n,className:c},t):p.createElement("a",{onClick:r,className:c},t),!!o&&p.createElement(m.Actions,{className:bt.a.actions,actions:o}))}function vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function St(e){var t=e.tree,n=e.selectedIds,r=e.getAppLink,i=e.onSelect,a=e.isDisabled,o=e.actions,c=Array.isArray(n)&&n.some((function(e){return Ve(t.id,e)})),s=p.useMemo((function(){return Array.isArray(n)&&n.some((function(e){return Me.find(t,e)}))}),[t,n]),u=vt(p.useState(s),2),l=u[0],d=u[1],b=!!t.children&&!!t.children.length,y={name:t.name,appLink:f.FunctionHelper.isFunction(r)?r(t):null,onSelect:f.FunctionHelper.isFunction(i)?function(){return i(t)}:null,isDisabled:!!f.FunctionHelper.isFunction(a)&&a(t),className:c&&bt.a.selected||s&&bt.a.parentOfSelected,actions:!!o&&o.map((function(e){return Object.assign(Object.assign({},e),{appLink:e.getAppLink(t)})}))};return p.createElement("li",{className:"position-relative".concat(l?"":" ".concat(bt.a.collapsed))},p.createElement("div",{className:"position-relative"},p.createElement("span",{className:bt.a.node},b&&p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.ChevronDown,size:m.SvgContainerSize.Small,className:"svg-container ".concat(bt.a.chevron),onClick:function(){return d(!l)}}),p.createElement(yt,Object.assign({},y))),l&&p.createElement(ht,Object.assign({},e))))}var Et=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function ht(e){var t=e.tree,n=Et(e,["tree"]);return t&&t.children?p.createElement("ul",{className:"m-0 p-0 ".concat(bt.a.tree)},t.children.map((function(e){return p.createElement(St,Object.assign({key:e.id,tree:e},n))}))):p.createElement(p.Fragment,null)}var gt={getChord:function(e,t){return Me.getPath(e,t).map((function(e){return e.name})).join(" -> ")},getState:function(e,t){var n={};return Array.isArray(e)&&e.forEach((function(e){var r,i,a,o=Me.find(t,e);o&&(n=Object.assign((r={},i=e,a=gt.getChord(t,o),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r),n))})),n}};function Ot(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var jt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Tt(e){var t=e.onSelect,n=e.label,r=e.hideCollapseBtn,i=e.collapse,a=e.noSelectionMessage,o=e.isNodeDisabled,c=e.getSelectedItemAppLink,s=jt(e,["onSelect","label","hideCollapseBtn","collapse","noSelectionMessage","isNodeDisabled","getSelectedItemAppLink"]),u=s.tree,l=s.selectedIds,d=Ot(p.useState(gt.getState(l,u)),2),b=d[0],y=d[1];p.useEffect((function(){return y(gt.getState(l,u))}),[l,u]);var v=Ot(p.useState(!!i),2),S=v[0],E=v[1];p.useEffect((function(){return E(!!i)}),[i]);var h=!r||!!n;return p.createElement(p.Fragment,null,h&&p.createElement("div",{className:"pb-2"},!!n&&p.createElement("label",{className:"m-0"},n),!r&&p.createElement("a",{className:"float-right cursor-pointer",onClick:function(){return E(!S)}},S?"Expand":"Collapse")),!S&&p.createElement("div",{className:"py-2 border-top"},p.createElement(ht,Object.assign({onSelect:function(e){return f.FunctionHelper.isFunction(t)&&t(e)},isDisabled:o},s))),(!f.ObjectHelper.isEmpty(b)||!!a)&&p.createElement("div",{className:"py-2 border-top"},p.createElement("label",null,"Selected:"),p.createElement("ul",{className:"m-0"},f.ObjectHelper.isEmpty(b)?p.createElement("li",null,a):Object.keys(b).map((function(e,t){return p.createElement("li",{key:t},f.FunctionHelper.isFunction(c)?p.createElement(m.AppLink,{appLink:c(e)},b[e]):b[e])})))))}var Ct=n(11),It=function(e){var t="bg-white";return e&&(t+=" ".concat(e)),t};function At(e){var t=e.video,n=e.getVideoAppLink,r=e.getVideoActions,i=e.className,a=void 0===i?"":i,o=e.itemNumber,c=f.FunctionHelper.isFunction(n)&&n(t);return p.createElement("tr",{className:It(a)},!!o&&p.createElement("td",null,p.createElement("span",null,o)),p.createElement("td",null,c?p.createElement(m.AppLink,{appLink:c},t.name):t.name),f.FunctionHelper.isFunction(r)&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r(t)}))))}var Pt=Object(Ct.SortableElement)((function(e){return p.createElement(At,Object.assign({sortable:!0},e))})),Lt=n(10),Nt=n.n(Lt),kt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},wt=function(e){var t=e.sortable,n=e.getVideoActions;return p.createElement("thead",null,p.createElement("tr",null,!!t&&p.createElement("th",null,"#"),p.createElement("th",null,"Name"),!!n&&p.createElement("th",null)))},Dt=p.forwardRef((function(e,t){var n=e.videos,r=e.sortable,i=kt(e,["videos","sortable"]);return p.createElement("tbody",{ref:t},!m.CollectionHelper.isEmpty(n)&&n.data.map((function(e,t){return r?p.createElement(Pt,Object.assign({key:e.id,index:t,itemNumber:t+1,video:e,className:Nt.a.draggableVideoItem},i)):p.createElement(At,Object.assign({video:e},i))})))}));var Ft=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},_t=Object(Ct.SortableContainer)((function(e){var t=e.forwardedRef,n=Ft(e,["forwardedRef"]);return p.createElement(Dt,Object.assign({sortable:!0,ref:t},n))})),Rt=function(e){return function(t){var n=t.node,r=e.current;if(r){r.classList.add(Nt.a.sortingContainer);var i=r.querySelector(".".concat(Nt.a.draggedVideoItem));n.childNodes.forEach((function(e,t){return i.childNodes[t].style.width="".concat(e.offsetWidth,"px")}))}}},xt=function(e,t){return function(n){var r=e.current;r&&r.classList.remove(Nt.a.sortingContainer),t(n.oldIndex,n.newIndex)}};function Ut(e){var t=e.onSortEnd,n=e.emptyMessage,r=Ft(e,["onSortEnd","emptyMessage"]),i=p.useRef();return m.CollectionHelper.isEmpty(e.videos)?p.createElement("div",null,n):p.createElement(Ae.Table,{responsive:!0},p.createElement(wt,Object.assign({sortable:!0},e)),p.createElement(_t,Object.assign({forwardedRef:i,onSortStart:Rt(i),onSortEnd:xt(i,t),lockAxis:"y",lockToContainerEdges:!0,distance:1,helperClass:Nt.a.draggedVideoItem,helperContainer:function(){return i.current}},r)))}Ut.defaultProps={emptyMessage:"There are no videos in this list."};var Vt=s.COMPANIES,Bt=function(e){return{application:Vt,action:i.Companies.EDIT_COMPANY,args:[e.id]}};function Jt(e){var t=f.Flight.useBasicFetch(be(e.cursor));return p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:Vt,action:i.Companies.COMPANIES},newObjectAppLink:{application:Vt,action:i.Companies.NEW_COMPANY},getObjectAppLink:Bt,objectName:"Company"})}function Mt(e){return(Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qt(e,t,n){return t&&Yt(e.prototype,t),n&&Yt(e,n),e}function Kt(e,t){return!t||"object"!==Mt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function zt(e){return(zt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Gt(e,t)}function Gt(e,t){return(Gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Zt=function(e){function t(){return Ht(this,t),Kt(this,zt(t).apply(this,arguments))}return Wt(t,e),qt(t,[{key:"channelName",get:function(){return s.COMPANIES}},{key:"appRoutes",get:function(){return{"manage/companies(/)":"companies","manage/companies/new(/)":"newCompany","manage/companies/:id(/)":"editCompany"}}}]),t}(f.Core.AppRouter),Qt=function(e){function t(){return Ht(this,t),Kt(this,zt(t).apply(this,arguments))}return Wt(t,e),qt(t,[{key:"companies",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Jt,{cursor:t}))}},{key:"newCompany",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ce,null))}},{key:"editCompany",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Te,{id:e}))}},{key:"name",get:function(){return"Companies Application"}},{key:"channelName",get:function(){return s.COMPANIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Zt}}]),t}(f.Core.Application),Xt=n(9),$t={namespace:"domain_options"},en=function(){return"/api/domain/v3/settings/types"},tn=function(e){return"/api/domain/v3/settings/types/".concat(e)},nn=function(){return"/api/domain/v3/settings/types"},rn=function(e){return"/api/domain/v3/settings/types/".concat(e)},an=function(e){return"/api/domain/v3/settings/types/".concat(e)},on="domain:options",cn="domain:option",sn="update:domain:option",un="delete:domain:option",ln=function(){return{key:on,url:en(),normalizeOptions:$t}},pn=function(e){return{key:"".concat(cn,":").concat(e),url:tn(e),normalizeOptions:$t}},fn=function(e,t,n){return{key:cn,url:nn(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[on],normalizeOptions:$t}},mn=function(e,t){return{key:"".concat(sn,":").concat(e.id),url:rn(e.id),data:e,type:f.HttpVerbs.PUT,always:t,formatData:function(){return e},normalizeOptions:$t}},dn=function(e,t){return{key:"".concat(un,":").concat(e),url:an(e),type:f.HttpVerbs.DELETE,invalidationKeys:[on],normalizeOptions:$t,success:t}};function bn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function yn(e){var t=bn(p.useState(!1),2),n=t[0],r=t[1],a=f.Flight.useBasicFetch(pn(e.optionId)),o=Object(ce.useDispatch)(),c=function(){e.closePopup(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DOMAIN_OPTIONS})};return p.createElement(m.Popup,{title:"Delete Domain Option",closePopup:e.closePopup,showLoadingSpinner:!a.data},a.data&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.data.name),"?")),p.createElement(m.PopupButtons,{buttons:[{variant:"link",onClick:e.closePopup,buttonText:"Cancel"},{variant:"danger",onClick:function(){r(!0),f.Flight.fetch(o,dn(e.optionId,c))},buttonText:"Yes, delete this domain option",isSpinnerButton:!0,showSpinner:n}]})))}var vn=function(e){return{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]}},Sn={application:s.DOMAIN_OPTIONS,action:i.DomainOptions.NEW_DOMAIN_OPTION};function En(){var e=f.Flight.useBasicFetch(ln());if(!e.data)return p.createElement(p.Fragment,null);var t=e.data.map((function(e){return e.displayName&&(e.name=e.displayName),e}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a domain option type to edit:"),p.createElement(m.AppLink,{appLink:Sn,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Domain Option"))),p.createElement(ft,{objects:t,getAppLink:vn}))}var hn=n(7),gn=Ee.object().shape({id:Ee.string(),name:Ee.string().trim().max(64,"Name is too long").required("Name is required").default(""),displayName:Ee.string().trim().max(255,"Display name is too long").default(""),type:Ee.mixed().required("Type is required").default(hn.DomainOptionType.Boolean),entityType:Ee.mixed().required("Entity type is required").default(m.MasterType.Customer),kind:Ee.mixed().required("Kind is required").default(hn.DomainOptionKind.Temporary),defaultValue:Ee.mixed().required("Default value is required").default("false")}).noUnknown();function On(e){var t=e.type,n=e.defaultValue;if(!t)return p.createElement(p.Fragment,null);var r={label:"Default Value",name:"defaultValue",id:"defaultValue",value:n};return t===hn.DomainOptionType.Boolean?p.createElement(m.FormField,Object.assign({as:"select"},r),p.createElement("option",{value:"true"},"True"),p.createElement("option",{value:"false"},"False")):t===hn.DomainOptionType.Long||t===hn.DomainOptionType.StaffRequest?p.createElement(m.FormField,Object.assign({as:"input",type:"number"},r)):t===hn.DomainOptionType.String?p.createElement(m.FormField,Object.assign({as:"input"},r)):void 0}var jn=[m.MasterType.Customer,m.MasterType.User];function Tn(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name (snake_case)",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this domain option",autoFocus:!0}),p.createElement(m.FormField,{label:"Display Name",type:"text",name:"displayName",id:"displayName",value:n.values.displayName,placeholder:"Enter a display name for this domain option"}),p.createElement(m.FormField,{as:"select",label:"Kind",name:"kind",id:"kind",value:n.values.kind},f.ObjectHelper.getEnumKeys(hn.DomainOptionKind).map((function(e){return p.createElement("option",{key:e,value:hn.DomainOptionKind[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Entity",name:"entityType",id:"entityType",value:n.values.entityType},f.ObjectHelper.getEnumKeys(m.MasterType).filter((function(e){return jn.includes(m.MasterType[e])})).map((function(e){return p.createElement("option",{key:e,value:m.MasterType[e]},e)}))),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:n.values.type},f.ObjectHelper.getEnumKeys(hn.DomainOptionType).map((function(e){return p.createElement("option",{key:e,value:hn.DomainOptionType[e]},e)}))),p.createElement(On,{type:n.values.type,defaultValue:n.values.defaultValue}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.DOMAIN_OPTIONS,action:i.DomainOptions.DELETE_DOMAIN_OPTION,args:[e.id]}},"Delete")))}function Cn(e){return p.createElement(m.FormWrapper,{initialValues:e.domainOption,validationSchema:gn,onSubmit:e.saveDomainOption},p.createElement(Tn,{id:e.domainOption&&e.domainOption.id}))}function In(){var e=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Domain Option"),p.createElement(Cn,{saveDomainOption:function(t,n){f.Flight.fetch(e,fn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.DOMAIN_OPTIONS,action:i.DomainOptions.EDIT_DOMAIN_OPTION,args:[e.id]})}),n))}}))}function An(e){var t=e.optionId,n=f.Flight.useBasicFetch(pn(t)),r=Object(ce.useDispatch)();return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Domain Option"),n.data&&p.createElement(Cn,{domainOption:n.data,saveDomainOption:function(e,t){return f.Flight.fetch(r,mn(e,t))}}))}function Pn(e){return(Pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ln(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kn(e,t,n){return t&&Nn(e.prototype,t),n&&Nn(e,n),e}function wn(e,t){return!t||"object"!==Pn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Dn(e){return(Dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_n(e,t)}function _n(e,t){return(_n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Rn=function(e){function t(){return Ln(this,t),wn(this,Dn(t).apply(this,arguments))}return Fn(t,e),kn(t,[{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"appRoutes",get:function(){return{"developer/options(/)":"domainOptions","developer/options/new(/)":"newDomainOption","developer/options/:id(/)":"editDomainOption"}}},{key:"appLinks",get:function(){return["deleteDomainOption"]}}]),t}(f.Core.AppRouter),xn=function(e){function t(){return Ln(this,t),wn(this,Dn(t).apply(this,arguments))}return Fn(t,e),kn(t,[{key:"domainOptions",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(En,null))}},{key:"newDomainOption",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(In,null))}},{key:"editDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(An,{optionId:e}))}},{key:"deleteDomainOption",value:function(e){this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(yn,Object.assign({optionId:e},this.getPopupProps())))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Xt.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Domain Options Application"}},{key:"channelName",get:function(){return s.DOMAIN_OPTIONS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return Rn}}]),t}(f.Core.Application),Un=function(e){return e?"".concat("/api/master/v2/people","?cursor=").concat(e):"/api/master/v2/people"},Vn=function(e){return"/api/master/v2/objects/".concat(e)},Bn=function(){return"/api/master/v2/people"},Jn=function(e){return"/api/master/v2/objects/".concat(e)},Mn="people",Hn="person",Yn="update:person",qn=function(e){return{key:"".concat(Mn).concat(e?":".concat(e):""),url:Un(e)}},Kn=function(e){return{key:"".concat(Hn,":").concat(e),url:Vn(e)}},zn=function(e,t,n){return{key:Hn,url:Bn(),data:e,type:f.HttpVerbs.POST,success:t,error:n,invalidationKeys:[Mn]}},Wn=function(e,t,n){return{key:"".concat(Yn,":").concat(e),url:Jn(e),data:t,type:f.HttpVerbs.PUT,always:n}},Gn=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown();function Zn(e){var t=Object(ge.useFormikContext)();return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this person",autoFocus:!0}),p.createElement(m.FormButtons,{isNew:e.isNew}))}function Qn(e){return p.createElement(m.FormWrapper,{initialValues:e.person,validationSchema:Gn,onSubmit:e.savePerson},p.createElement(Zn,{isNew:!(e.person&&e.person.id)}))}function Xn(e){var t=Object(ce.useDispatch)(),n=f.Flight.useBasicFetch(Kn(e.id));return p.createElement(p.Fragment,null,!!n.data&&p.createElement(Qn,{person:n.data,savePerson:function(n,r){return f.Flight.fetch(t,Wn(e.id,n,r))}}))}function $n(){var e=Object(ce.useDispatch)();return p.createElement(Qn,{savePerson:function(t,n){f.Flight.fetch(e,zn(t,(function(e){n(),f.Core.AppLinkHelper.trigger({application:s.PEOPLE,action:i.People.EDIT_PERSON,args:[e.id]})}),n))}})}var er=s.PEOPLE,tr=function(e){return{application:er,action:i.People.EDIT_PERSON,args:[e.id]}};function nr(e){var t=f.Flight.useBasicFetch(qn(e.cursor));return p.createElement(st,{collection:t&&t.data,collectionAppLink:{application:er,action:i.People.PEOPLE},newObjectAppLink:{application:er,action:i.People.NEW_PERSON},getObjectAppLink:tr,objectName:"Person"})}function rr(e){return(rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ir(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ar(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function or(e,t,n){return t&&ar(e.prototype,t),n&&ar(e,n),e}function cr(e,t){return!t||"object"!==rr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function sr(e){return(sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ur(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&lr(e,t)}function lr(e,t){return(lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pr=function(e){function t(){return ir(this,t),cr(this,sr(t).apply(this,arguments))}return ur(t,e),or(t,[{key:"channelName",get:function(){return s.PEOPLE}},{key:"appRoutes",get:function(){return{"manage/people(/)":"people","manage/people/new(/)":"newPerson","manage/people/:id(/)":"editPerson"}}}]),t}(f.Core.AppRouter),fr=function(e){function t(){return ir(this,t),cr(this,sr(t).apply(this,arguments))}return ur(t,e),or(t,[{key:"people",value:function(e){var t=e.cursor;this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(nr,{cursor:t}))}},{key:"newPerson",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement($n,null))}},{key:"editPerson",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Xn,{id:e}))}},{key:"name",get:function(){return"People Application"}},{key:"channelName",get:function(){return s.PEOPLE}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT}}}],[{key:"router",get:function(){return pr}}]),t}(f.Core.Application);function mr(e){return(mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function br(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yr(e,t){return!t||"object"!==mr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vr(e){return(vr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Sr(e,t){return(Sr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Er,hr=function(e){return"/api/master/v2/objects/".concat(e,"?query=cover,banner")},gr=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},Or=function(e){return"/api/master/v2/objects/".concat(e,"/playlists")},jr=function(e){return"/api/master/v2/objects/".concat(e)},Tr=function(e){return"/api/master/v1/playlists/".concat(e)},Cr=function(e,t,n){var r="/api/master/v2/objects/".concat(e,"/").concat(t);return n&&(r+="?query=".concat(n)),r},Ir=function(e){return"/api/master/v1/objects/".concat(e,"/videos/reorder")},Ar=function(e,t){return"/api/master/v1/playlists/".concat(e,"/dissociate/").concat(t)};!function(e){e.Videos="videos"}(Er||(Er={}));var Pr=function(e){function t(){return dr(this,t),yr(this,vr(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sr(e,t)}(t,e),n=t,(r=[{key:"getPlaylist",value:function(e,t,n){return this.get({resource:hr(e),eventPrefix:"".concat(a.PLAYLIST,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getPlaylistsById",value:function(e,t,n){return this.get({resource:gr(e),eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPlaylist",value:function(e,t,n,r){return this.create({resource:Or(t),data:Object.assign(Object.assign({},e),{permissions:Re()}),callback:n,errorCallback:r,eventPrefix:a.PLAYLIST,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created playlist."),errorHandler:this.alertService.error("Failed to create playlist.")})}},{key:"updatePlaylist",value:function(e,t,n,r){return this.update({resource:jr(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PLAYLIST,":").concat(e),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e),a.PLAYLISTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated playlist"),errorHandler:this.alertService.error("Failed to update playlist")})}},{key:"deletePlaylist",value:function(e,t,n){return this.delete({resource:Tr(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_PLAYLIST,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e)],successHandler:this.alertService.success("Successfully deleted playlist"),errorHandler:this.alertService.error("Failed to delete playlist.")})}},{key:"getPlaylistVideos",value:function(e,t,n){return this.get({resource:Cr(e,Er.Videos,"{orderBy:orderindex,limit:100}"),callback:t,errorCallback:n,eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Er.Videos),expiryTime:m.CacheDurations.STANDARD})}},{key:"reorderVideos",value:function(e,t,n){return this.update({resource:Ir(e),data:Object.assign({ownerId:e},t),eventPrefix:a.REORDER_PLAYLIST_VIDEOS,expiryTime:m.CacheDurations.STANDARD,invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorHandler:this.alertService.error("Failed to update playlist order.")})}},{key:"removeVideoFromPlaylist",value:function(e,t,n,r){return this.delete({resource:Ar(e,t),eventPrefix:"".concat(a.REMOVE_PLAYLIST_VIDEO,":").concat(e,":").concat(t),invalidationKeys:["".concat(a.PLAYLIST,":").concat(e,":videos")],callback:n,errorCallback:r})}},{key:"name",get:function(){return l.PLAYLIST}},{key:"channelName",get:function(){return u.PLAYLIST}}])&&br(n.prototype,r),i&&br(n,i),t}(f.BaseDataService),Lr={dataServiceName:l.PLAYLIST,dataChannelName:u.PLAYLIST},Nr={getPlaylistFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Lr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e),fetchData:function(t){return t.getPlaylist(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_PLAYLIST})},getPlaylistsByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Lr),{eventPrefix:"".concat(a.PLAYLISTS,":").concat(e.join(",")),fetchData:function(t){return t.getPlaylistsById(e)},setData:t,onError:n})},getPlaylistVideosFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Lr),{eventPrefix:"".concat(a.PLAYLIST,":").concat(e,":").concat(Er.Videos),fetchData:function(t){return t.getPlaylistVideos(e)},setData:t,onError:n})}};function kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function wr(e){var t=e.imageType,n=e.closePopup,r=p.useContext(qe),i=r.getDataUrl,a=r.setImage,o=kr(p.useState(i()),1)[0],c=kr(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.IMAGE_UPLOAD),b=function(e){a(e),n()},y={dataUrl:o,imageType:t,minWidth:m.ImageMinDimensions[t].width,minHeight:m.ImageMinDimensions[t].height,onCrop:function(e){return d.uploadBase64Image(e,t,b,n)},onCancel:n};return p.createElement(m.Popup,{title:"Crop Image",closePopup:n,onEntered:function(){return u(!0)}},s&&p.createElement(ct,Object.assign({},y)))}var Dr=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))};function Fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function _r(e){var t=e.playlistId,n=e.closePopup,r=Fr(p.useState(),2),a=r[0],o=r[1],c=Fr(p.useState(!1),2),u=c[0],d=c[1],b=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(Nr.getPlaylistFetchOptions(t,o),[t]);var y=p.useCallback((function(){n(),f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.PLAYLISTS})}),[]),v=p.useCallback((function(){d(!0),b.deletePlaylist(t,y,n)}),[t]),S=[{variant:"link",onClick:n,buttonText:"Cancel"},{variant:"danger",onClick:v,buttonText:"Yes, delete playlist",isSpinnerButton:!0,showSpinner:u}],E=!!a;return p.createElement(m.Popup,{title:"Delete Playlist",closePopup:n,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Please ensure it is not being used in any widgets.")),p.createElement(m.PopupButtons,{buttons:S})))}var Rr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),xr=function(e,t,n,r){if(f.FunctionHelper.isFunction(r)){if(t!==n){var i=f.ArrayHelper.moveItem(e,t,n),a=n<e.length-1?i[n+1].id:null;r(i,{sourceMemberId:i[n].id,destinationMemberId:a})}}else f.Core.ErrorHelper.throw(new f.DevError("A callback function must be passed to onSort"))},Ur=function(e,t){var n=s.PLAYLISTS,r=i.Playlists,a=[{label:"Edit Playlist Details",appLink:{application:n,action:r.EDIT_PLAYLIST,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_PLAYLIST_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_PLAYLIST_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_PLAYLIST_AUDIENCES,args:[t]}}]),a};function Vr(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this playlist",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this playlist here"}),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.PLAYLISTS,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function Br(e){var t,n=e.playlist&&e.playlist.id;return p.createElement(m.FormWrapper,{initialValues:e.playlist,validationSchema:Rr,onSubmit:e.savePlaylist},p.createElement(Vr,{id:n,actions:!!n&&(t=n,[{label:"Delete playlist",appLink:{application:s.PLAYLISTS,action:i.Playlists.DELETE_PLAYLIST,args:[t]},className:"text-danger"}])}))}var Jr,Mr,Hr,Yr,qr=function(e){return function(t){return t.appLink.action===e}};function Kr(e){var t=e.playlistId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(mt,{tabs:Ur(r,t),isItemActive:qr(n)}))}function zr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Wr(e){var t=e.playlistId,n=zr(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(Nr.getPlaylistFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Kr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST}),!!r&&p.createElement(Br,{playlist:r,savePlaylist:function(e,n){return o.updatePlaylist(t,e,n,n)}}))}!function(e){e[e.Subject=0]="Subject",e[e.Classification=1]="Classification"}(Jr||(Jr={})),function(e){e.Playlists="playlists",e.Series="series",e.Videos="videos"}(Mr||(Mr={})),function(e){e.Root="0"}(Hr||(Hr={})),function(e){e.Root="root"}(Yr||(Yr={}));var Gr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),levelIds:Ee.array().of(Ee.string()).required("A level is required").default([])}).noUnknown(),Zr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentIds:Ee.array().of(Ee.string()).default([Yr.Root]),subjectIds:Ee.array().of(Ee.string()).min(1,"A classification must be mapped to at least one subject").required("A classification must be mapped to at least one subject").default([]),type:Ee.mixed().required("Type is required").default(m.ClassificationType.Subject),emphasize:Ee.boolean().default(!1),cover:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),Qr=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default("")}).noUnknown(),Xr=Ee.object().shape({name:Ee.string().max(255,"Name is too long").required("Name is required"),description:Ee.string().max(65535,"Description is too long").required("Description is required")}),$r=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),parentId:Ee.string().default(Hr.Root)}).noUnknown(),ei={singularizeMemberType:function(e){switch(e){case Mr.Playlists:return"playlist";case Mr.Series:return"series";case Mr.Videos:return"video"}},getMemberAppLink:function(e,t){var n=[t];switch(e){case Mr.Playlists:return{application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:n};case Mr.Series:return{application:s.SERIES,action:i.Series.EDIT_SERIES,args:n};case Mr.Videos:return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:n}}},getMemberActions:function(e,t,n,r){return[{label:"Remove ".concat(ei.singularizeMemberType(n)),appLink:{application:s.SUBJECTS,action:t===Jr.Subject?i.Subjects.REMOVE_SUBJECT_MEMBER:i.Subjects.REMOVE_CLASSIFICATION_MEMBER,args:[e,r,n]},className:"text-danger"}]}},ti=function(){var e=s.SUBJECTS,t=i.Subjects;return[{label:"Classifications",appLink:{application:e,action:t.CLASSIFICATIONS},activeActions:[t.CLASSIFICATIONS,t.PRESENTATION_CLASSIFICATIONS,t.NEW_CLASSIFICATION,t.EDIT_CLASSIFICATION,t.EDIT_CLASSIFICATION_PLAYLISTS,t.EDIT_CLASSIFICATION_SERIES,t.EDIT_CLASSIFICATION_VIDEOS,t.DELETE_CLASSIFICATION,t.REMOVE_CLASSIFICATION_MEMBER]},{label:"Subjects",appLink:{application:e,action:t.SUBJECTS},activeActions:[t.SUBJECTS,t.NEW_SUBJECT,t.EDIT_SUBJECT,t.EDIT_SUBJECT_PLAYLISTS,t.EDIT_SUBJECT_SERIES,t.EDIT_SUBJECT_VIDEOS,t.SUBJECT_CLASSIFICATIONS,t.DELETE_SUBJECT,t.ADD_SUBJECT_MEMBERS,t.REMOVE_SUBJECT_MEMBER]},{label:"Audiences",appLink:{application:e,action:t.AUDIENCES},activeActions:[t.AUDIENCES,t.PRESENTATION_AUDIENCES,t.NEW_AUDIENCE,t.EDIT_AUDIENCE]},{label:"Levels",appLink:{application:e,action:t.LEVELS},activeActions:[t.LEVELS,t.NEW_LEVEL,t.EDIT_LEVEL]},{label:"Presentations",appLink:{application:e,action:t.PRESENTATIONS},activeActions:[t.PRESENTATIONS,t.NEW_PRESENTATION,t.EDIT_PRESENTATION]}]},ni=function(e){var t=s.SUBJECTS,n=i.Subjects;return[{label:"Edit Subject Details",appLink:{application:t,action:n.EDIT_SUBJECT,args:[e]}},{label:"Classifications",appLink:{application:t,action:n.SUBJECT_CLASSIFICATIONS,args:[e]}},{label:"Playlists",appLink:{application:t,action:n.EDIT_SUBJECT_PLAYLISTS,args:[e]}},{label:"Series",appLink:{application:t,action:n.EDIT_SUBJECT_SERIES,args:[e]}},{label:"Videos",appLink:{application:t,action:n.EDIT_SUBJECT_VIDEOS,args:[e]}}]},ri=function(e,t){var n=s.SUBJECTS,r=i.Subjects;return[{label:"Edit Classification Details",appLink:{application:n,action:r.EDIT_CLASSIFICATION,args:[e,t]}},{label:"Playlists",appLink:{application:n,action:r.EDIT_CLASSIFICATION_PLAYLISTS,args:[e,t]}},{label:"Series",appLink:{application:n,action:r.EDIT_CLASSIFICATION_SERIES,args:[e,t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_CLASSIFICATION_VIDEOS,args:[e,t]}}]};function ii(e){return(ii="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ai(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function oi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ci(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function si(e,t){return!t||"object"!==ii(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ui(e){return(ui=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function li(e,t){return(li=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pi=function(){return"/api/subjects/v1/subjects/tree"},fi=function(e){return"/api/subjects/v1/subjects/".concat(e)},mi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/").concat(t,"?query={limit:100}")},di=function(e,t,n){var r="/api/subjects/v1/subjects/".concat(e,"/classifications"),i=[];return t&&i.push("presentationId=".concat(t)),n&&i.push("query=".concat(n,"{limit:100}")),i.length?"".concat(r,"?").concat(i.join("&")):r},bi=function(){return"/api/subjects/v1/subjects"},yi=function(e){return"/api/subjects/v1/subjects/".concat(e)},vi=function(e){return"/api/subjects/v1/subjects/".concat(e)},Si=function(e){return"/api/subjects/v1/objects/".concat(e,"/subjects")},Ei=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/subjects?addToClassifications=").concat(!!t)},hi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?addToClassifications=").concat(!!t)},gi=function(e,t){return"/api/subjects/v1/subjects/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Oi=function(){return"/api/subjects/v1/presentations"},ji=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ti=function(){return"/api/subjects/v1/presentations"},Ci=function(e){return"/api/subjects/v1/presentations/".concat(e)},Ii=function(e){return"/api/subjects/v1/presentations/".concat(e,"/classifications/tree")},Ai=function(e){return"/api/subjects/v1/classifications/".concat(e,"?query=cover,banner")},Pi=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/").concat(t,"?query={limit:100}")},Li=function(){return"/api/subjects/v1/classifications"},Ni=function(e){return"/api/subjects/v1/classifications/".concat(e)},ki=function(e){return"/api/subjects/v1/classifications/".concat(e)},wi=function(e){return"/api/subjects/v1/objects/".concat(e,"/classifications")},Di=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/classifications?presentationId=").concat(t)},Fi=function(e){return"/api/subjects/v1/classifications/".concat(e,"/objects")},_i=function(e,t){return"/api/subjects/v1/classifications/".concat(e,"/objects?").concat(t.map((function(e){return"objectId=".concat(e)})).join("&"))},Ri=function(){return"/api/subjects/v1/levels"},xi=function(e){return"/api/subjects/v1/levels/".concat(e)},Ui=function(){return"/api/subjects/v1/levels"},Vi=function(e){return"/api/subjects/v1/levels/".concat(e)},Bi=function(e){return"/api/subjects/v1/objects/".concat(e,"/levels")},Ji=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/levels?addToAudiences=").concat(!!t)},Mi=function(e){return"/api/subjects/v1/presentations/".concat(e,"/audiences")},Hi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Yi=function(){return"/api/subjects/v1/audiences"},qi=function(e){return"/api/subjects/v1/audiences/".concat(e)},Ki=function(e){return"/api/subjects/v1/audiences/".concat(e)},zi=function(e){return"/api/subjects/v1/objects/".concat(e,"/audiences")},Wi=function(e,t){return"/api/subjects/v1/objects/".concat(e,"/audiences?presentationId=").concat(t)},Gi=function(e,t,n){var r="".concat(a.SUBJECT,":").concat(e);return t&&(r+=":".concat(t)),r+=":".concat(a.CLASSIFICATIONS),n&&(r+=":".concat(n)),r},Zi=function(e){function t(){return oi(this,t),si(this,ui(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&li(e,t)}(t,e),n=t,(r=[{key:"getPresentations",value:function(e,t){return this.get({resource:Oi(),eventPrefix:a.PRESENTATIONS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getPresentation",value:function(e,t,n){return this.get({resource:ji(e),eventPrefix:"".concat(a.PRESENTATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createPresentation",value:function(e,t,n){return this.create({resource:Ti(),data:e,callback:t,errorCallback:n,eventPrefix:a.PRESENTATION,invalidationKeys:[a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created presentation."),errorHandler:this.alertService.error("Failed to create presentation.")})}},{key:"updatePresentation",value:function(e,t,n,r){return this.update({resource:Ci(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_PRESENTATION,":").concat(e),invalidationKeys:["".concat(a.PRESENTATION,":").concat(e),a.PRESENTATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated presentation."),errorHandler:this.alertService.error("Failed to update presentation.")})}},{key:"getSubjectTree",value:function(e,t){return this.get({resource:pi(),formatData:function(e){return{children:e,name:Hr.Root,id:null}},eventPrefix:a.SUBJECTS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getSubject",value:function(e,t,n){return this.get({resource:fi(e),eventPrefix:"".concat(a.SUBJECT,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSubjectMemberIds",value:function(e,t,n,r){return this.get({resource:mi(e,t),eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"getSubjectClassifications",value:function(e,t,n,r,i){return this.get({resource:di(e,t,n),eventPrefix:Gi(e,t,n),expiryTime:m.CacheDurations.STANDARD,callback:r,errorCallback:i})}},{key:"createSubject",value:function(e,t,n){return this.create({resource:bi(),data:e,callback:t,errorCallback:n,eventPrefix:a.SUBJECT,invalidationKeys:[a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created subject."),errorHandler:this.alertService.error("Failed to create subject.")})}},{key:"updateSubject",value:function(e,t,n,r){return this.update({resource:yi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SUBJECT,":").concat(e),invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated subject."),errorHandler:this.alertService.error("Failed to save subject.")})}},{key:"deleteSubject",value:function(e,t,n){return this.delete({resource:vi(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_SUBJECT,invalidationKeys:["".concat(a.SUBJECT,":").concat(e),a.SUBJECTS],successHandler:this.alertService.success("Successfully deleted subject"),errorHandler:this.alertService.error("Failed to delete subject")})}},{key:"getObjectSubjects",value:function(e,t,n,r){return this.get({resource:Si(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectSubjects",value:function(e,t,n,r,i,o){var c=ei.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.SUBJECTS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)),s.push.apply(s,ai(t.map((function(e){return"".concat(a.SUBJECTS,":").concat(e,":").concat(n)})))),this.update({resource:Ei(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_SUBJECTS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," subjects.")),errorHandler:this.alertService.error("Failed to update ".concat(c," subjects."))})}},{key:"addObjectsToSubject",value:function(e,t,n,r,i,o){var c=1===t.length?ei.singularizeMemberType(n):n,s=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ai(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))),ai(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)}))));return this.create({resource:hi(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.ADD_TO_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:s,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(c," to subject.")),errorHandler:this.alertService.error("Failed to add ".concat(c," to subject."))})}},{key:"removeObjectsFromSubject",value:function(e,t,n,r,i){var o=1===t.length?ei.singularizeMemberType(n):n,c=["".concat(a.SUBJECT,":").concat(e,":").concat(n)].concat(ai(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.SUBJECTS)}))));return this.delete({resource:gi(e,t),callback:r,errorCallback:i,eventPrefix:"".concat(a.REMOVE_FROM_SUBJECT,":").concat(e,":").concat(n),invalidationKeys:c,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(o," from subject.")),errorHandler:this.alertService.error("Failed to remove ".concat(o," from subject."))})}},{key:"getClassificationTree",value:function(e,t,n){return this.get({resource:Ii(e),formatData:function(e){return{children:e,name:Yr.Root,id:null}},eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassification",value:function(e,t,n){return this.get({resource:Ai(e),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getClassificationMembers",value:function(e,t,n,r){return this.get({resource:Pi(e,t),eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"createClassification",value:function(e,t,n){return this.create({resource:Li(),data:e,callback:t,errorCallback:n,eventPrefix:a.CLASSIFICATION,invalidationKeys:[a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created classification."),errorHandler:this.alertService.error("Failed to create classification.")})}},{key:"updateClassification",value:function(e,t,n,r){return this.update({resource:Ni(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_CLASSIFICATION,":").concat(e),invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated classification."),errorHandler:this.alertService.error("Failed to save classification.")})}},{key:"deleteClassification",value:function(e,t,n){return this.delete({resource:ki(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_CLASSIFICATION,invalidationKeys:["".concat(a.CLASSIFICATION,":").concat(e),a.CLASSIFICATIONS],successHandler:this.alertService.success("Successfully deleted classification"),errorHandler:this.alertService.error("Failed to delete classification")})}},{key:"getObjectClassifications",value:function(e,t,n,r){return this.get({resource:wi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectClassifications",value:function(e,t,n,r,i,o){var c=ei.singularizeMemberType(r),s=["".concat(r,":").concat(e,":").concat(a.CLASSIFICATIONS)];return s.push.apply(s,ai(n.map((function(e){return"".concat(a.CLASSIFICATION,":").concat(e,":").concat(r)})))),this.update({resource:Di(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_CLASSIFICATIONS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," classifications.")),errorHandler:this.alertService.error("Failed to update ".concat(c," classifications."))})}},{key:"addObjectsToClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ei.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push(Gi(r,i,n)),u.push.apply(u,ai(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.create({resource:Fi(e),data:t,callback:o,errorCallback:c,eventPrefix:"".concat(a.ADD_TO_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully added ".concat(s," to classification.")),errorHandler:this.alertService.error("Failed to add ".concat(s," to classification."))})}},{key:"removeObjectsFromClassification",value:function(e,t,n,r,i,o,c){var s=1===t.length?ei.singularizeMemberType(n):n,u=["".concat(a.CLASSIFICATION,":").concat(e,":").concat(n)];return r&&u.push(Gi(r,i,n)),u.push.apply(u,ai(t.map((function(e){return"".concat(n,":").concat(e,":").concat(a.CLASSIFICATIONS)})))),this.delete({resource:_i(e,t),callback:o,errorCallback:c,eventPrefix:"".concat(a.REMOVE_FROM_CLASSIFICATION,":").concat(e,":").concat(n),invalidationKeys:u,expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully removed ".concat(s," from classification.")),errorHandler:this.alertService.error("Failed to remove ".concat(s," from classification."))})}},{key:"getLevels",value:function(e,t){return this.get({resource:Ri(),eventPrefix:a.LEVELS,expiryTime:m.CacheDurations.STANDARD,callback:e,errorCallback:t})}},{key:"getLevel",value:function(e,t,n){return this.get({resource:xi(e),eventPrefix:"".concat(a.LEVEL,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createLevel",value:function(e,t,n){return this.create({resource:Ui(),data:e,callback:t,errorCallback:n,eventPrefix:a.LEVEL,invalidationKeys:[a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created level."),errorHandler:this.alertService.error("Failed to create level.")})}},{key:"updateLevel",value:function(e,t,n,r){return this.update({resource:Vi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_LEVEL,":").concat(e),invalidationKeys:["".concat(a.LEVEL,":").concat(e),a.LEVELS],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated level."),errorHandler:this.alertService.error("Failed to save level.")})}},{key:"getObjectLevels",value:function(e,t,n,r){return this.get({resource:Bi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectLevels",value:function(e,t,n,r,i,o){var c=ei.singularizeMemberType(n),s=["".concat(n,":").concat(e,":").concat(a.LEVELS)];return r&&s.push("".concat(n,":").concat(e,":").concat(a.AUDIENCES)),this.update({resource:Ji(e,r),data:t,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_LEVELS,":").concat(e),invalidationKeys:s,successHandler:this.alertService.success("Successfully updated ".concat(c," levels.")),errorHandler:this.alertService.error("Failed to update ".concat(c," levels."))})}},{key:"getAudiences",value:function(e,t,n){return this.get({resource:Mi(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCES,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"getAudience",value:function(e,t,n){return this.get({resource:Hi(e),callback:t,errorCallback:n,eventPrefix:"".concat(a.AUDIENCE,":").concat(e),expiryTime:m.CacheDurations.STANDARD})}},{key:"createAudience",value:function(e,t,n){return this.create({resource:Yi(),data:e,callback:t,errorCallback:n,eventPrefix:a.AUDIENCE,invalidationKeys:[a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully created audience."),errorHandler:this.alertService.error("Failed to create audience.")})}},{key:"updateAudience",value:function(e,t,n,r){return this.update({resource:qi(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_AUDIENCE,":").concat(e),invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated audience."),errorHandler:this.alertService.error("Failed to update audience.")})}},{key:"deleteAudience",value:function(e,t,n){return this.delete({resource:Ki(e),callback:t,errorCallback:n,eventPrefix:a.DELETE_AUDIENCE,invalidationKeys:["".concat(a.AUDIENCE,":").concat(e),a.AUDIENCES],successHandler:this.alertService.success("Successfully deleted audience"),errorHandler:this.alertService.error("Failed to delete audience")})}},{key:"getObjectAudiences",value:function(e,t,n,r){return this.get({resource:zi(e),eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),expiryTime:m.CacheDurations.STANDARD,callback:n,errorCallback:r})}},{key:"updateObjectAudiences",value:function(e,t,n,r,i,o){var c=ei.singularizeMemberType(r);return this.update({resource:Wi(e,t),data:n,callback:i,errorCallback:o,eventPrefix:"".concat(a.UPDATE_OBJECT_AUDIENCES,":").concat(e),invalidationKeys:["".concat(r,":").concat(e,":").concat(a.AUDIENCES)],successHandler:this.alertService.success("Successfully updated ".concat(c," audiences.")),errorHandler:this.alertService.error("Failed to update ".concat(c," audiences."))})}},{key:"name",get:function(){return l.SUBJECT}},{key:"channelName",get:function(){return u.SUBJECT}}])&&ci(n.prototype,r),i&&ci(n,i),t}(f.BaseDataService),Qi={dataServiceName:l.SUBJECT,dataChannelName:u.SUBJECT},Xi={getSubjectTreeFetchOptions:function(e,t){return Object.assign(Object.assign({},Qi),{eventPrefix:a.SUBJECTS,fetchData:function(e){return e.getSubjectTree()},setData:e,onError:t})},getSubjectFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.SUBJECT,":").concat(e),fetchData:function(t){return t.getSubject(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_SUBJECT})},getSubjectMemberIdsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.SUBJECT,":").concat(e,":").concat(t),fetchData:function(n){return n.getSubjectMemberIds(e,t)},setData:n,onError:r})},getSubjectClassificationFetchOptions:function(e,t,n,r,i){return Object.assign(Object.assign({},Qi),{eventPrefix:Gi(e,n,r),fetchData:function(t){return t.getSubjectClassifications(e,n,r)},setData:t,onError:i})},getObjectSubjectsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.SUBJECTS),fetchData:function(n){return n.getObjectSubjects(e,t)},setData:n,onError:r})},getPresentationsFetchOptions:function(e,t){return Object.assign(Object.assign({},Qi),{eventPrefix:a.PRESENTATIONS,fetchData:function(e){return e.getPresentations()},setData:e,onError:t})},getPresentationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.PRESENTATION,":").concat(e),fetchData:function(t){return t.getPresentation(e)},setData:t,onError:n})},getClassificationTreeFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.CLASSIFICATIONS,":").concat(e),fetchData:function(t){return t.getClassificationTree(e)},setData:t,onError:n})},getClassificationFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e),fetchData:function(t){return t.getClassification(e)},setData:t,onError:n,deleteEventPrefix:a.DELETE_CLASSIFICATION})},getClassificationMembersFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.CLASSIFICATION,":").concat(e,":").concat(t),fetchData:function(n){return n.getClassificationMembers(e,t)},setData:n,onError:r})},getObjectClassificationsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.CLASSIFICATIONS),fetchData:function(n){return n.getObjectClassifications(e,t)},setData:n,onError:r})},getLevelsFetchOptions:function(e,t){return Object.assign(Object.assign({},Qi),{eventPrefix:a.LEVELS,fetchData:function(e){return e.getLevels()},setData:e,onError:t})},getLevelFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.LEVEL,":").concat(e),fetchData:function(t){return t.getLevel(e)},setData:t,onError:n})},getObjectLevelsFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.LEVELS),fetchData:function(n){return n.getObjectLevels(e,t)},setData:n,onError:r})},getAudiencesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.AUDIENCES,":").concat(e),fetchData:function(t){return t.getAudiences(e)},setData:t,onError:n})},getAudienceFetchOptions:function(e,t,n){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(a.AUDIENCE,":").concat(e),fetchData:function(t){return t.getAudience(e)},setData:t,onError:n})},getObjectAudiencesFetchOptions:function(e,t,n,r){return Object.assign(Object.assign({},Qi),{eventPrefix:"".concat(t,":").concat(e,":").concat(a.AUDIENCES),fetchData:function(n){return n.getObjectAudiences(e,t)},setData:n,onError:r})}},$i=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},ea=function(e,t){var n=e.levelIds;return t.filter((function(e){return n.includes(e.id)}))};function ta(e){var t=e.showLevels;return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,"Audiences"),!!t&&p.createElement("th",null,"Mapped Level(s)")))}function na(e){var t,n=e.audience,r=e.levels;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:(t=n,{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[t.presentationId,t.masterId]})},n.name)),p.createElement("td",null,r.map((function(e){return p.createElement(m.AppLink,{key:e.id,appLink:$i(e),className:"mr-2"},e.name)}))))}function ra(e){var t=e.audiences,n=e.levels;return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(ta,{showLevels:!!t.length}),p.createElement("tbody",null,t.length?t.map((function(e){return p.createElement(na,{key:e.masterId,audience:e,levels:ea(e,n)})})):p.createElement("tr",null,p.createElement("td",null,"This presentation has no audiences."))))}function ia(e){var t=null===e.masterId||void 0===e.masterId,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this audience",autoFocus:!0}),p.createElement(m.FormField,{label:"Mapped Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_AUDIENCE,args:[e.presentationId,e.masterId]}},"Delete")))}function aa(e){return p.createElement(m.FormWrapper,{initialValues:e.audience,validationSchema:Gr,onSubmit:e.saveAudience},p.createElement(ia,{masterId:e.audience&&e.audience.masterId,presentationId:e.presentationId,levels:e.levels}))}function oa(e){var t=e.objectAudiences,n=e.presentationAudiences;return t.filter((function(e){return n.some((function(t){return t.masterId===e.masterId}))}))}function ca(e){var t,n,r,i,a,o=ei.singularizeMemberType(e.memberType),c=(n=(t=e).presentationAudiences,r=t.objectLevels,i=t.objectAudiences,a=r.map((function(e){return e.id})),n.filter((function(e){return f.ArrayHelper.intersection(e.levelIds,a).length||i.some((function(t){return t.masterId===e.masterId}))})));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Levels"),p.createElement("p",null,"Select which levels this ".concat(o," is mapped to.")),p.createElement("p",null,"To see how levels correspond to audiences, scroll down to the audience-level mappings table."),p.createElement(Ca,{initialValues:{levelIds:e.objectLevels.map((function(e){return e.id})),addToAudiences:!0},saveLevels:e.saveLevels,levels:e.levels,memberType:e.memberType})),p.createElement("h6",null,"Audiences"),p.createElement("p",null,"Select a presentation to view its audiences and map them to this ".concat(o,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Pa,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),p.createElement("p",null,"Audience to level mappings for this presentation are displayed below."),p.createElement(ra,{levels:e.levels,audiences:e.presentationAudiences}),p.createElement("p",null,"Only the audiences which are mapped to a level that this"+" ".concat(o," is mapped to are displayed below.")),!!c.length&&p.createElement(ua,{initialValues:{audienceIds:oa(e).map((function(e){return e.masterId}))},saveAudiences:e.saveAudiences,audiences:c}))}function sa(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Audience(s)",as:"select",name:"audienceIds",id:"audience-ids",multiple:!0,size:e.audiences.length,value:t.values.audienceIds},e.audiences.map((function(e){return p.createElement("option",{key:e.masterId,value:e.masterId},e.name)}))),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Audiences")))}function ua(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.audienceIds;return e.saveAudiences(r,n)},enableReinitialize:!0},p.createElement(sa,{audiences:e.audiences}))}function la(e){var t=e.item,n=e.getItemAppLink,r=e.actions,i=e.pinState;return p.createElement("tr",null,p.createElement("td",null,p.createElement(m.AppLink,{appLink:n(t)},t.name)),i.isPinnable&&p.createElement("td",null,p.createElement(Ne,{selected:parseInt(t.id)===parseInt(i.currentPinnedVideo),onToggle:function(e){return i.onChange(e,t.id)},id:t.id})),r&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:r}))))}function pa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function fa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ma(e){var t=e.items,n=e.memberType,r=e.classification,i=e.getItemAppLink,a=e.getActions,o=e.updatePinnedVideo,c=fa(p.useState(!1),2),s=c[0],u=c[1],l=function(e,t){var n=e.pinnedVideoMasterId||null,r=pa(p.useState(n),2),i=r[0],a=r[1];return{currentPinnedVideo:i,onChange:function(e,t){a(e?t:null)},canSubmit:n!==i,isPinnable:t===Mr.Videos}}(r,n);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this classification."));var d="".concat(Be(ei.singularizeMemberType(n))," Name");return p.createElement(p.Fragment,null,p.createElement(Ae.Table,{responsive:!0},p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",null,d),l.isPinnable&&p.createElement("th",null,"Pinned"),f.FunctionHelper.isFunction(a)&&p.createElement("th",null))),p.createElement("tbody",null,t.map((function(e){return p.createElement(la,{item:e,key:e.id,getItemAppLink:i,actions:f.FunctionHelper.isFunction(a)&&a(e),pinState:l})})))),l.isPinnable&&p.createElement(m.SpinnerButton,{showSpinner:s,onClick:function(){u(!0),o(l.currentPinnedVideo,(function(){return u(!1)}))},disabled:!l.canSubmit||s},"Save"))}function da(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ba=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function ya(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=null===e.id||void 0===e.id,a=!r||!(!t.values.parentIds||!t.values.parentIds.length),o=da(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,t.values.parentIds]),p.useEffect((function(){t.values.subjectIds.length&&!t.touched.subjectIds&&t.setFieldTouched("subjectIds",!0)}),[t.values.subjectIds]);var l=function(e){return t.setFieldValue("parentIds",f.ArrayHelper.addOrRemove(t.values.parentIds.map((function(e){return e.toString()})),e.id.toString()))},d=function(e){return t.setFieldValue("subjectIds",f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),e.id.toString()))},b=function(e){return"".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,e)," h-auto py-2")};return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this classification",autoFocus:!0}),p.createElement(m.FormField,{as:"select",label:"Type",name:"type",id:"type",value:t.values.type},f.ObjectHelper.getEnumKeys(m.ClassificationType).map((function(e){return p.createElement("option",{key:e,value:m.ClassificationType[e]},e)}))),p.createElement(m.FormField,{label:"Emphasize",name:"emphasize",id:"emphasize",type:"checkbox",checked:t.values.emphasize}),p.createElement(m.FormField,{name:"parentIds"},(function(){return p.createElement("div",{className:b("parentIds")},p.createElement(Tt,{label:"Parent Classification(s)",tree:e.classificationTree,selectedIds:t.values.parentIds,onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root classification.",isNodeDisabled:(n=e.classificationTree,r=e.id,function(e){if(e.id===r)return!0;var t=Me.find(n,r);return!!Me.find(t,e.id)})}));var n,r})),p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:b("subjectIds")},p.createElement(Tt,{label:"Mapped Subject(s)",tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:d,collapse:!r,getSelectedItemAppLink:ba}))})),p.createElement(tt,{imageType:m.ImageType.Covers,currentImage:t.values.cover,setNewImage:function(e){return t.setFieldValue("cover",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SUBJECTS,uploadAction:i.Subjects.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},r?"Create":"Save"),!r&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e.presentationId,e.id]}},"Delete")))}function va(e){return p.createElement(m.FormWrapper,{initialValues:e.classification,validationSchema:Zr,onSubmit:e.saveClassification},p.createElement(ya,{id:e.classification&&e.classification.id,presentationId:e.presentationId,classificationTree:e.classificationTree,subjectTree:e.subjectTree}))}var Sa=function(e){return function(t){if(!e)return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION;switch(e){case Mr.Playlists:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;case Mr.Series:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_SERIES;case Mr.Videos:return t.appLink.action===i.Subjects.EDIT_CLASSIFICATION_VIDEOS}}};function Ea(e){var t=e.presentation,n=e.classificationId,r=e.memberType;return t?p.createElement(p.Fragment,null,p.createElement("h6",null,"Presentation: ".concat(!!t&&t.name)),p.createElement("div",{className:"py-2"},p.createElement(mt,{tabs:ri(t.id,n),isItemActive:Sa(r)}))):p.createElement(p.Fragment,null)}function ha(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(e){return t.setFieldValue("classificationIds",f.ArrayHelper.addOrRemove(t.values.classificationIds.map((function(e){return e.toString()})),e.id.toString()))},a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"classificationIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"classificationIds"},(function(){return p.createElement("div",{className:a},p.createElement(Tt,{label:"Mapped Classification(s)",tree:e.classificationTree,selectedIds:t.values.classificationIds,onSelect:r,getSelectedItemAppLink:(n=e.presentationId,function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,e]}}),isNodeDisabled:e.isClassificationDisabled}));var n})),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},"Save Classifications")))}function ga(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.classificationIds;return e.saveClassifications(r,n)},enableReinitialize:!0},p.createElement(ha,{presentationId:e.presentationId,classificationTree:e.classificationTree,isClassificationDisabled:e.isClassificationDisabled}))}function Oa(e){var t=null===e.id||void 0===e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this level",autoFocus:!0}),p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"))}function ja(e){return p.createElement(m.FormWrapper,{initialValues:e.level,validationSchema:Qr,onSubmit:e.saveLevel},p.createElement(Oa,{id:e.level&&e.level.id}))}function Ta(e){var t=ei.singularizeMemberType(e.memberType),n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Level(s)",as:"select",name:"levelIds",id:"level-ids",multiple:!0,size:e.levels.length,value:n.values.levelIds},e.levels.map((function(e){return p.createElement("option",{key:e.id,value:e.id},e.name)}))),p.createElement(m.FormField,{label:"Automatically add to audiences*",name:"addToAudiences",id:"add-to-audiences",type:"checkbox",checked:n.values.addToAudiences}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(t," to a level, all of that level's")+" audiences across all presentations will also be added to.")),p.createElement("p",null,p.createElement("strong",null,"Note:")," When removing a ".concat(t," from a level, that level's audiences "),p.createElement("strong",null,"will not")," be automatically removed from."),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},"Save Levels")))}function Ca(e){return p.createElement(m.FormWrapper,{initialValues:e.initialValues,onSubmit:function(t,n){var r=t.levelIds,i=t.addToAudiences;return e.saveLevels(r,i,n)}},p.createElement(Ta,{levels:e.levels,memberType:e.memberType}))}function Ia(e){var t=e.values,n=t.name,r=t.description,i=e.id,a=e.isSubmitting,o=!i;return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:n,placeholder:"Enter a name for this presentation",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:r,placeholder:"Describe this presentation here"}),p.createElement(m.SpinnerButton,{showSpinner:a,type:"submit"},o?"Create":"Save"))}function Aa(e){var t=e.presentation,n=(t=void 0===t?{}:t).id,r=void 0===n?null:n,i=t.name,a=void 0===i?"":i,o=t.description,c=void 0===o?"":o,s=e.savePresentation;return p.createElement(ge.Formik,{initialValues:{name:a,description:c},validationSchema:Xr,onSubmit:s},(function(e){return p.createElement(Ia,Object.assign({id:r},e))}))}function Pa(e){var t=e.presentations,n=e.currentPresentation,r=e.setCurrentPresentation,i=e.label,a=function(e){var n,i,a=(n=e,i=t,f.ArrayHelper.first(i.filter((function(e){return e.id.toString()===n.toString()}))));r(a)};return p.useEffect((function(){t&&!n&&r(t[0])}),[t]),p.createElement(p.Fragment,null,!!n&&p.createElement(p.Fragment,null,p.createElement(Ae.Form.Label,null,i),p.createElement(Ae.Form.Control,{as:"select",value:n.id,onChange:function(e){return a(e.target.value)},className:"cursor-pointer"},t.map((function(e){return p.createElement("option",{value:e.id,key:e.id},e.name)})))))}function La(e){return p.createElement(p.Fragment,null,p.createElement("h4",null,"".concat(Be(e.memberType))),p.createElement(Ae.Table,{responsive:!0},p.createElement("tbody",null,e.objects&&e.objects.map((function(t){return p.createElement("tr",{key:t.id},p.createElement("td",null,p.createElement(m.AppLink,{appLink:ei.getMemberAppLink(e.memberType,t.id)},t.name)))})))),p.createElement(Va,{initialValues:{subjectIds:[],addToClassifications:!0},subjectTree:e.subjectTree,saveSubjects:e.onClickAddToSubject,memberType:e.memberType,saveBtnText:"Add to subject",subjectRequired:!0}))}function Na(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function ka(e){var t=ei.singularizeMemberType(e.memberType),n=[].concat(Na(e.objectClassifications),Na(e.objectSubjectClassifications)).map((function(e){return e.id}));return p.createElement(p.Fragment,null,p.createElement("div",{className:"border-bottom pb-3 mb-3"},p.createElement("h6",null,"Subjects"),p.createElement("p",null,"Select which subjects this ".concat(t," is mapped to.")),p.createElement(Va,{initialValues:{subjectIds:e.objectSubjects.map((function(e){return e.id}))},subjectTree:e.subjectTree,saveSubjects:e.saveSubjects,memberType:e.memberType,saveBtnText:"Save Subjects",allowMultiple:!0})),p.createElement("h6",null,"Classifications"),p.createElement("p",null,"Select a presentation to view its classifications and map them to this ".concat(t,".")),p.createElement("div",{className:"w-50 pb-3"},p.createElement(Pa,{presentations:e.presentations,currentPresentation:e.currentPresentation,setCurrentPresentation:e.setCurrentPresentation})),e.currentPresentation&&e.classificationTree&&e.classificationTree.children.length?p.createElement(p.Fragment,null,p.createElement("p",null,"Only classifications which are mapped to one of the subjects selected above can be selected."),p.createElement(ga,{initialValues:{classificationIds:e.objectClassifications.map((function(e){return e.id}))},presentationId:e.currentPresentation.id,classificationTree:e.classificationTree,saveClassifications:e.saveClassifications,isClassificationDisabled:function(e){return!n.includes(e.id)}})):p.createElement("p",null,"This presentation has no classifications."))}function wa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Pa.defaultProps={label:"Presentation"};function Da(e){var t=!e.id,n=Object(ge.useFormikContext)(),r=Object(m.useCanSubmitForm)(n),a=!t||!!n.values.parentId,o=wa(p.useState(a),2),c=o[0],u=o[1];p.useEffect((function(){return u(a)}),[e.id,n.values.parentId]);var l=function(e){var t=e.id===n.values.parentId?null:e.id;n.setFieldValue("parentId",t)},f="".concat(m.FormHelper.getCustomFormControlClassName(n.errors,n.touched,"parentId")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",name:"name",id:"name",value:n.values.name,placeholder:"Enter a name for this subject",autoFocus:!0}),p.createElement(m.FormField,{name:"parentId"},(function(){return p.createElement("div",{className:f},p.createElement(Tt,{label:"Parent Subject",tree:e.subjectTree,selectedIds:[n.values.parentId],onSelect:l,collapse:c,noSelectionMessage:"No parent selected, this will be a root subject.",isNodeDisabled:(t=e.subjectTree,r=e.id,function(e){if(e.id===r)return!0;var n=Me.find(t,r);return!!Me.find(n,e.id)})}));var t,r})),p.createElement("div",{className:"d-flex justify-content-between"},p.createElement(m.SpinnerButton,{showSpinner:n.isSubmitting,type:"submit",disabled:!r},t?"Create":"Save"),!t&&p.createElement(Ae.Button,{as:m.AppLink,variant:"danger",appLink:{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},"Delete")))}function Fa(e){return p.createElement(m.FormWrapper,{initialValues:e.subject,validationSchema:$r,onSubmit:e.saveSubject},p.createElement(Da,{id:e.subject&&e.subject.id,subjectTree:e.subjectTree}))}var _a=function(e){return function(t){return t.appLink.action===e}};function Ra(e){var t=e.subjectId,n=e.activeAction;return p.createElement(p.Fragment,null,p.createElement(Ae.Alert,{variant:"danger"},"Warning: You are editing the backbone subjects."),p.createElement("div",{className:"py-2"},p.createElement(mt,{tabs:ni(t),isItemActive:_a(n)})))}var xa=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e]}};function Ua(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t),r=function(n){var r=e.allowMultiple?f.ArrayHelper.addOrRemove(t.values.subjectIds.map((function(e){return e.toString()})),n.id.toString()):[n.id];t.setFieldValue("subjectIds",r)},i=ei.singularizeMemberType(e.memberType),a="".concat(m.FormHelper.getCustomFormControlClassName(t.errors,t.touched,"subjectIds")," h-auto py-2");return p.createElement(ge.Form,null,p.createElement(m.FormField,{name:"subjectIds"},(function(){return p.createElement("div",{className:a},p.createElement(Tt,{label:"Mapped Subject".concat(e.allowMultiple?"(s)":""),tree:e.subjectTree,selectedIds:t.values.subjectIds,onSelect:r,collapse:!!t.initialValues.subjectIds.length,getSelectedItemAppLink:xa}))})),p.createElement(m.FormField,{label:"Automatically add to classifications*",name:"addToClassifications",id:"add-to-classifications",type:"checkbox",checked:t.values.addToClassifications}),p.createElement("p",null,p.createElement("em",null,"*If selected, when adding a ".concat(i," to a subject, all of that subject's")+" mapped classifications across all presentations will also be added to.")),p.createElement("div",{className:"d-flex justify-content-end"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.saveBtnText)))}function Va(e){var t;return p.createElement(m.FormWrapper,{initialValues:e.initialValues,validationSchema:(t=e.subjectRequired,Ee.object().shape({subjectIds:t?Ee.array().of(Ee.string()).min(1,"A subject is required").required("A subject is required"):Ee.array().of(Ee.string()),addToClassifications:Ee.boolean().default(!0)}).noUnknown()),onSubmit:function(t,n){var r=t.subjectIds,i=t.addToClassifications;return e.saveSubjects(r,i,n)}},p.createElement(Ua,{subjectTree:e.subjectTree,memberType:e.memberType,allowMultiple:e.allowMultiple,saveBtnText:e.saveBtnText}))}Ua.defaultProps={saveBtnText:"Save"};var Ba=function(e){return p.createElement("div",{className:"border rounded p-2 mb-3"},p.createElement("h6",{className:"border-bottom pb-1"},e.presentation.name),e.classifications&&e.classifications.length?p.createElement("ul",{className:"list-unstyled mb-0"},e.classifications.map((function(t){return p.createElement("li",{key:t.id,className:"py-1"},p.createElement(m.AppLink,{appLink:(n=e.presentation.id,r=t.id,{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[n,r]})},t.name));var n,r}))):p.createElement("p",null,p.createElement("em",null,"There are no classifications mapped to this subject in this presentation.")))},Ja=function(e){return p.createElement(p.Fragment,null,!!e.presentations&&!!e.classificationDictionary&&e.presentations.map((function(t){return p.createElement(Ba,{key:t.id,presentation:t,classifications:e.classificationDictionary[t.id]})})))},Ma=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function Ha(e){return p.createElement(p.Fragment,null,e.classifications.map((function(t){return p.createElement("th",{key:t.id},p.createElement("span",{className:"d-inline-block"},p.createElement(Ne,{selected:e.getIsClassificationSelected(t),onToggle:function(n){return e.onToggleClassification(t.id,n)}})),p.createElement(m.AppLink,{appLink:e.getClassificationAppLink(t.id)},function(e,t){return t?e.name:"Classification: ".concat(e.name)}(t,e.showClassificationSubHeader)))})))}function Ya(e){var t=e.memberType,n=e.hasActions,r=e.classifications,i=Ma(e,["memberType","hasActions","classifications"]),a="".concat(Be(ei.singularizeMemberType(t))," Name"),o=!!r&&!!r.length,c=o&&r.length>1,s=o?2:1,u=Object.assign({classifications:r,showClassificationSubHeader:c},i);return p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{rowSpan:s},a),o&&(c?p.createElement("th",{colSpan:r.length,className:"text-center"},"Classifications"):p.createElement(Ha,Object.assign({},u))),n&&p.createElement("th",{rowSpan:s})),o&&c&&p.createElement("tr",null,p.createElement(Ha,Object.assign({},u))))}function qa(e){var t=e.member,n=t.id,r=t.name,i=t.classifications,a=void 0===i?[]:i,o=e.getMemberAppLink,c=e.onToggleClassification,s=e.actions,u=f.FunctionHelper.isFunction(o)&&o(n);return a.length&&!f.FunctionHelper.isFunction(c)&&f.Core.ErrorHelper.throw(new f.DevError("onToggleClassification must be passed to SubjectMemberItem")),p.createElement("tr",null,p.createElement("td",null,u?p.createElement(m.AppLink,{appLink:o(n)},r):r),!!a.length&&a.map((function(e){return p.createElement("td",{key:e.id},p.createElement(Ne,{selected:e.selected,onToggle:function(t){return c(e.id,t,n)}}))})),s&&p.createElement("td",null,p.createElement("span",{className:"d-flex justify-content-end"},p.createElement(m.Actions,{actions:s}))))}var Ka=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};function za(e,t){return function(n){var r=n[e],i=m.CollectionHelper.length(r);return!!i&&i===t.length}}function Wa(e){var t=e.members,n=e.memberType,r=e.getActions,i=e.classifications,a=e.getClassificationAppLink,o=e.onToggleClassification,c=Ka(e,["members","memberType","getActions","classifications","getClassificationAppLink","onToggleClassification"]);if(!t.length)return p.createElement("div",{className:"py-5"},"No ".concat(n," in this subject."));var s=f.FunctionHelper.isFunction(r),u={memberType:n,classifications:i,getClassificationAppLink:a,getIsClassificationSelected:za(n,t),onToggleClassification:o,hasActions:s};return p.createElement(Ae.Table,{responsive:!0,bordered:!0},p.createElement(Ya,Object.assign({},u)),p.createElement("tbody",null,t.map((function(e,t){return p.createElement(qa,Object.assign({key:t,member:e,actions:s&&r(e.id),onToggleClassification:o},c))}))))}function Ga(e){var t=e.navItems,n=e.currentAppLink;return p.createElement(Ae.Container,null,p.createElement(Ae.Navbar,{className:"justify-content-between align-items-center"},p.createElement(Ae.Nav,null,!!t&&t.map((function(e,t){return p.createElement(Ae.Nav.Item,{key:t},p.createElement(Ae.Nav.Link,{as:m.AppLink,appLink:e.appLink,active:_e.isItemActive(e,n),className:_e.isItemActive(e,n)?"text-primary":""},e.label))})))))}function Za(e,t){p.useEffect((function(){e.presentations&&!e.currentPresentation&&m.StateHelper.getSetStateByKey(t,"currentPresentation")(f.ArrayHelper.first(e.presentations))}),[e.presentations])}function Qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xa(e){var t=e.playlistId,n=Qa(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Nr.getPlaylistFetchOptions(e,r("playlist")),Xi.getObjectLevelsFetchOptions(e,Mr.Playlists,r("playlistLevels"))],[e]),Object(f.useFetch)(Xi.getObjectAudiencesFetchOptions(e,Mr.Playlists,r("playlistAudiences")),[e,t.playlistLevels]),Object(f.useBulkFetch)([Xi.getPresentationsFetchOptions(r("presentations")),Xi.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Za(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.playlistLevels&&r.playlistAudiences);return p.createElement(p.Fragment,null,p.createElement(Kr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_AUDIENCES}),p.createElement(ut,{object:r.playlist}),!!c&&p.createElement(ca,{objectLevels:r.playlistLevels,objectAudiences:r.playlistAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Mr.Playlists,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Mr.Playlists,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Mr.Playlists,n,n)}}))}function $a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function eo(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function to(e){var t=e.playlistId,n=$a(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Xi.getSubjectTreeFetchOptions(r("subjectTree")),Xi.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Nr.getPlaylistFetchOptions(e,r("playlist")),Xi.getObjectSubjectsFetchOptions(e,Mr.Playlists,r("playlistSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.playlistSubjects]);var i=function(e,t){return[].concat(eo(t.subjectClassifications||[]),eo(e))},a=t.playlistSubjects&&t.playlistSubjects.map((function(e){return Xi.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.playlistSubjects],!!a),Object(f.useFetch)(Xi.getObjectClassificationsFetchOptions(e,Mr.Playlists,r("playlistClassifications")),[e,t.playlistSubjects])}(t,r,a),Za(r,a);var c=!!(r.playlistSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.playlistClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Kr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_SUBJECTS}),p.createElement(ut,{object:r.playlist}),c&&p.createElement(ka,{objectSubjects:r.playlistSubjects,subjectTree:r.subjectTree,memberType:Mr.Playlists,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.playlistClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Mr.Playlists,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Mr.Playlists,n,n)}}))}function no(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ro=function(e){return function(t){return[{label:"Remove video",appLink:{application:s.PLAYLISTS,action:i.Playlists.REMOVE_VIDEO,args:[e.toString(),t.id.toString()]},className:"text-danger"}]}},io=function(e){return{application:s.VIDEOS,action:i.Videos.EDIT_VIDEO,args:[e.id]}};function ao(e){var t=e.playlistId,n=no(p.useState(),2),r=n[0],a=n[1],o=no(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.PLAYLIST);!function(e,t,n){Object(f.useBulkFetch)([Nr.getPlaylistFetchOptions(e,t),Nr.getPlaylistVideosFetchOptions(e,n)],[e])}(t,a,s);return p.createElement(p.Fragment,null,p.createElement(Kr,{playlistId:t,activeAction:i.Playlists.EDIT_PLAYLIST_VIDEOS}),p.createElement(ut,{object:r}),!!c&&p.createElement(Ut,{onSortEnd:function(e,n){if(c.data&&c.data[e]){xr(c.data,e,n,(function(e,n){u.reorderVideos(t,n),s((function(t){return{data:e,pagination:t.pagination}}))}))}},videos:c,getVideoAppLink:io,getVideoActions:ro(t),emptyMessage:"There are no videos in this playlist."}))}function oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function co(){var e=oo(p.useState(),2),t=e[0],n=e[1],r=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)($.getCurrentUserFetchOptions(n),[]);return p.createElement(p.Fragment,null,!!t&&p.createElement(Br,{savePlaylist:function(e,n){return r.createPlaylist(e,t.id,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.PLAYLISTS,action:i.Playlists.EDIT_PLAYLIST,args:[t.id]})}}(n),n)}}))}function so(e){return(so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function uo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function po(e,t){return!t||"object"!==so(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function fo(e){return(fo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mo(e,t){return(mo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bo=function(e){return"/api/master/v2/objects/".concat(e)},yo=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},vo=function(e){function t(){return uo(this,t),po(this,fo(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mo(e,t)}(t,e),n=t,(r=[{key:"getVideo",value:function(e,t,n){return this.get({resource:bo(e),eventPrefix:"".concat(a.VIDEO,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getVideosById",value:function(e,t,n){return this.get({resource:yo(e),eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"name",get:function(){return l.VIDEO}},{key:"channelName",get:function(){return u.VIDEO}}])&&lo(n.prototype,r),i&&lo(n,i),t}(f.BaseDataService),So={dataServiceName:l.VIDEO,dataChannelName:u.VIDEO},Eo={getVideoFetchOptions:function(e,t,n){return Object.assign(Object.assign({},So),{eventPrefix:"".concat(a.VIDEO,":").concat(e),fetchData:function(t){return t.getVideo(e)},setData:t,onError:n})},getVideosByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},So),{eventPrefix:"".concat(a.VIDEO,":").concat(e.join(",")),fetchData:function(t){return t.getVideosById(e)},setData:t,onError:n})}};function ho(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function go(e){var t=e.videoId,n=e.playlistId,r=e.closePopup,i=ho(p.useState(),2),a=i[0],o=i[1],c=ho(p.useState(),2),s=c[0],u=c[1],d=ho(p.useState(!1),2),b=d[0],y=d[1],v=Object(f.useService)(l.PLAYLIST);Object(f.useFetch)(Eo.getVideoFetchOptions(t,o),[t]),Object(f.useFetch)(Nr.getPlaylistFetchOptions(n,u),[n]);var S=p.useCallback((function(){y(!0),v.removeVideoFromPlaylist(n,t,r,r)}),[t,n]),E=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:S,buttonText:"Yes, remove video",isSpinnerButton:!0,showSpinner:b}],h=s&&a;return p.createElement(m.Popup,{title:"Remove Video",closePopup:r,showLoadingSpinner:!h},!!h&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,a.name)," from ",p.createElement("strong",null,s.name),"?")),p.createElement(m.PopupButtons,{buttons:E})))}function Oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var jo=function(e,t,n){return[{variant:"link",onClick:t,buttonText:"Cancel"},{variant:"danger",onClick:e,buttonText:"Yes, delete this audience",isSpinnerButton:!0,showSpinner:n}]};function To(e){var t=e.id,n=e.routeToOnDelete,r=e.closePopup,i=Oo(p.useState(),2),a=i[0],o=i[1],c=Oo(p.useState(!1),2),s=c[0],u=c[1],d=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(Xi.getAudienceFetchOptions(t,o),[t]);return p.createElement(m.Popup,{title:"Delete Audience",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:jo((function(){u(!0);d.deleteAudience(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)}),r,s)})))}function Co(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Io=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function Ao(e){var t=e.presentationId,n=e.audienceId,r=Co(p.useState(),2),i=r[0],a=r[1],o=Co(p.useState(),2),c=o[0],s=o[1],u=Co(p.useState(),2),m=u[0],d=u[1],b=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(Xi.getAudienceFetchOptions(n,a),[n]),Object(f.useFetch)(Xi.getLevelsFetchOptions(s),[]),Object(f.useFetch)(Xi.getPresentationFetchOptions(t,d),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:Io(t),backToName:"audiences"})),!!m&&p.createElement("h6",null,"Presentation: ".concat(m.name)),!!i&&!!c&&p.createElement(aa,{audience:i,levels:c,saveAudience:function(e,r){return b.updateAudience(n,Object.assign(Object.assign({},e),{presentationId:t}),r,r)},presentationId:t}))}function Po(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Lo=function(e){return function(t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,t.masterId]}}},No=function(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_AUDIENCE,args:[e]}},ko={application:s.SUBJECTS,action:i.Subjects.AUDIENCES};function wo(e){var t=e.presentationId,n=Po(p.useState(),2),r=n[0],i=n[1];return Object(f.useFetch)(Xi.getAudiencesFetchOptions(t,i),[]),p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-3"},p.createElement(Ie,{appLink:ko,backToName:"presentations"})),p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select an audience to edit:"),p.createElement(m.AppLink,{appLink:No(t),className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Audience"))),p.createElement(ft,{objects:r,getAppLink:Lo(e.presentationId),emptyMessage:"There are no audiences in this presentation yet. Click '+ New Audience' to create one."}))}function Do(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Fo=function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]}};function _o(e){var t=e.presentationId,n=Do(p.useState(),2),r=n[0],a=n[1],o=Do(p.useState(),2),c=o[0],u=o[1],m=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(Xi.getLevelsFetchOptions(a),[]),Object(f.useFetch)(Xi.getPresentationFetchOptions(t,u),[t]);return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2"},p.createElement(Ie,{appLink:Fo(t),backToName:"audiences"})),!!c&&p.createElement("h6",null,"Presentation: ".concat(c.name)),!!r&&p.createElement(aa,{levels:r,presentationId:t,saveAudience:function(e,n){return m.createAudience(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_AUDIENCE,args:[e,n.masterId]})}}(t,n),n)}}))}function Ro(e){return{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}}function xo(e){return[{label:"Add child",getAppLink:function(t){return Object.assign(Object.assign({},Ro(e)),{args:[e],params:{parentId:t.id}})}},{label:"Delete classification",getAppLink:function(t){return{application:s.SUBJECTS,action:i.Subjects.DELETE_CLASSIFICATION,args:[e,t.id]}},className:"text-danger"}]}var Uo=n(18),Vo=n.n(Uo);function Bo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Jo(e){var t=e.presentationId,n=e.selectedClassificationId,r=Bo(p.useState(),2),a=r[0],o=r[1],c=Bo(p.useState(),2),u=c[0],l=c[1];return function(e,t,n){var r=Xi.getClassificationTreeFetchOptions(e,t),i=Xi.getPresentationFetchOptions(e,n);Object(f.useBulkFetch)([r,i],[e])}(t,o,l),p.createElement("div",{className:"".concat(Vo.a.navContainer," h-auto pr-2 border-right")},!!u&&p.createElement("h6",{className:"border-bottom pb-2"},"Classifications (".concat(u.name,")")),p.createElement(m.AppLink,{appLink:Ro(t),className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Classification")),!!a&&p.createElement("div",{className:"border-top pt-1"},p.createElement(ht,{tree:a,getAppLink:function(e){return function(e,t){return{application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,t.id]}}(t,e)},selectedIds:[n],actions:xo(t)})))}function Mo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ho(e){var t=e.classificationId,n=e.routeToOnDelete,r=e.closePopup,i=Mo(p.useState(),2),a=i[0],o=i[1],c=Mo(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(Xi.getClassificationFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteClassification(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this classification",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Classification",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?")),p.createElement(m.PopupButtons,{buttons:b})))}function Yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function qo(e){var t=e.presentationId,n=e.classificationId,r=Yo(p.useState(),2),i=r[0],a=r[1],o=Yo(p.useState(),2),c=o[0],s=o[1],u=Yo(p.useState(),2),m=u[0],d=u[1],b=Yo(p.useState(),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT),E=Xi.getClassificationFetchOptions(n,a),h=Xi.getPresentationFetchOptions(t,s),g=Xi.getClassificationTreeFetchOptions(t,d),O=Xi.getSubjectTreeFetchOptions(v);Object(f.useFetch)(O,[]),Object(f.useFetch)(E,[n]),Object(f.useBulkFetch)([h,g],[t]);return p.createElement("div",null,p.createElement(Ea,{presentation:c,classificationId:n}),!!i&&!!m&&!!y&&p.createElement(va,{classification:i,presentationId:t,subjectTree:y,classificationTree:m,saveClassification:function(e,t){return S.updateClassification(n,e,t,t)}}))}function Ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function zo(e){var t=e.presentationId,n=e.classificationId,r=e.memberType,i=Ko(p.useState(),2),a=i[0],o=i[1],c=Ko(p.useState(),2),s=c[0],u=c[1],m=Ko(p.useState(),2),d=m[0],b=m[1];Object(f.useFetch)(Xi.getPresentationFetchOptions(t,o),[]),Object(f.useFetch)(Xi.getClassificationFetchOptions(n,u),[n]),Object(f.useFetch)(Xi.getClassificationMembersFetchOptions(n,r,b),[n,r]);var y=Object(f.useService)(l.SUBJECT),v={items:d&&d.data,memberType:r,classification:s,updatePinnedVideo:function(e,t){var r=Object.assign(Object.assign({},s),{pinnedVideoMasterId:e});y.updateClassification(n,r,t)},getItemAppLink:function(e){return ei.getMemberAppLink(r,e.id)},getActions:function(e){return ei.getMemberActions(n,Jr.Classification,r,e.id)}},S={presentation:a,classificationId:n},E=Ue(v);return p.createElement(p.Fragment,null,p.createElement(Ea,Object.assign({},S,{memberType:r})),E&&p.createElement(ma,Object.assign({},v)))}function Wo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Go(e){var t=e.presentationId,n=e.parentId,r=Wo(p.useState(),2),a=r[0],o=r[1],c=Wo(p.useState(),2),u=c[0],m=c[1],d=Object(f.useService)(l.SUBJECT),b=Xi.getClassificationTreeFetchOptions(t,o),y=Xi.getSubjectTreeFetchOptions(m);Object(f.useFetch)(y,[]),Object(f.useFetch)(b,[t]);return p.createElement("div",null,p.createElement("h4",{className:"py-2"},"Create New Classification"),!!u&&!!a&&p.createElement(va,{classification:n?{parentIds:[n]}:{},presentationId:t,subjectTree:u,classificationTree:a,saveClassification:function(e,n){return d.createClassification(Object.assign(Object.assign({},e),{presentationId:t}),function(e,t){return function(n){t(),n&&n.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]})}}(t,n),n)}}))}function Zo(e){return(Zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $o(e,t){return!t||"object"!==Zo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ec(e){return(ec=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tc(e,t){return(tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var nc=function(e){return"/api/master/v2/objects/".concat(e,"?query=thumbnail,poster,banner")},rc=function(e){return"/api/master/v2/objects?".concat(e.map((function(e){return"id=".concat(e)})).join("&"))},ic=function(){return"/api/master/v2/series"},ac=function(e){return"/api/master/v2/objects/".concat(e)},oc=function(e){function t(){return Qo(this,t),$o(this,ec(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tc(e,t)}(t,e),n=t,(r=[{key:"getSeries",value:function(e,t,n){return this.get({resource:nc(e),eventPrefix:"".concat(a.SERIES,":").concat(e),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"getSeriesById",value:function(e,t,n){return this.get({resource:rc(e),eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),expiryTime:m.CacheDurations.STANDARD,callback:t,errorCallback:n})}},{key:"createSeries",value:function(e,t,n){var r,i=this;this.chain().create({resource:ic(),data:e,callback:function(e){return r=e},errorCallback:n,eventPrefix:a.SERIES,expiryTime:m.CacheDurations.STANDARD,errorHandler:this.alertService.error("Failed to create series.")}).func((function(){r&&r.id&&i.update({resource:ac(r.id),data:{permissions:Re()},callback:t,eventPrefix:a.SERIES,successHandler:i.alertService.success("Successfully created series")})})).run()}},{key:"updateSeries",value:function(e,t,n,r){this.update({resource:ac(e),data:t,callback:n,errorCallback:r,eventPrefix:"".concat(a.UPDATE_SERIES,":").concat(e),invalidationKeys:["".concat(a.SERIES,":").concat(e),a.SERIES_BY_ID],expiryTime:m.CacheDurations.STANDARD,successHandler:this.alertService.success("Successfully updated series"),errorHandler:this.alertService.error("Failed to update series")})}},{key:"name",get:function(){return l.SERIES}},{key:"channelName",get:function(){return u.SERIES}}])&&Xo(n.prototype,r),i&&Xo(n,i),t}(f.BaseDataService),cc={dataServiceName:l.SERIES,dataChannelName:u.SERIES},sc={getSeriesFetchOptions:function(e,t,n){return Object.assign(Object.assign({},cc),{eventPrefix:"".concat(a.SERIES,":").concat(e),fetchData:function(t){return t.getSeries(e)},setData:t,onError:n})},getSeriesByIdFetchOptions:function(e,t,n){return Object.assign(Object.assign({},cc),{eventPrefix:"".concat(a.SERIES_BY_ID,":").concat(e.join(",")),fetchData:function(t){return t.getSeriesById(e)},setData:t,onError:n})}};function uc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var lc=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ei.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function pc(e){var t=e.classificationId,n=e.memberId,r=e.memberType,i=e.closePopup,a=uc(p.useState(),2),o=a[0],c=a[1],s=uc(p.useState(),2),u=s[0],d=s[1],b=uc(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Mr.Playlists:return Nr.getPlaylistFetchOptions(t,n);case Mr.Series:return sc.getSeriesFetchOptions(t,n);case Mr.Videos:return Eo.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(Xi.getClassificationFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ei.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"This will not remove it from the backbone subject.")),p.createElement(m.PopupButtons,{buttons:lc(i,(function(){v(!0),S.removeObjectsFromClassification(t,[n],r,null,null,i,i),o.pinnedVideoMasterId===n&&S.updateClassification(t,Object.assign(Object.assign({},o),{pinnedVideoMasterId:null}))}),r,y)})))}function fc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function mc(e){var t=e.id,n=fc(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(Xi.getLevelFetchOptions(t,i),[t]);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Level"),!!r&&p.createElement(ja,{level:r,saveLevel:function(e,n){return a.updateLevel(t,e,n,n)}}))}function dc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var bc=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[e.id]}},yc={application:s.SUBJECTS,action:i.Subjects.NEW_LEVEL};function vc(){var e=dc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(Xi.getLevelsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a level to edit:"),p.createElement(m.AppLink,{appLink:yc,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Level"))),p.createElement(ft,{objects:t,getAppLink:bc}))}function Sc(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Level"),p.createElement(ja,{saveLevel:function(t,n){return e.createLevel(t,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_LEVEL,args:[t.id]})}}(n),n)}}))}function Ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function hc(e){var t=e.id,n=Ec(p.useState(),2),r=n[0],i=n[1],a=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(Xi.getPresentationFetchOptions(t,i),[t]);var o={presentation:r,savePresentation:function(e,n){var r=n.setSubmitting;return a.updatePresentation(t,e,(function(){return r(!1)}),(function(){return r(!1)}))}},c=Ue(o);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Edit Presentation"),!!c&&p.createElement(Aa,Object.assign({},o)))}function gc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Oc=function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]}},jc={application:s.SUBJECTS,action:i.Subjects.NEW_PRESENTATION};function Tc(){var e=gc(p.useState(),2),t=e[0],n=e[1];return Object(f.useFetch)(Xi.getPresentationsFetchOptions(n),[]),p.createElement("div",null,p.createElement("div",{className:"d-flex justify-content-between mb-2"},p.createElement("h5",{className:"d-inline-block m-0"},"Select a presentation to edit:"),p.createElement(m.AppLink,{appLink:jc,className:"d-block"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Presentation"))),p.createElement(ft,{objects:t,getAppLink:Oc}))}function Cc(){var e=Object(f.useService)(l.SUBJECT);return p.createElement(p.Fragment,null,p.createElement("h4",{className:"py-2"},"Create New Presentation"),p.createElement(Aa,{savePresentation:function(t,n){var r=n.setSubmitting;e.createPresentation(t,(function(e){return function(e,t){t(!1),e&&e.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_PRESENTATION,args:[e.id]})}(e,r)}),(function(){return r(!1)}))}}))}function Ic(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ac(e){var t=e.objectType,n=e.getAppLink,r=Ic(p.useState(),2),i=r[0],a=r[1];return Object(f.useFetch)(Xi.getPresentationsFetchOptions(a),[]),p.createElement("div",null,p.createElement("h5",null,p.createElement(m.Text,{namespace:"subjects.selectPresentation",phrase:"heading",options:{objectType:t}})),p.createElement(ft,{objects:i,getAppLink:n}))}function Pc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function Lc(e,t){var n=e.memberType,r=e.objectIds,i=Xi.getSubjectTreeFetchOptions(Pc(t,"subjectTree"));Object(f.useFetch)(i,[]);var a=function(e,t,n){switch(e){case Mr.Playlists:return Nr.getPlaylistsByIdFetchOptions(t,n);case Mr.Series:return sc.getSeriesByIdFetchOptions(t,n);case Mr.Videos:return Eo.getVideosByIdFetchOptions(t,n)}}(n,r,Pc(t,"objects"));Object(f.useFetch)(a,[n,r])}function Nc(e,t,n,r){var a=n.selectedSubject,o=n.objects,c=function(){return Pc(r,"showConfirmationPopup")(!1)};e.addObjectsToSubject(a.id,o.map((function(e){return e.id})),t.memberType,n.addToClassifications,(function(){c(),f.Core.AppLinkHelper.trigger(function(e,t){var n={application:s.SUBJECTS,args:[e]};switch(t){case Mr.Playlists:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_PLAYLISTS});case Mr.Series:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_SERIES});case Mr.Videos:return Object.assign(Object.assign({},n),{action:i.Subjects.EDIT_SUBJECT_VIDEOS})}}(a.id,t.memberType))}),c)}function kc(e,t,n){if(t&&n){var r=1===t.length?"this ".concat(ei.singularizeMemberType(e)):"these ".concat(e);return"Add ".concat(r," to ").concat(n.name)}}function wc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Dc=function(e,t){return function(n,r,i){i(),Pc(t,"selectedSubject")(Me.find(e.subjectTree,f.ArrayHelper.first(n))),Pc(t,"addToClassifications")(r),Pc(t,"showConfirmationPopup")(!0)}};function Fc(e){var t=wc(p.useState({}),2),n=t[0],r=t[1],i=Object(f.useService)(l.SUBJECT);Lc(e,r);var a;return p.createElement(p.Fragment,null,!!n.objects&&!!n.subjectTree&&p.createElement(La,{memberType:e.memberType,objects:n.objects,subjectTree:n.subjectTree,onClickAddToSubject:Dc(n,r)}),n.showConfirmationPopup&&p.createElement(m.ConfirmationPopup,{title:kc(e.memberType,n.objects,n.selectedSubject),onClickConfirm:function(){return Nc(i,e,n,r)},closePopup:function(){return e=!1,Pc(r,"showConfirmationPopup")(e);var e}},p.createElement("p",null,"The following ".concat(e.memberType," will be added to "),p.createElement("strong",null,n.selectedSubject.name),n.addToClassifications?" and its mapped classifications:":":"),p.createElement("ul",null,n.objects.map((function(e){return p.createElement("li",{key:e.id},e.name)}))),!n.addToClassifications&&p.createElement("p",null,"".concat(1===n.objects.length?"It":"They"," will not be added to its mapped classifications.")),p.createElement("p",null,"".concat((a=e.memberType,Be(ei.singularizeMemberType(a)))," to classification mappings can be managed from the "),p.createElement("strong",null,"Edit Subject ".concat(Be(e.memberType)," ")),"page.")))}function _c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Rc(e){var t=e.subjectId,n=e.routeToOnDelete,r=e.closePopup,i=_c(p.useState(),2),a=i[0],o=i[1],c=_c(p.useState(!1),2),s=c[0],u=c[1];Object(f.useFetch)(Xi.getSubjectFetchOptions(t,o),[]);var d=Object(f.useService)(l.SUBJECT),b=[{variant:"link",onClick:r,buttonText:"Cancel"},{variant:"danger",onClick:function(){u(!0);d.deleteSubject(t,(function(){r(),n&&f.Core.AppLinkHelper.trigger(n)}),r)},buttonText:"Yes, delete this subject",isSpinnerButton:!0,showSpinner:s}];return p.createElement(m.Popup,{title:"Delete Subject",closePopup:r,showLoadingSpinner:!a},!!a&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to delete ",p.createElement("strong",null,a.name),"?"),p.createElement("p",null,"Subjects that have mapped classifications cannot be deleted.")),p.createElement(m.PopupButtons,{buttons:b})))}function xc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Uc(e){var t=e.subjectId,n=xc(p.useState(),2),r=n[0],a=n[1],o=xc(p.useState(),2),c=o[0],s=o[1],u=Object(f.useService)(l.SUBJECT),m=Xi.getSubjectFetchOptions(t,a),d=Xi.getSubjectTreeFetchOptions(s);Object(f.useFetch)(d,[]),Object(f.useFetch)(m,[t]);return p.createElement(p.Fragment,null,p.createElement(Ra,{subjectId:t,activeAction:i.Subjects.EDIT_SUBJECT}),!!r&&!!c&&p.createElement(Fa,{subject:r,subjectTree:c,saveSubject:function(e,n){return u.updateSubject(t,e,n,n)}}))}function Vc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Bc=p.createContext(void 0);function Jc(e){var t=e.children,n=Vc(p.useState(),2),r=n[0],i=n[1];return p.createElement(Bc.Provider,{value:[r,i]},t)}var Mc=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Jc,null,p.createElement(Ke,null,t)))};function Hc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Yc(e,t){return m.StateHelper.getSetStateByKey(e,t)}function qc(e,t,n){var r=e.subjectId,i=e.memberType,a=t.memberIds,o=Hc(p.useContext(Bc),1)[0];Object(f.useFetch)(Xi.getPresentationsFetchOptions(Yc(n,"presentations")),[]),Object(f.useFetch)(Xi.getSubjectMemberIdsFetchOptions(r,i,Yc(n,"memberIds")),[r,i]),Object(f.useFetch)(function(e,t,n){if(!t||!t.length)return;switch(e){case Mr.Playlists:return Nr.getPlaylistsByIdFetchOptions(t,n);case Mr.Series:return sc.getSeriesByIdFetchOptions(t,n);case Mr.Videos:return Eo.getVideosByIdFetchOptions(t,n)}}(i,a,Yc(n,"members")),[i,a],!!a&&!!a.length),Object(f.useFetch)(!!o&&Xi.getSubjectClassificationFetchOptions(r,Yc(n,"classifications"),o.id,i),[r,i,o],!!o)}var Kc=function(e,t){return function(n){var r,a=s.SUBJECTS,o=[t,n];switch(e){case Mr.Playlists:r=i.Subjects.EDIT_CLASSIFICATION_PLAYLISTS;break;case Mr.Series:r=i.Subjects.EDIT_CLASSIFICATION_SERIES;break;case Mr.Videos:r=i.Subjects.EDIT_CLASSIFICATION_VIDEOS}return{application:a,action:r,args:o}}};function zc(e){switch(e){case Mr.Playlists:return i.Subjects.EDIT_SUBJECT_PLAYLISTS;case Mr.Series:return i.Subjects.EDIT_SUBJECT_SERIES;case Mr.Videos:return i.Subjects.EDIT_SUBJECT_VIDEOS}}function Wc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Gc(e){var t=e.subjectId,n=e.memberType,r=Wc(p.useState({}),2),i=r[0],a=r[1],o=i.presentations,c=i.classifications,s=i.memberIds,u=i.membersWithClassifications,m=Wc(p.useContext(Bc),2),d=m[0],b=m[1],y=Object(f.useService)(l.SUBJECT);qc(e,i,a),function(e,t,n){var r=t.memberIds,i=t.members,a=t.classifications;p.useEffect((function(){Yc(n,"membersWithClassifications")(function(e,t,n){if(!t||!n)return;return t.map((function(t){return{id:t.id,name:t.name,classifications:n.map((function(n){return{id:n.id,selected:(r=t,i=n,!!i[e]&&!!i[e].data.filter((function(e){return e.id===r.id})).length)};var r,i}))}}))}(e.memberType,i,a))}),[i,a]),p.useEffect((function(){i&&i.length&&r&&!r.length&&Yc(n,"members")([])}),[r])}(e,i,a);var v={presentations:o,currentPresentation:d,setCurrentPresentation:b},S={members:u||[],memberType:n,getMemberAppLink:function(e){return ei.getMemberAppLink(n,e)},getActions:function(e){return ei.getMemberActions(t,Jr.Subject,n,e)},classifications:c,getClassificationAppLink:d&&Kc(n,d.id),onToggleClassification:function(e,r,i){return function(e,t,n,r,i,a,o){(o?e.addObjectsToClassification.bind(e):e.removeObjectsFromClassification.bind(e))(a,n,t,r,i)}(y,n,i?[i]:s,t,d&&d.id,e,r)}},E=!!d&&!!c;return p.createElement(p.Fragment,null,p.createElement(Ra,{subjectId:t,activeAction:zc(n)}),p.createElement(Ae.Alert,{variant:"info",className:"m-0"},"Select which ".concat(n," are shown for each classification in this subject.")+" Change the selected presentation to view different classifications."),p.createElement("div",{className:"w-50 py-2"},!!o&&p.createElement(Pa,Object.assign({},v))),E&&p.createElement(Wa,Object.assign({},S)))}function Zc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Qc(e){var t=e.parentId,n=Zc(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT),c=Xi.getSubjectTreeFetchOptions(a);Object(f.useFetch)(c,[]);var u={application:s.SUBJECTS,action:i.Subjects.PRESENTATIONS};return p.createElement(p.Fragment,null,p.createElement("div",{className:"pb-2 border-bottom"},p.createElement(Ie,{backToName:"Presentations",appLink:u})),p.createElement("h4",{className:"py-2"},"Create New Subject"),!!r&&p.createElement(Fa,{subject:{parentId:t},subjectTree:r,saveSubject:function(e,t){return o.createSubject(e,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]})}}(t),t)}}))}function Xc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var $c=function(e,t,n,r){return[{variant:"link",onClick:e,buttonText:"Cancel"},{variant:"danger",onClick:t,buttonText:"Yes, remove this ".concat(ei.singularizeMemberType(n)),isSpinnerButton:!0,showSpinner:r}]};function es(e){var t=e.subjectId,n=e.memberId,r=e.memberType,i=e.closePopup,a=Xc(p.useState(),2),o=a[0],c=a[1],s=Xc(p.useState(),2),u=s[0],d=s[1],b=Xc(p.useState(!1),2),y=b[0],v=b[1],S=Object(f.useService)(l.SUBJECT);Object(f.useFetch)(function(e,t,n){switch(e){case Mr.Playlists:return Nr.getPlaylistFetchOptions(t,n);case Mr.Series:return sc.getSeriesFetchOptions(t,n);case Mr.Videos:return Eo.getVideoFetchOptions(t,n)}}(r,n,d),[n]),Object(f.useFetch)(Xi.getSubjectFetchOptions(t,c),[t]);var E=!!o&&!!u,h="Remove ".concat(Be(ei.singularizeMemberType(r)));return p.createElement(m.Popup,{title:h,closePopup:i,showLoadingSpinner:!E},E&&p.createElement(p.Fragment,null,p.createElement("div",null,p.createElement("p",null,"Are you sure you want to remove ",p.createElement("strong",null,u.name)," from ",p.createElement("strong",null,o.name),"?"),p.createElement("p",null,"Please ensure that it is not in any classifications before removing.")),p.createElement(m.PopupButtons,{buttons:$c(i,(function(){v(!0),S.removeObjectsFromSubject(t,[n],r,i,i)}),r,y)})))}function ts(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ns(e){var t=e.subjectId,n=ts(p.useState({}),2),r=n[0];return function(e,t){var n=function(e){return m.StateHelper.getSetStateByKey(t,e)};Object(f.useFetch)(Xi.getSubjectClassificationFetchOptions(e,n("classifications")),[e]),Object(f.useFetch)(Xi.getPresentationsFetchOptions(n("presentations")),[])}(t,n[1]),p.createElement(p.Fragment,null,p.createElement(Ra,{subjectId:t,activeAction:i.Subjects.SUBJECT_CLASSIFICATIONS}),p.createElement(Ja,{presentations:r.presentations,classificationDictionary:f.ArrayHelper.groupBy(r.classifications,"presentationId")}))}var rs=n(19),is=n.n(rs);function as(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function os(e){var t=e.selectedSubjectId,n=as(p.useState(),2),r=n[0],a=n[1];Object(f.useFetch)(Xi.getSubjectTreeFetchOptions(a),[]);var o=p.useCallback((function(e){return{application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[e.id]}}),[]),c={application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},u=[{label:"Add child",getAppLink:function(e){return Object.assign(Object.assign({},c),{params:{parentId:e.id}})}},{label:"Delete subject",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.DELETE_SUBJECT,args:[e.id]}},className:"text-danger"}];return p.createElement("div",{className:"".concat(is.a.navContainer," h-auto pr-2 border-right")},p.createElement("h5",{className:"border-bottom pb-2"},"Subjects"),p.createElement(m.AppLink,{appLink:c,className:"d-inline-block pb-2"},p.createElement(m.SvgContainer,{svgName:m.cvSvgLibrary.Plus,size:m.SvgContainerSize.Small}),p.createElement("span",null,"New Subject")),!!r&&p.createElement("div",{className:"border-top pt-1"},p.createElement(ht,{tree:r,getAppLink:o,selectedIds:[t],actions:u})))}function cs(e){var t=e.currentAppLink;return p.createElement(Ga,{navItems:ti(),currentAppLink:t})}function ss(e){return(ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function us(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ls(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ps(e,t,n){return t&&ls(e.prototype,t),n&&ls(e,n),e}function fs(e,t){return!t||"object"!==ss(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ms(e){return(ms=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ds(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bs(e,t)}function bs(e,t){return(bs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ys=function(e){function t(){return us(this,t),fs(this,ms(t).apply(this,arguments))}return ds(t,e),ps(t,[{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"appRoutes",get:function(){return{"manage/playlists(/)":"index","manage/playlists/new(/)":"newPlaylist","manage/playlists/:id(/)":"editPlaylist","manage/playlists/:id/videos(/)":"editPlaylistVideos","manage/playlists/:id/subjects(/)":"editPlaylistSubjects","manage/playlists/:id/audiences(/)":"editPlaylistAudiences"}}},{key:"appLinks",get:function(){return["deletePlaylist","removeVideo","uploadImage","removeFromSubject"]}}]),t}(f.Core.AppRouter),vs=function(e){function t(){return us(this,t),fs(this,ms(t).apply(this,arguments))}return ds(t,e),ps(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"index",value:function(){this.navigate("/dashboards/playlists")}},{key:"newPlaylist",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(co,null))}},{key:"editPlaylist",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Wr,{key:e,playlistId:e}))}},{key:"editPlaylistVideos",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ao,{key:e,playlistId:e}))}},{key:"editPlaylistSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(to,{key:e,playlistId:e}))}},{key:"editPlaylistAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Xa,{key:e,playlistId:e}))}},{key:"deletePlaylist",value:function(e){var t=Object.assign({playlistId:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(_r,Object.assign({},t)))}},{key:"removeVideo",value:function(e,t){var n=Object.assign({playlistId:e,videoId:t},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(go,Object.assign({},n)))}},{key:"removeFromSubject",value:function(e,t){var n=Object.assign({subjectId:t,memberId:e,memberType:Mr.Playlists},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(es,Object.assign({},n)))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(wr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Xt.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"navigate",value:function(e){f.Core.LocationUtils.PageLoad(e)}},{key:"name",get:function(){return"Playlists Application"}},{key:"channelName",get:function(){return s.PLAYLISTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Dr}}}}],[{key:"router",get:function(){return ys}}]),t}(f.Core.Application),Ss=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},Es=Ee.object().shape({name:Ee.string().trim().max(255,"Name is too long").required("Name is required").default(""),description:Ee.string().trim().max(65535,"Description is too long").default(""),poster:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown(),banner:Ee.object().shape({fileId:Ee.string(),fileIdType:Ee.mixed(),url:Ee.string()}).default({}).noUnknown()}).noUnknown(),hs=function(e,t){var n=s.SERIES,r=i.Series,a=[{label:"Edit Series Details",appLink:{application:n,action:r.EDIT_SERIES,args:[t]}},{label:"Videos",appLink:{application:n,action:r.EDIT_SERIES_VIDEOS,args:[t]}}];return xe(e)&&a.push.apply(a,[{label:"Subjects",appLink:{application:n,action:r.EDIT_SERIES_SUBJECTS,args:[t]}},{label:"Audiences",appLink:{application:n,action:r.EDIT_SERIES_AUDIENCES,args:[t]}}]),a};function gs(e){var t=Object(ge.useFormikContext)(),n=Object(m.useCanSubmitForm)(t);return p.createElement(ge.Form,null,p.createElement(m.FormField,{label:"Name",type:"text",name:"name",id:"name",value:t.values.name,placeholder:"Enter a name for this series",autoFocus:!0}),p.createElement(m.FormField,{label:"Description",type:"textarea",name:"description",id:"description",value:t.values.description,placeholder:"Describe this series here"}),p.createElement(tt,{imageType:m.ImageType.Posters,currentImage:t.values.poster,setNewImage:function(e){return t.setFieldValue("poster",e)},application:s.SERIES,uploadAction:i.Series.UPLOAD_IMAGE}),p.createElement(tt,{imageType:m.ImageType.Banners,currentImage:t.values.banner,setNewImage:function(e){return t.setFieldValue("banner",e)},application:s.SERIES,uploadAction:i.Playlists.UPLOAD_IMAGE}),p.createElement("div",{className:"d-flex justify-content-between align-items-center"},p.createElement(m.SpinnerButton,{showSpinner:t.isSubmitting,type:"submit",disabled:!n},e.id?"Save":"Create"),!!e.actions&&p.createElement(m.Actions,{actions:e.actions})))}function Os(e){return p.createElement(m.FormWrapper,{initialValues:e.series,validationSchema:Es,onSubmit:e.saveSeries},p.createElement(gs,{id:e.series&&e.series.id}))}var js=function(e){return function(t){return t.appLink.action===e}};function Ts(e){var t=e.seriesId,n=e.activeAction,r=p.useContext(Ge);return p.createElement("div",{className:"py-2"},!!r&&p.createElement(mt,{tabs:hs(r,t),isItemActive:js(n)}))}function Cs(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Is(e){var t=e.seriesId,n=Cs(p.useState(),2),r=n[0],a=n[1],o=Object(f.useService)(l.SERIES);Object(f.useFetch)(sc.getSeriesFetchOptions(t,a),[t]);return p.createElement(p.Fragment,null,p.createElement(Ts,{seriesId:t,activeAction:i.Series.EDIT_SERIES}),!!r&&p.createElement(Os,{series:r,saveSeries:function(e,n){return o.updateSeries(t,e,n,n)}}))}function As(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ps(e){var t=e.seriesId,n=As(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([sc.getSeriesFetchOptions(e,r("series")),Xi.getObjectLevelsFetchOptions(e,Mr.Series,r("seriesLevels"))],[e]),Object(f.useFetch)(Xi.getObjectAudiencesFetchOptions(e,Mr.Series,r("seriesAudiences")),[e,t.seriesLevels]),Object(f.useBulkFetch)([Xi.getPresentationsFetchOptions(r("presentations")),Xi.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Za(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.seriesLevels&&r.seriesAudiences);return p.createElement(p.Fragment,null,p.createElement(Ts,{seriesId:t,activeAction:i.Series.EDIT_SERIES_AUDIENCES}),p.createElement(ut,{object:r.series}),!!c&&p.createElement(ca,{objectLevels:r.seriesLevels,objectAudiences:r.seriesAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Mr.Series,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Mr.Series,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Mr.Series,n,n)}}))}function Ls(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ns(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function ks(e){var t=e.seriesId,n=Ls(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Xi.getSubjectTreeFetchOptions(r("subjectTree")),Xi.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([sc.getSeriesFetchOptions(e,r("series")),Xi.getObjectSubjectsFetchOptions(e,Mr.Series,r("seriesSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.seriesSubjects]);var i=function(e,t){return[].concat(Ns(t.subjectClassifications||[]),Ns(e))},a=t.seriesSubjects&&t.seriesSubjects.map((function(e){return Xi.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.seriesSubjects],!!a),Object(f.useFetch)(Xi.getObjectClassificationsFetchOptions(e,Mr.Series,r("seriesClassifications")),[e,t.seriesSubjects])}(t,r,a),Za(r,a);var c=!!(r.seriesSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.seriesClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(Ts,{seriesId:t,activeAction:i.Series.EDIT_SERIES_SUBJECTS}),p.createElement(ut,{object:r.series}),c&&p.createElement(ka,{objectSubjects:r.seriesSubjects,subjectTree:r.subjectTree,memberType:Mr.Series,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.seriesClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Mr.Series,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Mr.Series,n,n)}}))}function ws(){var e=Object(f.useService)(l.SERIES);return p.createElement(Os,{saveSeries:function(t,n){return e.createSeries(t,function(e){return function(t){e(),t&&t.id&&f.Core.AppLinkHelper.trigger({application:s.SERIES,action:i.Series.EDIT_SERIES,args:[t.id]})}}(n),n)}})}function Ds(e){return(Ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rs(e,t,n){return t&&_s(e.prototype,t),n&&_s(e,n),e}function xs(e,t){return!t||"object"!==Ds(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Us(e){return(Us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vs(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bs(e,t)}function Bs(e,t){return(Bs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Js=function(e){function t(){return Fs(this,t),xs(this,Us(t).apply(this,arguments))}return Vs(t,e),Rs(t,[{key:"channelName",get:function(){return s.SERIES}},{key:"appRoutes",get:function(){return{"manage/series/new(/)":"newSeries","manage/series/:id(/)":"editSeries","manage/series/:id/videos(/)":"editSeriesVideos","manage/series/:id/subjects(/)":"editSeriesSubjects","manage/series/:id/audiences(/)":"editSeriesAudiences"}}},{key:"appLinks",get:function(){return["uploadImage"]}}]),t}(f.Core.AppRouter),Ms=function(e){function t(){return Fs(this,t),xs(this,Us(t).apply(this,arguments))}return Vs(t,e),Rs(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"newSeries",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ws,null))}},{key:"editSeries",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Is,{seriesId:e}))}},{key:"editSeriesVideos",value:function(e){f.Core.LocationUtils.Redirect("/manage/legacy/series/".concat(e),!0)}},{key:"editSeriesSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ks,{seriesId:e}))}},{key:"editSeriesAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ps,{seriesId:e}))}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(wr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Xt.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Series Application"}},{key:"channelName",get:function(){return s.SERIES}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Ss}}}}],[{key:"router",get:function(){return Js}}]),t}(f.Core.Application);function Hs(e){return(Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ys(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ks(e,t,n){return t&&qs(e.prototype,t),n&&qs(e,n),e}function zs(e,t){return!t||"object"!==Hs(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ws(e){return(Ws=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Gs(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zs(e,t)}function Zs(e,t){return(Zs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qs=function(e){function t(){return Ys(this,t),zs(this,Ws(t).apply(this,arguments))}return Gs(t,e),Ks(t,[{key:"channelName",get:function(){return s.SUBJECTS}},{key:"appRoutes",get:function(){return{"manage/subjects(/)":"subjects","manage/subjects/add-objects(/)":"addSubjectMembers","manage/subjects/new(/)":"newSubject","manage/subjects/:id/edit(/)":"editSubject","manage/subjects/:id/edit/playlists(/)":"editSubjectPlaylists","manage/subjects/:id/edit/series(/)":"editSubjectSeries","manage/subjects/:id/edit/videos(/)":"editSubjectVideos","manage/subjects/:id/classifications(/)":"subjectClassifications","manage/subjects/classifications(/)":"classifications","manage/subjects/presentations/:id/classifications(/)":"presentationClassifications","manage/subjects/presentations/:id/classifications/new(/)":"newClassification","manage/subjects/presentations/:id/classifications/:id/edit(/)":"editClassification","manage/subjects/presentations/:id/classifications/:id/edit/playlists(/)":"editClassificationPlaylists","manage/subjects/presentations/:id/classifications/:id/edit/series(/)":"editClassificationSeries","manage/subjects/presentations/:id/classifications/:id/edit/videos(/)":"editClassificationVideos","manage/subjects/levels(/)":"levels","manage/subjects/levels/new(/)":"newLevel","manage/subjects/levels/:id(/)":"editLevel","manage/subjects/audiences(/)":"audiences","manage/subjects/presentations/:id/audiences(/)":"presentationAudiences","manage/subjects/presentations/:id/audiences/new(/)":"newAudience","manage/subjects/presentations/:id/audiences/:id/edit(/)":"editAudience","manage/subjects/presentations(/)":"presentations","manage/subjects/presentations/new":"newPresentation","manage/subjects/presentations/:id(/)":"editPresentation"}}},{key:"appLinks",get:function(){return["deleteClassification","removeClassificationMember","deleteSubject","removeSubjectMember","deleteAudience","uploadImage"]}}]),t}(f.Core.AppRouter),Xs=function(e){function t(){return Ys(this,t),zs(this,Ws(t).apply(this,arguments))}return Gs(t,e),Ks(t,[{key:"initialize",value:function(){var e=this;this.subjectDataService=f.InstanceManager.getInstance(l.SUBJECT,this),f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"subjects",value:function(){this.subjectDataService.getSubjectTree((function(e){var t=!!e.children&&e.children[0];t?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_SUBJECT,args:[t.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT},{replace:!0})}))}},{key:"newSubject",value:function(e){var t={parentId:e.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Qc,Object.assign({key:e.parentId},t))),this.renderSubjectsLeftNav()}},{key:"editSubject",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Uc,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"editSubjectPlaylists",value:function(e){var t={subjectId:e,memberType:Mr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Gc,Object.assign({key:"".concat(e,":playlists")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectSeries",value:function(e){var t={subjectId:e,memberType:Mr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Gc,Object.assign({key:"".concat(e,":series")},t))),this.renderSubjectsLeftNav(e)}},{key:"editSubjectVideos",value:function(e){var t={subjectId:e,memberType:Mr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Gc,Object.assign({key:"".concat(e,":videos")},t))),this.renderSubjectsLeftNav(e)}},{key:"subjectClassifications",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(ns,{key:e,subjectId:e})),this.renderSubjectsLeftNav(e)}},{key:"addSubjectMembers",value:function(e){var t=e.memberType,n=e.objectIds;if(t&&n){var r={memberType:t,objectIds:Array.isArray(n)?n:[n]};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Fc,Object.assign({},r))),this.hideLeftNav()}}},{key:"removeSubjectMember",value:function(e,t,n){var r=Object.assign({subjectId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(es,Object.assign({},r)))}},{key:"deleteSubject",value:function(e){var t=e.toString()===this.currentLeftNavId.toString()?{application:s.SUBJECTS,action:i.Subjects.NEW_SUBJECT}:null,n=Object.assign({subjectId:e,routeToOnDelete:t||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Rc,Object.assign({},n)))}},{key:"classifications",value:function(){var e={objectType:"classifications",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_CLASSIFICATIONS,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ac,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationClassifications",value:function(e){this.subjectDataService.getClassificationTree(e,(function(t){var n=!!t.children&&t.children[0];n?f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.EDIT_CLASSIFICATION,args:[e,n.id]},{replace:!0}):f.Core.AppLinkHelper.trigger({application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]},{replace:!0})}))}},{key:"newClassification",value:function(e,t){var n={presentationId:e,parentId:t.parentId};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Go,Object.assign({key:t.parentId},n))),this.renderClassificationLeftNav(e)}},{key:"editClassification",value:function(e,t){var n={presentationId:e,classificationId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(qo,Object.assign({key:t},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationPlaylists",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Mr.Playlists};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(zo,Object.assign({key:"".concat(t,":playlists")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationSeries",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Mr.Series};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(zo,Object.assign({key:"".concat(t,":series")},n))),this.renderClassificationLeftNav(e,t)}},{key:"editClassificationVideos",value:function(e,t){var n={presentationId:e,classificationId:t,memberType:Mr.Videos};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(zo,Object.assign({key:"".concat(t,":videos")},n))),this.renderClassificationLeftNav(e,t)}},{key:"removeClassificationMember",value:function(e,t,n){var r=Object.assign({classificationId:e,memberId:t,memberType:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(pc,Object.assign({},r)))}},{key:"deleteClassification",value:function(e,t){var n=t===this.currentLeftNavId?{application:s.SUBJECTS,action:i.Subjects.NEW_CLASSIFICATION,args:[e]}:null,r=Object.assign({classificationId:t,routeToOnDelete:n||null},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(Ho,Object.assign({},r)))}},{key:"levels",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(vc,null)),this.hideLeftNav()}},{key:"newLevel",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Sc,null)),this.hideLeftNav()}},{key:"editLevel",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(mc,{key:e,id:e})),this.hideLeftNav()}},{key:"audiences",value:function(){var e={objectType:"audiences",getAppLink:function(e){return{application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e.id]}}};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ac,Object.assign({},e))),this.hideLeftNav()}},{key:"presentationAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(wo,{presentationId:e})),this.hideLeftNav()}},{key:"newAudience",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(_o,{presentationId:e})),this.hideLeftNav()}},{key:"editAudience",value:function(e,t){var n={presentationId:e,audienceId:t};this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Ao,Object.assign({key:t},n))),this.hideLeftNav()}},{key:"deleteAudience",value:function(e,t){var n={application:s.SUBJECTS,action:i.Subjects.PRESENTATION_AUDIENCES,args:[e]},r=Object.assign({id:t,routeToOnDelete:n},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(To,Object.assign({},r)))}},{key:"presentations",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Tc,null)),this.hideLeftNav()}},{key:"newPresentation",value:function(){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(Cc,null))}},{key:"editPresentation",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(hc,{key:e,id:e})),this.hideLeftNav()}},{key:"uploadImage",value:function(e){var t=Object.assign({imageType:e},this.getPopupProps());this.layout.showChildView(m.LayoutRegions.POPUP,p.createElement(wr,Object.assign({},t)))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Xt.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"renderClassificationLeftNav",value:function(e,t){this.setCurrentLeftNavItem(t);var n={presentationId:e,selectedClassificationId:t};this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(Jo,Object.assign({},n)))}},{key:"renderSubjectsLeftNav",value:function(e){this.setCurrentLeftNavItem(e),this.layout.showChildView(m.LayoutRegions.LEFT_NAV,p.createElement(os,{selectedSubjectId:e}))}},{key:"setCurrentLeftNavItem",value:function(e){this.currentLeftNavId=e||null}},{key:"hideLeftNav",value:function(){this.setCurrentLeftNavItem(),this.layout.hideLeftNav()}},{key:"getTopNav",value:function(e){return p.createElement(cs,{currentAppLink:e})}},{key:"getPopupProps",value:function(){var e=this;return{closePopup:function(){return e.layout.closePopup()}}}},{key:"name",get:function(){return"Subjects Application"}},{key:"channelName",get:function(){return s.SUBJECTS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:Mc,getTopNavView:this.getTopNav}}}}],[{key:"router",get:function(){return Qs}}]),t}(f.Core.Application),$s=function(e){var t=e.children;return p.createElement(Ze,null,p.createElement(Ke,null,t))},eu=function(e){var t=s.VIDEOS,n=i.Videos;return[{label:"Edit Video Details",appLink:{application:t,action:n.EDIT_VIDEO,args:[e]}},{label:"Subjects",appLink:{application:t,action:n.EDIT_VIDEO_SUBJECTS,args:[e]}},{label:"Audiences",appLink:{application:t,action:n.EDIT_VIDEO_AUDIENCES,args:[e]}}]},tu=function(e){return function(t){return t.appLink.action===e}};function nu(e){var t=e.videoId,n=e.activeAction;return p.createElement("div",{className:"py-2"},p.createElement(mt,{tabs:eu(t),isItemActive:tu(n)}))}function ru(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function iu(e){var t=e.videoId,n=ru(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Eo.getVideoFetchOptions(e,r("video")),Xi.getObjectLevelsFetchOptions(e,Mr.Videos,r("videoLevels"))],[e]),Object(f.useFetch)(Xi.getObjectAudiencesFetchOptions(e,Mr.Videos,r("videoAudiences")),[e,t.videoLevels]),Object(f.useBulkFetch)([Xi.getPresentationsFetchOptions(r("presentations")),Xi.getLevelsFetchOptions(r("levels"))],[]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getAudiencesFetchOptions(t.currentPresentation.id,r("presentationAudiences")),[t.currentPresentation],!!t.currentPresentation)}(t,r,a),Za(r,a);var c=!!(r.presentations&&r.levels&&r.presentationAudiences&&r.videoLevels&&r.videoAudiences);return p.createElement(p.Fragment,null,p.createElement(nu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_AUDIENCES}),p.createElement(ut,{object:r.video}),!!c&&p.createElement(ca,{objectLevels:r.videoLevels,objectAudiences:r.videoAudiences,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),levels:r.levels,presentationAudiences:r.presentationAudiences,memberType:Mr.Videos,saveLevels:function(e,n,r){return o.updateObjectLevels(t,e,Mr.Videos,n,r,r)},saveAudiences:function(e,n){return o.updateObjectAudiences(t,r.currentPresentation.id,e,Mr.Videos,n,n)}}))}function au(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ou(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function cu(e){var t=e.videoId,n=au(p.useState({}),2),r=n[0],a=n[1],o=Object(f.useService)(l.SUBJECT);!function(e,t,n){var r=function(e){return m.StateHelper.getSetStateByKey(n,e)};Object(f.useBulkFetch)([Xi.getSubjectTreeFetchOptions(r("subjectTree")),Xi.getPresentationsFetchOptions(r("presentations"))],[]),Object(f.useBulkFetch)([Eo.getVideoFetchOptions(e,r("video")),Xi.getObjectSubjectsFetchOptions(e,Mr.Videos,r("videoSubjects"))],[e]),Object(f.useFetch)(!!t.currentPresentation&&Xi.getClassificationTreeFetchOptions(t.currentPresentation.id,r("classificationTree")),[t.currentPresentation],!!t.currentPresentation),p.useEffect((function(){return r("subjectClassifications")([])}),[t.videoSubjects]);var i=function(e,t){return[].concat(ou(t.subjectClassifications||[]),ou(e))},a=t.videoSubjects&&t.videoSubjects.map((function(e){return Xi.getSubjectClassificationFetchOptions(e.id,m.StateHelper.getSetStateByKey(n,"subjectClassifications",i))}));Object(f.useBulkFetch)(a,[t.videoSubjects],!!a),Object(f.useFetch)(Xi.getObjectClassificationsFetchOptions(e,Mr.Videos,r("videoClassifications")),[e,t.videoSubjects])}(t,r,a),Za(r,a);var c=!!(r.videoSubjects&&r.subjectTree&&r.presentations&&r.classificationTree&&r.videoClassifications&&r.subjectClassifications);return p.createElement(p.Fragment,null,p.createElement(nu,{videoId:t,activeAction:i.Videos.EDIT_VIDEO_SUBJECTS}),p.createElement(ut,{object:r.video}),c&&p.createElement(ka,{objectSubjects:r.videoSubjects,subjectTree:r.subjectTree,memberType:Mr.Videos,presentations:r.presentations,currentPresentation:r.currentPresentation,setCurrentPresentation:m.StateHelper.getSetStateByKey(a,"currentPresentation"),objectClassifications:r.videoClassifications,objectSubjectClassifications:r.subjectClassifications,classificationTree:r.classificationTree,saveSubjects:function(e,n,r){return o.updateObjectSubjects(t,e,Mr.Videos,n,r,r)},saveClassifications:function(e,n){return o.updateObjectClassifications(t,r.currentPresentation.id,e,Mr.Videos,n,n)}}))}function su(e){return(su="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function uu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function pu(e,t,n){return t&&lu(e.prototype,t),n&&lu(e,n),e}function fu(e,t){return!t||"object"!==su(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function mu(e){return(mu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function du(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bu(e,t)}function bu(e,t){return(bu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var yu=function(e){function t(){return uu(this,t),fu(this,mu(t).apply(this,arguments))}return du(t,e),pu(t,[{key:"channelName",get:function(){return s.VIDEOS}},{key:"appRoutes",get:function(){return{"manage/videos/:id(/)":"editVideo","manage/videos/:id/audiences(/)":"editVideoAudiences","manage/videos/:id/subjects(/)":"editVideoSubjects"}}}]),t}(f.Core.AppRouter),vu=function(e){function t(){return uu(this,t),fu(this,mu(t).apply(this,arguments))}return du(t,e),pu(t,[{key:"initialize",value:function(){var e=this;f.ObjectHelper.values(l).forEach((function(t){return f.InstanceManager.getInstance(t,e)}))}},{key:"editVideo",value:function(e){f.Core.LocationUtils.Redirect("/tools/programlookup/".concat(e))}},{key:"editVideoAudiences",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(iu,{videoId:e}))}},{key:"editVideoSubjects",value:function(e){this.layout.showChildView(m.LayoutRegions.CONTENT,p.createElement(cu,{videoId:e}))}},{key:"onShowAlert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.collection,n=t?t.toJSON():[],r=function(e){return Xt.Radio.channel(f.CommonChannels.ALERT).trigger("remove:alert",e)};this.layout.showChildView(m.LayoutRegions.ALERT,p.createElement(m.AlertList,{alerts:n,removeAlert:r}))}},{key:"name",get:function(){return"Videos Application"}},{key:"channelName",get:function(){return s.VIDEOS}},{key:"layoutOptions",get:function(){return{name:c.CURATOR_LAYOUT,options:{provider:$s}}}}],[{key:"router",get:function(){return yu}}]),t}(f.Core.Application);n.d(t,"Actions",(function(){return i})),n.d(t,"DataPrefixes",(function(){return a})),n.d(t,"FileExtensions",(function(){return o})),n.d(t,"Layouts",(function(){return c})),n.d(t,"AppChannels",(function(){return s})),n.d(t,"DataChannels",(function(){return u})),n.d(t,"DataServices",(function(){return l})),n.d(t,"CuratorLayoutView",(function(){return T})),n.d(t,"LayoutComponent",(function(){return L})),n.d(t,"CuratorAppNavService",(function(){return x})),n.d(t,"ImageUploadDataService",(function(){return Y})),n.d(t,"UserDataService",(function(){return Q})),n.d(t,"UserDataServiceHelper",(function(){return $})),n.d(t,"LanguageDataService",(function(){return oe})),n.d(t,"CompaniesApplication",(function(){return Qt})),n.d(t,"DomainOptionsApplication",(function(){return xn})),n.d(t,"PeopleApplication",(function(){return fr})),n.d(t,"PlaylistDataService",(function(){return Pr})),n.d(t,"PlaylistDataServiceHelper",(function(){return Nr})),n.d(t,"PlaylistsApplication",(function(){return vs})),n.d(t,"SeriesDataService",(function(){return oc})),n.d(t,"SeriesDataServiceHelper",(function(){return sc})),n.d(t,"SeriesApplication",(function(){return Ms})),n.d(t,"SubjectDataService",(function(){return Zi})),n.d(t,"SubjectDataServiceHelper",(function(){return Xi})),n.d(t,"SubjectsApplication",(function(){return Xs})),n.d(t,"VideoDataService",(function(){return vo})),n.d(t,"VideoDataServiceHelper",(function(){return Eo})),n.d(t,"VideosApplication",(function(){return vu}))}])}));
|