@clickview/library-editor 1.45.1-rc.0 → 1.45.1
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/bundles.json +2 -2
- package/dist/css/101-library-editor-5af6f4e937.chunk.css +2 -0
- package/dist/css/2696-library-editor-4a7e07523b.chunk.css +77 -0
- package/dist/css/3746-library-editor-d4c68a200b.chunk.css +1 -0
- package/dist/css/3778-library-editor-e7f11db43a.chunk.css +12 -0
- package/dist/css/456-library-editor-e9cac790d6.chunk.css +17 -0
- package/dist/css/5524-library-editor-36f0a42508.chunk.css +11 -0
- package/dist/css/5891-library-editor-d4c68a200b.chunk.css +1 -0
- package/dist/css/61-library-editor-af56e745db.chunk.css +47 -0
- package/dist/css/6963-library-editor-d4c68a200b.chunk.css +1 -0
- package/dist/css/8614-library-editor-5368f03ffe.chunk.css +16 -0
- package/dist/css/library-editor-app-899160fa5a.css +62 -0
- package/dist/css/{library-editor-app-ccb23413ae.css → library-editor-app-fbeb5c3df6.css} +2 -2
- package/dist/languages/en.json +1 -1
- package/dist/scripts/101-dd5f891259.chunk.js +1 -0
- package/dist/scripts/{1010-60f6dfd832.chunk.js → 1010-78c730c3d3.chunk.js} +1 -1
- package/dist/scripts/{1086-2682e6d3f7.chunk.js → 1086-bf7355e402.chunk.js} +1 -1
- package/dist/scripts/{112-24c19e2cde.chunk.js → 112-9f396668ac.chunk.js} +1 -1
- package/dist/scripts/{1216-f3e3f911fa.chunk.js → 1216-7c3584c6ee.chunk.js} +1 -1
- package/dist/scripts/{1269-a34a1de36d.chunk.js → 1269-99208bcecc.chunk.js} +1 -1
- package/dist/scripts/{1409-93a72ff5bf.chunk.js → 1409-a161f8245a.chunk.js} +1 -1
- package/dist/scripts/{1601-6eb85a794d.chunk.js → 1601-879d0665e7.chunk.js} +2 -2
- package/dist/scripts/{1703-a320de79f3.chunk.js → 1703-63ad0b3ce1.chunk.js} +1 -1
- package/dist/scripts/{1832-23fead57c5.chunk.js → 1832-882ab67791.chunk.js} +1 -1
- package/dist/scripts/{1876-2b788843ab.chunk.js → 1876-42c5fe7a33.chunk.js} +1 -1
- package/dist/scripts/{2417-1ee31c4281.chunk.js → 2417-a7f6defb26.chunk.js} +1 -1
- package/dist/scripts/{243-2012c53e96.chunk.js → 243-e21d40c982.chunk.js} +1 -1
- package/dist/scripts/{2482-955e4b3615.chunk.js → 2482-b7ad002b09.chunk.js} +1 -1
- package/dist/scripts/{259-7d1d480f6e.chunk.js → 259-671fc59e31.chunk.js} +1 -1
- package/dist/scripts/{2601-d973ed65dc.chunk.js → 2601-c4230f3cfd.chunk.js} +1 -1
- package/dist/scripts/{2644-485d14740b.chunk.js → 2644-4815c4b278.chunk.js} +1 -1
- package/dist/scripts/{2692-438539ccbe.chunk.js → 2692-92122fb3d2.chunk.js} +1 -1
- package/dist/scripts/2696-c93bc6ba82.chunk.js +2 -0
- package/dist/scripts/{2888-55edc16fd6.chunk.js → 2888-2c0a5591ef.chunk.js} +1 -1
- package/dist/scripts/{299-eeaac48864.chunk.js → 299-9ab1d59d5c.chunk.js} +1 -1
- package/dist/scripts/{2998-24191bc8ab.chunk.js → 2998-234d4e79d4.chunk.js} +1 -1
- package/dist/scripts/3087-31652fd164.chunk.js +1 -0
- package/dist/scripts/{3400-95d7a3a0d6.chunk.js → 3400-48eceba386.chunk.js} +1 -1
- package/dist/scripts/{343-bb56a70dd3.chunk.js → 343-6d71f27a71.chunk.js} +1 -1
- package/dist/scripts/{35-7bfbab50e6.chunk.js → 35-3e0fe9666f.chunk.js} +1 -1
- package/dist/scripts/{3551-5513258594.chunk.js → 3551-5456900410.chunk.js} +1 -1
- package/dist/scripts/3746-092214a0a0.chunk.js +1 -0
- package/dist/scripts/{376-98c734f74f.chunk.js → 376-7e5af8f053.chunk.js} +1 -1
- package/dist/scripts/{3763-c5de5a36a1.chunk.js → 3763-64dc73b8c4.chunk.js} +1 -1
- package/dist/scripts/3778-60cf0a97d4.chunk.js +1 -0
- package/dist/scripts/{4201-6311ac5cac.chunk.js → 4201-228a2b8d76.chunk.js} +1 -1
- package/dist/scripts/{4245-6e9e71cc7d.chunk.js → 4245-cacf193d02.chunk.js} +1 -1
- package/dist/scripts/456-a1c2432237.chunk.js +1 -0
- package/dist/scripts/{4591-9e342f97bc.chunk.js → 4591-c798b9d80a.chunk.js} +1 -1
- package/dist/scripts/{4860-955b4bf901.chunk.js → 4860-f770422186.chunk.js} +1 -1
- package/dist/scripts/{5046-19d7090284.chunk.js → 5046-432362ee4e.chunk.js} +1 -1
- package/dist/scripts/{514-927a43219d.chunk.js → 514-20644e0a4e.chunk.js} +1 -1
- package/dist/scripts/{5185-5a358c555d.chunk.js → 5185-48169130b8.chunk.js} +2 -2
- package/dist/scripts/{5286-293188ce69.chunk.js → 5286-f967ae444b.chunk.js} +1 -1
- package/dist/scripts/{5412-95152820bb.chunk.js → 5412-e675c4ef4e.chunk.js} +1 -1
- package/dist/scripts/{5418-f31f79952c.chunk.js → 5418-dce1baab7a.chunk.js} +1 -1
- package/dist/scripts/{5424-f53a7d8068.chunk.js → 5424-50632a5025.chunk.js} +1 -1
- package/dist/scripts/5524-3ecfd1675f.chunk.js +1 -0
- package/dist/scripts/{5707-41f283fd98.chunk.js → 5707-bc3c7af0c0.chunk.js} +1 -1
- package/dist/scripts/{5747-0ab2cc3678.chunk.js → 5747-d8ee53162d.chunk.js} +1 -1
- package/dist/scripts/5850-5f1fb603a9.chunk.js +1 -0
- package/dist/scripts/5891-b72da0591f.chunk.js +1 -0
- package/dist/scripts/{6093-7e5c1af050.chunk.js → 6093-7fe8c7fcce.chunk.js} +1 -1
- package/dist/scripts/61-1aa3a1edbc.chunk.js +2 -0
- package/dist/scripts/{61-4f8774cf32.chunk.js → 61-ad1f6f5f42.chunk.js} +2 -2
- package/dist/scripts/61-ad1f6f5f42.chunk.js.LICENSE.txt +1 -0
- package/dist/scripts/{6352-aaaf02499b.chunk.js → 6352-bbe31ba815.chunk.js} +1 -1
- package/dist/scripts/6721-b31c7b97e8.chunk.js +1 -0
- package/dist/scripts/{6732-5bf9ec4e56.chunk.js → 6732-35dcc7a725.chunk.js} +1 -1
- package/dist/scripts/{6774-3cad51b5b7.chunk.js → 6774-5af5e4b0b8.chunk.js} +1 -1
- package/dist/scripts/6963-386c2153af.chunk.js +1 -0
- package/dist/scripts/{7002-3686f9dcfb.chunk.js → 7002-8564980898.chunk.js} +1 -1
- package/dist/scripts/{7053-38535c04ca.chunk.js → 7053-79f4e3e275.chunk.js} +1 -1
- package/dist/scripts/{7071-5a543a7eec.chunk.js → 7071-a0cb4a599c.chunk.js} +1 -1
- package/dist/scripts/{708-9aa6428a97.chunk.js → 708-0c400838a2.chunk.js} +1 -1
- package/dist/scripts/{7295-594d2f2def.chunk.js → 7295-aa334844a4.chunk.js} +1 -1
- package/dist/scripts/{7376-baac126511.chunk.js → 7376-34e0848b6f.chunk.js} +1 -1
- package/dist/scripts/{7408-35779961a6.chunk.js → 7408-64e0468c04.chunk.js} +1 -1
- package/dist/scripts/{8213-ef3077d565.chunk.js → 8213-0a91276442.chunk.js} +1 -1
- package/dist/scripts/{8362-e82bef3e07.chunk.js → 8362-9fa19d6e1e.chunk.js} +1 -1
- package/dist/scripts/8542-727d658bd8.chunk.js +1 -0
- package/dist/scripts/8614-d2aae15910.chunk.js +2 -0
- package/dist/scripts/8614-d2aae15910.chunk.js.LICENSE.txt +1 -0
- package/dist/scripts/{8726-edded1064e.chunk.js → 8726-b262387b6e.chunk.js} +1 -1
- package/dist/scripts/{8727-2e314f9301.chunk.js → 8727-2a68455289.chunk.js} +1 -1
- package/dist/scripts/{8762-4ee15995c8.chunk.js → 8762-63efbfcfa7.chunk.js} +1 -1
- package/dist/scripts/{8906-3bde92a78d.chunk.js → 8906-5592870e17.chunk.js} +1 -1
- package/dist/scripts/{9357-c5c5984ec8.chunk.js → 9357-2b5993c1b5.chunk.js} +1 -1
- package/dist/scripts/{9383-51cb65e6f7.chunk.js → 9383-7d95ed4d9b.chunk.js} +1 -1
- package/dist/scripts/{9695-a04e508364.chunk.js → 9695-694c2d9147.chunk.js} +1 -1
- package/dist/scripts/{9927-a667775ac4.chunk.js → 9927-8b7265b00a.chunk.js} +1 -1
- package/dist/scripts/bundle-59de85bc08.min.js +2 -0
- package/dist/scripts/bundle-59de85bc08.min.js.LICENSE.txt +1 -0
- package/dist/scripts/bundle-6c5a619a82.min.js +2 -0
- package/dist/scripts/bundle-6c5a619a82.min.js.LICENSE.txt +1 -0
- package/package.json +72 -72
- package/typings/libs/CVEvents.d.ts +12 -12
- package/typings/libs/CVLanguages.d.ts +24 -24
- package/typings/libs/Environment.d.ts +10 -10
- package/typings/libs/LazyLoad.d.ts +29 -29
- package/typings/libs/LazyLoad.ts +27 -27
- package/typings/libs/backbone.validation.d.ts +99 -99
- package/typings/libs/cloneDeep.d.ts +4 -4
- package/typings/libs/cookiesjs.d.ts +24 -24
- package/typings/libs/draft-convert.d.ts +3 -3
- package/typings/libs/google-api.d.ts +4 -4
- package/typings/libs/microsoft-teams.d.ts +2 -2
- package/typings/libs/trackjs.d.ts +2 -2
- package/typings/libs/videojs-contrib-quality-levels.d.ts +30 -30
- package/typings/utils/imports.d.ts +9 -9
- package/dist/scripts/bundle-6798e69f7b.min.js +0 -2
- /package/dist/scripts/{1601-6eb85a794d.chunk.js.LICENSE.txt → 1601-879d0665e7.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{5185-5a358c555d.chunk.js.LICENSE.txt → 2696-c93bc6ba82.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{61-4f8774cf32.chunk.js.LICENSE.txt → 5185-48169130b8.chunk.js.LICENSE.txt} +0 -0
- /package/dist/scripts/{bundle-6798e69f7b.min.js.LICENSE.txt → 61-1aa3a1edbc.chunk.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 2696-c93bc6ba82.chunk.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[2696],{23689:function(e,t,n){"use strict";n.d(t,{i:function(){return d}});var r=n(1024),i=n(48088),o=n(52765),a=n(11306),c=n(21679),s=n(53808),l={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,l=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(s.q.isFunction(l)){if(s.q.isFunction(u)){var p=f&&s.q.isFunction(f),h=c.u.getInstance(n),v=i.Radio.channel(h.channelName),m="".concat(r,":request"),y="".concat(r,":sync"),g="".concat(r,":error"),b="".concat(r,":invalidate"),w=d&&"".concat(d,":sync"),E=function(){return t(!1)},S=function(){return t(!0)},k=function(){return t(!1)},x=function(){return v.off(b,k)};v.once(m,E),v.once(y,S),v.once(b,k),p&&v.once(g,f),w&&v.once(w,x);var O=l(h);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),v.off(m,E),v.off(y,S),v.off(b,k),p&&v.off(g,f),w&&v.off(w,x)}}o.Ry.throw(new a.H("A setData function must be passed to fetch"))}else o.Ry.throw(new a.H("A fetchData function must be passed to fetch"))}};function u(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n,i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=(n=r.useState(!1),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,i)||u(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],s=a[1];r.useEffect((function(){s(!1)}),function(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t)),r.useEffect((function(){if(o)return l.fetch(e,s)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return l}});var r=n(1024),i=n(53808),o=n(17439),a=n(63946),c=n(31709),s=n(12704);function l(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],l=[];t.forEach((function(e){e.button?n.push(e):l.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||l.length?r.createElement("div",{className:u},r.createElement(r.Fragment,null,r.createElement("span",{className:"d-flex align-items-center"},n.length?n.map((function(e,t){return r.createElement(r.Fragment,{key:t},function(){if(e.label){var t=i.q.isFunction(e.label)?e.label:function(){return r.createElement(r.Fragment,null,e.label)};return r.createElement(c.K,{appLink:e.appLink,href:e.href,onClick:e.onClick,svgName:e.svgName,className:e.className,tooltip:e.tooltip,showSpinner:e.showSpinner,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,openInNewTab:e.openInNewTab,disabled:e.disabled},t())}var n=r.createElement(o.h,{appLink:e.appLink,href:e.href,onClick:e.onClick,svgName:e.svgName,className:e.className,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,openInNewTab:e.openInNewTab,disabled:e.disabled});return e.tooltip?r.createElement(a.u,{title:e.tooltip,spanHack:!0},n):n}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,l.length?r.createElement(s.m,{actions:l,dropdownToggleClassName:e.actionsDropdownClassName,dropdownToggleSvgSize:e.dropdownToggleSvgSize,fetchMore:e.fetchMore}):r.createElement(r.Fragment,null)))):r.createElement(r.Fragment,null)}},12704:function(e,t,n){"use strict";n.d(t,{m:function(){return m}});var r=n(1024),i=n(53808),o=n(31647),a=n(97874),c=n(52076),s=n(49642),l=n(39396),u=n(63946),f=n(63791),d={dropdownToggle:"UCAnJ"};function p(){return r.createElement(r.Fragment,null,r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"8rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"12rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"11rem"}})),r.createElement("div",{style:{padding:"0.53125rem 1rem"}},r.createElement("div",{className:"partial-loading-background",style:{height:"1.0625rem",width:"9rem"}})))}function h(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function v(e){var t=i.q.isFunction(e.action.label)?e.action.label:function(){return r.createElement(r.Fragment,null,e.action.label)};if(e.action.appLink)return r.createElement(s.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:h(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(l.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t()));function n(t){t.preventDefault(),e.action.analyticsData&&e.action.analyticsOptions&&c.k.logUserAction(e.action.analyticsData,e.action.analyticsOptions),i.q.isFunction(e.action.onClick)&&e.action.onClick(),e.action.href&&o.Q.Ab.PageLoad(e.action.href,e.action.openInNewTab)}return e.action.href?r.createElement("a",{className:h(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(l.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2 align-middle"}),r.createElement("span",{className:"align-middle"},t())):r.createElement("span",{className:"cursor-pointer ".concat(h(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(l.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2"}),t())}function m(e){if(!e.actions||!e.actions.length)return r.createElement(r.Fragment,null);var t=e.actions.some((function(e){return e.lazyPlaceholder})),n="dropdown";e.className&&(n+=" ".concat(e.className));var i,o="actions-dropdown-".concat(a.Y.getRandomInt()),c="dropdown-toggle px-0 ".concat(d.dropdownToggle);return e.dropdownToggleClassName&&(c+=" ".concat(e.dropdownToggleClassName)),r.createElement("div",{className:n},r.createElement("button",{className:c,type:"button",id:o,"data-bs-toggle":"dropdown","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",onClick:t?e.fetchMore:null},r.createElement(l.x,{svgName:f.vn.More,size:e.dropdownToggleSvgSize})),r.createElement("div",{className:"dropdown-menu dropdown-menu-end dropdown-menu-right","aria-labelledby":o},t?r.createElement(p,null):e.actions.map((function(e,t){var n=void 0!==i&&i!==e.group;return i=e.group,e.tooltip?r.createElement(r.Fragment,{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(u.u,{title:e.tooltip,spanHack:!0},r.createElement(v,{action:e}))):r.createElement(r.Fragment,{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(v,{action:e}))}))))}m.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:l.S.Small}},41087:function(e,t,n){"use strict";n.d(t,{C:function(){return m},g:function(){return l}});var r,i=n(1024),o=n(57857),a=n(39396),c=n(63946),s=n(50028);!function(e){e.Exchange="exchange",e.Streamable="streamable",e.MoviesAndTv="movies_and_tv",e.Twig="twig"}(r||(r={}));var l,u=n(27866),f=n(45428),d=n(63791),p=n(21974),h=n(7121),v=o.T.encloseNamespace("shared.badges");function m(e){var t=e.type,n=e.data;if(!function(e,t){var n,r;return"boolean"==typeof t?!!t:e===l.Rating?t&&!!t.value:e===l.Interactive?!!(null==t?void 0:t.length)||!!(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.length):e===l.Captions?!!(null==t?void 0:t.length)||!!(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.length):e===l.Status?"number"==typeof t:!!t}(t,n))return i.createElement(i.Fragment,null);var o=function(e,t){var n,i="";if(e===l.DurationApproximate&&(i="duration-badge-new px-2 rounded-pill text-nowrap d-flex align-items-center"),e===l.DurationExact&&(i="duration-badge"),e===l.Interactive&&(i="interactive-badge"),e===l.Rating&&(i="rating-badge ".concat(p.u.mapRatingToClass(t.value))),e===l.ProductionYear&&(i="production-year-badge"),e===l.Captions)return"p-0";if(e===l.Status)return"badge ".concat(function(e){switch(e){case s.X.Published:return"bg-success";case s.X.Archived:case s.X.Rejected:return"bg-danger";case s.X.Draft:return"draft-badge px-2 rounded-pill text-nowrap d-flex align-items-center";case s.X.Pending:case s.X.Processing:return"bg-warning"}}(t));if(e===l.Trending)return"trending-badge px-2 d-flex align-items-center";if(e===l.Count&&(i="count-badge px-1 rounded"),e===l.Restriction){var o=f.l.mapRestrictionToClass(t.restrictions);return"restriction-badge rounded-pill px-2 d-flex align-items-center ".concat(o)}return e===l.Source&&(i=(n=t).includes(r.Streamable)?"px-1 text-nowrap d-flex align-items-center ".concat(h.Z.streamable):n.includes(r.MoviesAndTv)?"bg-indigo text-white px-1 text-nowrap d-flex align-items-center":n.includes(r.Exchange)?"bg-orange text-white px-1 text-nowrap d-flex align-items-center":n.includes(r.Twig)?"bg-pink text-white px-1 text-nowrap d-flex align-items-center":""),"".concat("badge"," ").concat(i)}(t,n);o="".concat(o," ").concat(e.inline?"d-inline-block":"d-flex justify-content-center"," ").concat(e.className||"");var m=function(e,t){if(e===l.Interactive)return v("interactive");if(e===l.DurationApproximate)return u.T.ToDisplayDurationNewStyle(t);if(e===l.DurationExact)return u.T.ToDisplayDuration(t);if(e===l.Rating)return t.code;if(e===l.ProductionYear)return t;if(e===l.Captions)return i.createElement(a.x,{svgName:d.vn.CloseCaptionBadge});if(e===l.Status)return s.X[t];if(e===l.Trending)return i.createElement(i.Fragment,null,i.createElement(a.x,{svgName:d.vn.Trending}),i.createElement("span",{className:"ps-1"},t));if(e===l.Count)return t;if(e===l.Restriction)return i.createElement(i.Fragment,null,i.createElement(a.x,{svgName:f.l.mapRestrictionToSvg(t.restrictions)}),i.createElement("span",null,f.l.mapRestrictionToText(t.restrictions,t.yearGroups)));if(e===l.Source){var n=t;return n.includes(r.Streamable)?"streamable":n.includes(r.MoviesAndTv)?"movies + tv":n.includes(r.Exchange)?"exchange":n.includes(r.Twig)?"twig":"-"}}(t,n),y=function(e,t){return e===l.Rating?{title:t.name,placement:"top"}:null}(t,n),g=e.inline&&"d-inline-block";return y?i.createElement("div",{className:"badge-wrapper d-inline"},i.createElement(c.u,Object.assign({},y,{spanHack:!0,spanHackClassName:g}),i.createElement("span",{className:o},m))):i.createElement("span",{className:"".concat(o," badge-wrapper")},m)}!function(e){e.DurationExact="duration-exact",e.DurationApproximate="duration-approximate",e.Interactive="interactive",e.Rating="rating",e.ProductionYear="production-year",e.Captions="captions",e.Status="status",e.Trending="trending",e.Count="count",e.Restriction="restriction",e.Source="source"}(l||(l={}))},41777:function(e,t,n){"use strict";n.d(t,{u:function(){return d}});var r=n(1024),i=n.n(r),o=n(53808),a=n(31647),c=n(52076),s=n(49642),l=n(17439);function u(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?i().createElement(l.h,{className:t,onClick:e.onClick,appLink:e.appLink,svgName:e.icon,href:e.href,openInNewTab:e.openInNewTab,disabled:e.disabled},e.text):!e.appLink||o.q.isFunction(e.onClick)||e.disabled?e.href&&!e.disabled?i().createElement("a",{className:t,href:e.href,target:e.openInNewTab?"_blank":null},e.text):i().createElement("button",{disabled:e.disabled,onClick:function(){e.disabled||(o.q.isFunction(e.onClick)&&e.onClick(),e.appLink&&a.Q.C$.trigger(e.appLink),c.k.logUserAction(e.analyticsData,e.analyticsOptions))},className:t},e.text):i().createElement(s.F,{appLink:e.appLink,className:t,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions},e.text)}function f(e){var t;return i().createElement("img",{alt:e.altText||"",role:"presentation",src:e.src,className:"".concat("NsLci"," ").concat("small"===e.size?"h3RrK":""," ").concat(null!==(t=e.className)&&void 0!==t?t:"")})}function d(e){var t;return i().createElement("div",{className:"text-center d-flex flex-column align-items-center ".concat(null!==(t=e.className)&&void 0!==t?t:"")},e.children)}f.defaultProps={size:"medium"},d.defaultProps={className:"pt-5"},d.Image=function(e){return i().createElement(f,Object.assign({},e))},d.Cta=function(e){return i().createElement(u,Object.assign({},e))},d.Heading=function(e){return i().createElement("h2",{className:e.className||"h3"},e.children)},d.Info=function(e){return e.injectHtml?i().createElement("p",{className:e.className||"mb-3 w-50",dangerouslySetInnerHTML:{__html:e.children}}):i().createElement("p",{className:e.className||"mb-3 w-50"},e.children)}},49619:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r=n(1024),i=n(85887),o=n(49642),a=n(29267),c="fVSzb";function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var l=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,l=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,h=e.src,v=e.alt,m=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}(e,["forceLoad","extraClasses","errorFallbackImageSrc","preventLoad","errorFallbackImageClassName","src","alt"]),y=(0,a.Y)({rootMargin:"500px"}),g=y.ref,b=y.inView,w=(t=r.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=w[0],S=w[1];function k(){return E&&u?u:e.src}if(r.useEffect((function(){if((i||b)&&!d){var e=new Image;return e.onerror=function(){S(!0),u&&(e.src=u)},e.src=h,function(){return e.onerror=null}}}),[b,d]),E&&!u)return r.createElement(r.Fragment,null);if(!g)return r.createElement("img",Object.assign({className:"".concat(c," ").concat(l," ").concat(E&&p||""),alt:v,src:k()},m));var x=Object.assign(Object.assign({alt:v},m),!b&&!i||d?{src:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="}:{src:k()});return i||(x.ref=g),r.createElement("img",Object.assign({className:"".concat(c," ").concat(l," ").concat(E&&p||"")},x))})),u=n(88483),f=n(87013),d={image:"vdd4V",thumbnail:"Ez0E7",tallPoster:"H9bQA",cover:"Nudts",banner:"IOvDH",poster:"iiY56",pdf:"aDJiJ",link:"wDpui"};function p(e){var t=d.image,n="";return e.imageType===u.__.Thumbnails&&(n="thumbnail ".concat(d.thumbnail)),e.imageType===u.__.TallPosters&&(n=d.tallPoster),e.imageType===u.__.Covers&&(n=d.cover),e.imageType===u.__.Banners&&(n=d.banner),e.imageType===u.__.Posters&&(n=d.poster),e.imageType===u.__.Pdf&&(n=d.pdf),e.imageType===u.__.Link&&(n=d.link),n&&(t+=" ".concat(n)),e.className&&(t+=" ".concat(e.className)),t}function h(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,s=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,h=e.imageClassName,v=e.alt,m="";"string"==typeof t?m=t:i.t.isObject(t)&&(m=t.url);var y=m&&n?f.j.createUrl(m,n):m;return r.createElement("div",{className:p(e),style:e.imageStyle},r.createElement(o.F,{appLink:a,analyticsData:d,analyticsOptions:u,onClick:e.onClick},e.children,y&&r.createElement(l,{src:y,alt:v,forceLoad:c,preventLoad:s,extraClasses:h,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName})))}},96461:function(e,t,n){"use strict";n.d(t,{m:function(){return c}});var r=n(1024),i=n.n(r),o=n(49642),a={subText:"F_1ii",sm:"BxmrB"};function c(e){var t="text-uppercase text-truncate mb-0 ".concat(a.subText," ").concat("sm"===e.size?"".concat(a.sm," fw-normal"):""," ").concat(e.className);return e.appLink?i().createElement(o.F,{className:t,appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,title:e.title},e.children):i().createElement("div",{className:t,title:e.title},e.children)}},43803:function(e,t,n){"use strict";n.d(t,{y:function(){return h}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(50028),s=n(74421),l=n(63791),u={topLeftContainer:"iwBld",draft:"QBpxh",badge:"KcvGx",svg:"gW733",text:"QiH5Q",sm:"tn2BH"},f=o.T.encloseNamespace("shared.typeBadge");function d(e){switch(e){case s.E.Clip:return l.vn.Clip;case s.E.Interactive:return l.vn.Interactive;case s.E.Resource:return l.vn.Resources;default:return""}}function p(e,t){switch(e){case s.E.Clip:return"bg-dark-blue";case s.E.Interactive:return t===c.X.Draft?u.draft:"bg-green";case s.E.Resource:return"bg-indigo";default:return""}}function h(e){var t="".concat(u.badge," rounded-pill text-white ps-0 ").concat("sm"===e.size?u.sm:"");return i().createElement("div",{className:e.inContainer?"":u.topLeftContainer},i().createElement("div",{className:"".concat(t," ").concat(p(e.typeId,e.status))},i().createElement(a.x,{className:"svg-container d-block ".concat(u.svg),size:"sm"===e.size?a.S.Small:a.S.Standard,svgName:d(e.typeId)}),i().createElement("span",{className:u.text},function(e){switch(e){case s.E.Clip:return f("clip");case s.E.Interactive:return f("interactive");case s.E.Resource:return f("resource");default:return""}}(e.typeId))))}h.default={size:"md"}},98496:function(e,t,n){"use strict";n.d(t,{Q:function(){return d},$:function(){return m}});var r=n(1024),i=n(63151),o=n(22218),a={padNumber:function(e,t){var n=e.toString();if(n.length>=t)return n;for(t-=n.length;t>0;)n="0"+n,t--;return n}},c=n(74421),s={isSeries:function(e){return(null==e?void 0:e.typeId)===c.E.Series},buildSeriesSeasonEpisodeText:function(e,t,n){if(!e)return"";if(!t||!n)return e.toUpperCase();var r=a.padNumber(t,2),i=a.padNumber(n,2);return"".concat(e.toUpperCase()," S").concat(r," • E").concat(i)}},l=n(12927),u=n(96461),f={appLink:"yI6tx",hoverUnderline:"ehDUT"};function d(e){var t=e.video,n=t.season;if(!t.episodeNumber||!n)return r.createElement(r.Fragment,null);var i=a.padNumber(n.number,2),o=a.padNumber(t.episodeNumber,2);return r.createElement("span",{className:"d-inline-block ".concat(e.appLink?f.hoverUnderline:"")},e.withSeriesTitle&&r.createElement(r.Fragment,null," "),!!i&&"S".concat(i," • "),"E",o)}function p(e){var t=l.M.getReleaseDate(e.video);return t?l.M.hasSeries(e.video)?r.createElement(r.Fragment,null," • ".concat(t)):r.createElement(r.Fragment,null,t):r.createElement(r.Fragment,null)}function h(e){var t,n=e.appLink,a=e.video,c=e.className,h=void 0===c?"":c,v=null==a?void 0:a.series,m=l.M.getReleaseDate(e.video);if(!(null==v?void 0:v.id)&&!m)return r.createElement(r.Fragment,null);var y=(null==v?void 0:v.id)&&n&&Object.assign(Object.assign({},n),{args:[v.id,i.m.slugify(v.name)]}),g=Object.assign(Object.assign({},e.analyticsData),{id:null==v?void 0:v.id,name:null==v?void 0:v.name,videoId:null==a?void 0:a.id,videoName:null==a?void 0:a.name}),b=Object.assign(Object.assign({},e.analyticsOptions),{entity:o.py.Series,actionType:o.Vw.Click,descriptor:o._S.Title}),w=s.buildSeriesSeasonEpisodeText(null==v?void 0:v.name,null===(t=a.season)||void 0===t?void 0:t.number,a.episodeNumber);return r.createElement(u.m,{appLink:y,className:"d-block ".concat(f.appLink," ").concat(h),analyticsData:g,analyticsOptions:b,title:w},(null==v?void 0:v.name)&&v.name,r.createElement(d,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(p,Object.assign({},e)))}function v(e){var t,n,a=e.appLink,c=e.video,s=e.className,l=void 0===s?"":s,d=null===(n=null===(t=null==c?void 0:c.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0];if(!(null==d?void 0:d.id))return r.createElement(r.Fragment,null);var p=(null==d?void 0:d.id)&&a&&Object.assign(Object.assign({},a),{args:[d.id,i.m.slugify(d.name)]}),h=Object.assign(Object.assign({},e.analyticsData),{id:null==d?void 0:d.id,name:null==d?void 0:d.name,videoId:null==c?void 0:c.id,videoName:null==c?void 0:c.name}),v=Object.assign(Object.assign({},e.analyticsOptions),{entity:o.py.Company,actionType:o.Vw.Click,descriptor:o._S.Title});return r.createElement(u.m,{appLink:p,className:"d-block ".concat(f.appLink," ").concat(l),analyticsData:h,analyticsOptions:v,title:d.name},d.name)}function m(e){var t=e.type,n=void 0===t?"series":t;return"none"===n?r.createElement(r.Fragment,null):"series"===n?r.createElement(h,Object.assign({},e)):r.createElement(v,Object.assign({},e))}},24828:function(e,t,n){"use strict";n.d(t,{o:function(){return r}});var r=["bg-pink","bg-orange"].concat(["bg-green","bg-cyan","bg-teal","bg-blue","bg-indigo","bg-purple"])},99828:function(e,t,n){"use strict";n.d(t,{y:function(){return a}});var r=n(88483);function i(e){return i="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},i(e)}function o(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=o(o(o(o(o(o(o(o(o({},r.__.Thumbnails,{width:1280,height:720}),r.__.Banners,{width:1200,height:222}),r.__.Covers,{width:512,height:512}),r.__.Posters,{width:1e3,height:1500}),r.__.TallPosters,{width:1080,height:1920}),r.__.HeroBanners,{width:1920,height:640}),r.__.None,{width:1,height:1}),r.__.Avatars,{width:256,height:256}),r.__.Logos,{width:128,height:128})},8371:function(e,t,n){"use strict";var r;n.d(t,{b:function(){return r}}),function(e){e.AU="cv-ap-southeast-1",e.NZ="cv-ap-southeast-2",e.UK="cv-eu-west-1",e.US="cv-na-west-1"}(r||(r={}))},86257:function(e,t,n){"use strict";var r;n.d(t,{L:function(){return r}}),function(e){e.Pdf="pdf",e.Image="image",e.PowerPoint="powerpoint",e.Document="document",e.Excel="excel",e.Zip="archive",e.File="text"}(r||(r={}))},82378:function(e,t,n){"use strict";n.d(t,{i:function(){return o}});var r=n(1024),i=n(94223);function o(e,t){var n=e,o=t,a=(0,i.P)(e&&function(e){return n(e).key});return(0,r.useEffect)((function(){a&&a.shouldInitialFetch&&t&&o()}),[null==a?void 0:a.shouldInitialFetch,t]),(0,r.useEffect)((function(){a&&a.nextCursor&&!a.isFetching&&t&&o(a.nextCursor)}),[null==a?void 0:a.nextCursor,null==a?void 0:a.isFetching,t]),a}},32557:function(e,t,n){"use strict";n.d(t,{X:function(){return m},L:function(){return y}});var r=n(1024),i=n.n(r),o=n(53808),a=n(85887),c=function(){var e=i().useRef(!0);return i().useEffect((function(){return function(){e.current=!1}}),[]),e};function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=275,f=5,d={className:"",delay:0,style:null},p={screenX:0,screenY:0};function h(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.add(t.className)),t.style&&Object.keys(t.style).forEach((function(n){e.current.style[n]=t.style[n]})))}function v(e,t){var n;e.current&&(t.className&&(null===(n=e.current.classList)||void 0===n||n.remove(t.className)),t.style&&Object.keys(t.style).forEach((function(t){e.current.style[t]=null})))}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=c(),n=s(r.useState(e),2),i=n[0],l=n[1],u=s(r.useState(!1),2),f=u[0],p=u[1],m=r.useRef(null);r.useEffect((function(){a.t.isEqual(e,i)||l(e)}),[e]);var y=o.q.throttle((function(){h(m,i),t.current&&p(!0)}),i.delay,{leading:!1}),g=function(){o.q.isFunction(y.cancel)&&y.cancel(),v(m,i),t.current&&p(!1)};return r.useLayoutEffect((function(){var e=m.current;if(e)return e.addEventListener("mouseenter",y),e.addEventListener("mouseleave",g),function(){e.removeEventListener("mouseenter",y),e.removeEventListener("mouseleave",g)}}),[m.current,i]),[m,f]}function y(e){var t=s(r.useState(e),2),n=t[0],i=t[1],c=r.useRef(Object.assign({},p)),l=r.useRef(!1),d=r.useRef(0),m=r.useRef(null),y=s(r.useState(!1),2),g=y[0],b=y[1];function w(){d.current&&(window.clearTimeout(d.current),d.current=0)}function E(){l.current=!0}function S(e){if(l.current){var t,r,i=Object.assign({},c.current);c.current.screenX=e.screenX,c.current.screenY=e.screenY,function(e,t){return Math.abs(e.screenX-t.screenX)>f||Math.abs(e.screenY-t.screenY)>f}(i,e)&&w(),t=function(){h(m,n),b(!0)},r=n.delay||u,d.current||(d.current=window.setTimeout(t,r))}}function k(){w(),v(m,n),l.current=!1,b(!1)}return r.useEffect((function(){a.t.isEqual(e,n)||i(e)}),[e]),r.useLayoutEffect((function(){if(m.current){var e=o.q.throttle(S,25,{leading:!1});return m.current.addEventListener("mouseenter",E),m.current.addEventListener("mousemove",e),m.current.addEventListener("mouseleave",k),function(){m.current&&(m.current.removeEventListener("mouseenter",E),m.current.removeEventListener("mousemove",e),m.current.removeEventListener("mouseleave",k))}}}),[m.current,n]),[m,g]}},29267:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});var r=n(64038);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.prevent,a=n.rootMargin,c=n.triggerOnce,s=void 0===c||c,l=(e=(0,r.useInView)({triggerOnce:s,rootMargin:a}),t=3,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],f=l[1],d=l[2];return!0!==o&&void 0!==window.IntersectionObserver||(f=!0,u=null),{ref:u,inView:f,initialized:!!d}}},94223:function(e,t,n){"use strict";n.d(t,{P:function(){return u}});var r=n(1024),i=n(58566),o=n(35656),a=n(53808),c=n(86120);function s(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?s(t(e)):s(e.data)}function l(e){var t,r;if(e)return n?n(e):null===(r=null===(t=e.pagination)||void 0===t?void 0:t.cursors)||void 0===r?void 0:r.next}return(0,i.useSelector)((0,r.useMemo)((function(){return function(t){if(a.q.isFunction(e)){for(var n=e,r=a.q.isFunction(e)&&n(),i=r&&c.a.getResponse(t,r),u=i&&i.isFetching,f=i&&i.statusCode,d=i&&i.hasCompleted,p=d,h=i&&i.shouldFetch,v=o(i&&i.data),m=l(i&&i.data),y=function(e){if(e)return null==e?void 0:e.count}(i&&i.data);m&&(i=c.a.getResponse(t,n(m)),u=u||i.isFetching,f=i.statusCode,d=i.hasCompleted,!i.shouldFetch);){var g=o(i.data);g&&v.push.apply(v,s(g));var b=l(i.data);m=b===m?null:b}var w={shouldInitialFetch:h,items:v,nextCursor:m,isFetching:u,statusCode:f,hasCompleted:d,hasFirstPageCompleted:p};return"number"==typeof y&&(w.totalItems=y),w}}}),[e]))}o.o.Ok},24365:function(e,t,n){"use strict";n.r(t),n.d(t,{CropperHelper:function(){return y}});var r=n(1024),i=n.n(r),o=n(44645),a=n(51934),c=n.n(a),s=n(57857),l=n(71575),u=n(83996),f=n(99828);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var h=s.T.encloseNamespace("shared.imageCropper"),v=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function m(e){var t=d(i().useState(!1),2),n=t[0],r=t[1],o=d(i().useState(!1),2),a=o[0],s=o[1],p=i().useRef(),m=i().useRef();return i().useEffect((function(){var t=new Image;t.src=e.src;var n=p.current.offsetWidth/t.width,i=f.y[e.imageType],o={viewMode:2,autoCropArea:1,ready:function(){return r(!0)}};return i&&(o.minCropBoxWidth=i.width*n,o.minCropBoxHeight=i.height*n,o.aspectRatio=i.width/i.height),m.current=new(c())(p.current,o),function(){m.current.destroy()}}),[]),i().createElement(l.G,{title:h("title"),closePopup:e.closePopup,size:e.popupSize},i().createElement("div",null,i().createElement("img",{src:e.src,alt:e.alt,ref:p,className:"img img-fluid"})),i().createElement(u.u,null,i().createElement(u.u.Cancel,{onClick:e.closePopup}),i().createElement(u.u.Submit,{onClick:function(){if(n){var t=m.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(v);if(t)return t[1]}(e.src));s(!0),e.onClickCrop(t,e.closePopup)}},text:h("crop"),variant:"dark",showSpinner:a})))}m.defaultProps={popupSize:"lg"};var y={renderCropper:function(e){var t=(0,o.s)(document.getElementById("dialog-region"));t.render(i().createElement(m,Object.assign({},e,{closePopup:function(){return t.unmount()}})))}}},21974:function(e,t,n){"use strict";n.d(t,{u:function(){return u}});var r=n(57857),i=n(75459),o=n(86257),a=n(63791);function c(e){return c="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},c(e)}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l="shared.shared-utils",u={mapRatingToClass:function(e){return e?function(e){switch(!0){case e<32:return"bg-purple";case e<48:return"bg-green";case e<80:return"bg-blue";case e<96:return"bg-red";case e<128:return"bg-pink";case e>=128:return"bg-yellow";default:return""}}(e):""},mapSourceToDisplayName:function(e,t){switch(e.type){case i.r.HostedLibrary:case i.r.CustomLibrary:return e.name;case i.r.Exchange:return r.T.getPhrase(l,"exchange");case i.r.Workspace:return r.T.getPhrase(l,t?"myVideos":"workspace");default:return""}},mapSourceToClass:function(e){switch(e){case i.r.HostedLibrary:case i.r.CustomLibrary:return"bg-blue";case i.r.Exchange:return"bg-green";case i.r.Workspace:default:return"bg-red"}},isInteractive:function(e){var t,n;return!!(null===(n=null===(t=null==e?void 0:e.interactives)||void 0===t?void 0:t.data)||void 0===n?void 0:n.length)},mapTypeToSvg:function(e){var t=s(s(s(s(s(s(s({},o.L.Pdf,a.vn.FilePDF),o.L.Image,a.vn.FileImg),o.L.PowerPoint,a.vn.FilePowerpoint),o.L.Document,a.vn.FileWord),o.L.Excel,a.vn.FileExcel),o.L.Zip,a.vn.FileZip),o.L.File,a.vn.File)[e];return t||(t=a.vn.Folder),t},mapTypeToClass:function(e){switch(e){case o.L.Pdf:return"icon-red";case o.L.Image:return"icon-purple";case o.L.Document:return"icon-blue";case o.L.Excel:return"icon-green";case o.L.PowerPoint:return"icon-orange";case o.L.Zip:return"icon-teal";case o.L.File:return"icon-gray";default:return""}},mapTypeToExtension:function(e){return e?{pdf:"pdf",image:"png",powerpoint:"pptx"}[e.toLowerCase()]:""},mapTypeToName:function(e){if(!e)return"";switch(e){case o.L.Pdf:return r.T.getPhrase(l,"pdf");case o.L.Image:return r.T.getPhrase(l,"image");case o.L.Document:return r.T.getPhrase(l,"document");case o.L.Excel:return r.T.getPhrase(l,"spreadsheet");case o.L.PowerPoint:return r.T.getPhrase(l,"presentation");case o.L.Zip:return r.T.getPhrase(l,"zipArchive");case o.L.File:return r.T.getPhrase(l,"file");default:return""}}}},22231:function(e,t,n){"use strict";function r(e,t){return t[e.charCodeAt(0)%t.length]}n.d(t,{x:function(){return r}})},90784:function(e,t,n){"use strict";n.d(t,{x:function(){return Au}});var r=n(1024),i=n.n(r),o=n(66703),a=n(8371),c=n(12927);n(30582),n(85887);var s=i().createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),l=n(53808);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e){var t,n,o=e.view,a=e.options,c=void 0===a?{}:a,f=e.className,d=void 0===f?"":f,p=e.dependencies,h=void 0===p?[]:p,v=r.useMemo((function(){return new o(c)}),h);t=v.title,n=i().useContext(s),r.useEffect((function(){"boolean"!=typeof t&&n.setPageMetadata({title:t})}),[t]);var m=function(e,t){var n,i=r.useRef(null);return r.useEffect((function(){if(e){var t=i.current;return e.render(),t.hasChildNodes()?t.replaceChild(e.el,t.firstChild):t.appendChild(e.el),e.triggerMethod&&e.triggerMethod("attach"),e.trigger("rendered"),function(){l.q.isFunction(e.close)?e.close():l.q.isFunction(e.destroy)&&e.destroy()}}}),function(e){if(Array.isArray(e))return u(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i}(v,[v]);return o?r.createElement("div",{ref:m,className:d}):r.createElement(r.Fragment,null)}var d=n(70065),p=n(61356),h=n(64404);function v(e){var t,n=e.config.get("webPlayerUrl"),r=e.config.get("playerApiUrl");return i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(f,{view:p.c,options:{model:new h.n(e.video,{parse:!0}),analyticsOptions:{location:d.LZ.VideoRequest},currentUser:e.user,createViewKey:e.createViewKey,webPlayerUrl:n,playerApiUrl:r},dependencies:[null===(t=e.video)||void 0===t?void 0:t.id]}))}var m=n(27866),y="libraryRequests.videoDetail";function g(e){return i().createElement(i().Fragment,null,i().createElement("div",{className:"col-3"},i().createElement("label",null,i().createElement(o.x,{namespace:y,phrase:e.phrase}))),i().createElement("div",{className:"col-9 mb-3"},e.children))}function b(e){var t,n=e.clip,r=n.endTime-n.startTime;function o(e){return m.T.ToDisplayDuration(Math.floor(e))}function a(){var e;return r/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}return i().createElement(i().Fragment,null,i().createElement("p",null,m.T.ToDisplayDurationNewStyle(1e3*Math.floor(r))),i().createElement("div",{className:"overflow-hidden rounded-3 border border-light p-3"},i().createElement("div",{className:"position-relative z-1"},i().createElement("div",{className:"position-absolute w-100"},i().createElement("span",null," "),i().createElement("div",{className:"bg-light rounded-3",style:{height:10}}))),i().createElement("div",{className:"position-relative z-1",style:{left:function(){var e;return n.startTime/((null===(e=n._parentVideo)||void 0===e?void 0:e.duration)/1e3)*100+"%"}()}},i().createElement("div",{className:"d-flex justify-content-between",style:{width:a()}},i().createElement("span",null,o(1e3*n.startTime)),i().createElement("span",{className:"text-secondary"}," - "),i().createElement("span",null,o(1e3*n.endTime))),i().createElement("div",{className:"bg-blue rounded-3 px-1",style:{width:a(),height:10}})),i().createElement("div",{className:"d-flex justify-content-between text-secondary"},i().createElement("span",null,"0:00"),i().createElement("span",null,o(null===(t=n._parentVideo)||void 0===t?void 0:t.duration)))))}function w(e){var t=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),t.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},t.description)),i().createElement(g,{phrase:"duration"},i().createElement(b,{clip:t})))}var E,S=n(42648),k=n(58424),x=n(39396);!function(e){e[e.Correct=0]="Correct",e[e.Incorrect=1]="Incorrect",e[e.AwaitingMarking=2]="AwaitingMarking",e[e.Answered=3]="Answered",e[e.UnAnswered=4]="UnAnswered",e[e.NotApplicable=5]="NotApplicable"}(E||(E={}));var O=n(63791),C=n(49642),j=n(71551),N=n(58542);function P(e){if(e)return(e=function(e){if(e)return e.replace(/<a.*?>/g,"").replace("</a>","")}(e=function(e){if(e)return e.replace(/<p>/g,"").replace(/<\/p>/g,"<br>")}(e=function(e,t){if(e&&t)return t.forEach((function(t){e=e.replace("<"+t+">","").replace("</"+t+">","")})),e}(e,["b","i","u","ul","li","old"])))).split("<br>")[0]||"Annotation"}function I(e){var t=N.w.getTypeInfo(e.interaction.typeId),n=t.name,r=t.bgClassName,o=t.Svg,a=e.questionNumber?"".concat(e.questionNumber,". "):"",c="interaction-type-icon ".concat(r);return e.smallIcon&&(c+=" sm"),(e.showQuestion||e.showTypeName)&&(c+=e.smallIcon?" me-1":" me-2"),e.iconClassName&&(c+=" ".concat(e.iconClassName)),i().createElement(i().Fragment,null,!!e.showIcon&&i().createElement("span",{className:c},i().createElement(o,null)),i().createElement(C.F,{appLink:e.appLink,onClick:e.onClick},!!e.showTypeName&&i().createElement("span",{className:e.typeNameClassName},i().createElement("strong",null,a,n)),!!e.showQuestion&&i().createElement("span",{className:e.questionClassName},e.interaction.typeId===j.Z9.Annotation?i().createElement("span",{dangerouslySetInnerHTML:{__html:P(e.interaction.data.annotation)}}):e.interaction.name)))}I.defaultProps={showIcon:!0,showQuestion:!0};var T={time:"JDp5N",type:"AzIWg",question:"UhEYq",deleteContainer:"wBqoo",delete:"OAQQu",correctness:"W5sR9",selected:"tfrDf",row:"sGk59"},L="shared.interactiveQuestions";function A(e){var t=e.interaction;switch((0,e.getCorrectness)(t)){case E.Correct:return i().createElement("span",{className:"text-success"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Check}));case E.Incorrect:return i().createElement("span",{className:"text-danger"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Close}));case E.AwaitingMarking:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:L,phrase:"pending"})));case E.UnAnswered:return i().createElement("button",{className:"btn btn-outline-dark"},i().createElement(o.x,{namespace:L,phrase:"answer"}));case E.Answered:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:L,phrase:"answered"})));case E.NotApplicable:return i().createElement(i().Fragment,null)}}function _(e){var t=e.interaction,n=e.visibleAt,r=e.selectedInteractionId,o=e.goToTimepoint,a=e.scrollTo,c=e.isFirstInteraction,s=t.id.toString()===(null==r?void 0:r.toString()),l=i().useRef();i().useEffect((function(){if(s&&l.current){var e=l.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[s]);var u=o?"cursor-pointer":"cursor-default";return i().createElement("div",{ref:l},i().createElement(k.L,{className:"py-2 ".concat(u," ").concat(T.row," ").concat(s?T.selected:""),onClick:s?function(){}:function(){o&&o(t.id)}},i().createElement("span",{className:"".concat(T.time," me-2 ").concat(s?"fw-bold":"")},c?m.T.ToDisplayDuration(n):""),i().createElement(I,{interaction:t,showTypeName:!0,typeNameClassName:T.type,questionClassName:T.question}),e.onClickDelete&&i().createElement(k.L,{onClick:function(n){n.stopPropagation(),e.onClickDelete(t.id)},className:"".concat(T.deleteContainer)},i().createElement("span",{className:"text-end ".concat(T.delete)},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.Delete}))),e.getCorrectness&&i().createElement("span",{className:"text-end ".concat(T.correctness)},i().createElement(A,{interaction:t,getCorrectness:e.getCorrectness}))))}function F(e){var t=e.timepoint,n=e.scrollTo,r=e.onClickDelete,o=e.selectedInteractionId,a=e.getCorrectness;function c(n){e.goToTimepoint(t.id,n)}return t.interactions?i().createElement("div",null,t.interactions.map((function(s,l){return i().createElement(_,{interaction:s,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&c,onClickDelete:r,scrollTo:n,selectedInteractionId:o,isFirstInteraction:0===l,getCorrectness:a,key:l})}))):i().createElement(i().Fragment,null)}function D(e){var t=e.interactive,n=e.goToTimepoint,r=e.selectedInteractionId,o=e.maxHeight,a=e.onClickDelete,c=e.getCorrectness,s=i().useRef();function l(e,t){if(s.current){var n=s.current.getClientHeight(),r=s.current.getScrollTop(),i=e+r;(i<r||i+t>r+n)&&s.current.scrollTop(i-n/2+t/2)}}var u=n?"border rounded":"";return i().createElement(S.$B,{autoHeight:!0,autoHeightMax:o,className:u,hideTracksWhenNotNeeded:!0,ref:s},i().createElement("div",{className:"px-3 py-1"},t.timepoints.map((function(e,t){return i().createElement(F,{key:t,timepoint:e,goToTimepoint:n,selectedInteractionId:r,scrollTo:l,onClickDelete:a,getCorrectness:c})}))))}var R="libraryRequests.interactiveDetails";function M(e){var t=e.interactive;return i().createElement(i().Fragment,null,i().createElement("p",{className:"fw-semibold mb-2"},i().createElement(o.x,{namespace:R,phrase:"questionList",options:{length:t._timepoints.value.length}})),t._timepoints.value.map((function(e,t){return i().createElement(F,{key:t,timepoint:e})})))}function U(e){var t=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==t?void 0:t.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==t?void 0:t.name)||e.libraryRequest.name),!!t.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},t.description)),i().createElement(M,{interactive:t}))}var V=n(31647),B=n(11306),q=(n(96263),n(24910),n(94445));function G(e){return G="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},G(e)}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,z(r.key),r)}}function z(e){var t=function(e,t){if("object"!=G(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=G(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==G(t)?t:t+""}function H(e,t,n){return t=Q(t),function(e,t){if(t&&("object"==G(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,W()?Reflect.construct(t,n||[],Q(e).constructor):t.apply(e,n))}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(W=function(){return!!e})()}function K(){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Q(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},K.apply(null,arguments)}function Q(e){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Q(e)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(e,t)}var $=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=H(this,t,[e,n])).timepoint_=n.timepoint,r.time_=n.timepoint.visibleAt/1e3;var i=n.timepoint.interactions[0];i||r.hide();var o=N.w.getTypeInfo(i.typeId).bgClassName;return r.$(".vjs-icon-placeholder").classList.add(o),r.controlText(i.name),r.update(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Y(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-item ".concat(K(Q(t.prototype),"buildCSSClass",this).call(this))}},{key:"createEl",value:function(e,n,r){return K(Q(t.prototype),"createEl",this).call(this,e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),Object.assign(Object.assign({},r),{tabIndex:0}))}},{key:"update",value:function(){var e=this.player_.duration(),t=this.time_/e;this.el().style.left=100*t+"%",t>100||t<0?this.hide():this.show()}},{key:"handleClick",value:function(e){e.stopPropagation(),this.player_.currentTime(this.time_)}}],r&&Z(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("Button"));function X(e){return X="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},X(e)}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ee(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,te(r.key),r)}}function te(e){var t=function(e,t){if("object"!=X(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==X(t)?t:t+""}function ne(e,t,n){return t=oe(t),function(e,t){if(t&&("object"==X(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,re()?Reflect.construct(t,n||[],oe(e).constructor):t.apply(e,n))}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(re=function(){return!!e})()}function ie(){return ie="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=oe(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ie.apply(null,arguments)}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ae(e,t){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ae(e,t)}var ce,se=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=ne(this,t,[e,n])).track_=n.track,r.interactive_=n.interactive,r.onDurationChange=r.onDurationChange.bind(r),r.createInteractionItems=r.createInteractionItems.bind(r),r.createInteractionItems(),r.track_.on("cv:cuechange",r.createInteractionItems),r.player_.on("durationchange",r.onDurationChange),r.player_.on("dispose",(function(){r.track_.off("cv:cuechange"),r.player_.off("durationchange",r.onDurationChange)})),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ae(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(ie(oe(t.prototype),"buildCSSClass",this).call(this))}},{key:"createEl",value:function(e,n,r){return ie(oe(t.prototype),"createEl",this).call(this,e,Object.assign(Object.assign({},n),{className:this.buildCSSClass()}),r)}},{key:"update",value:function(){this.children_.forEach((function(e){e.update()}))}},{key:"createInteractionItems",value:function(){var e,t=this;if(this.track_){(function(e){return function(e){if(Array.isArray(e))return J(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()})(this.children_).forEach((function(e){t.removeChild(e)}));for(var n=0;n<this.track_.cues.length;n++){var r=this.track_.cues[n],i=this.getTimepointById(r.text);i&&(null===(e=i.interactions)||void 0===e?void 0:e.length)&&this.addChild(new $(this.player_,{timepoint:i}))}}}},{key:"onDurationChange",value:function(){this.update()}},{key:"getTimepointById",value:function(e){var t;return null===(t=this.interactive_.timepoints)||void 0===t?void 0:t.find((function(t){return t.id.toString()===e.toString()}))}}],r&&ee(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("Component"));!function(e){e[e.View=0]="View",e[e.Create=1]="Create"}(ce||(ce={}));var le=n(94878),ue={svg:"cDUaE",iconButton:"Mr0S0",iconWithText:"vHTVo",iconOnly:"vIGn0"};function fe(e){var t="".concat(e.className," ").concat(ue.iconButton);e.children?t+=" ".concat(ue.iconWithText):t+=" ".concat(ue.iconOnly);var n=i().createElement(x.x,{svgName:e.svgName,className:ue.svg});return i().createElement(k.L,{className:t,onClick:e.onClick},n,e.children)}function de(e){var t=e.isCreate,n=e.open,r=e.showTypeSelector;return!t||n?i().createElement(i().Fragment,null):i().createElement(fe,{className:"btn btn-outline-dark cv-add-question",onClick:r,svgName:O.vn.Plus},"Add question")}var pe,he=n(99910),ve=n(17082),me=n(17439),ye=n(49619),ge=n(88483),be=n(38182);function we(e){return we="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},we(e)}function Ee(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=we(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=we(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==we(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Se(){return E.NotApplicable}function ke(e,t){var n=e.actionableItems.filter((function(e){return e.isCorrect}));return n.every((function(e){return!t(e.id)}))?E.UnAnswered:n.every((function(e){var n;return e.name.trim().toLowerCase()===(null===(n=t(e.id))||void 0===n?void 0:n.trim().toLowerCase())}))?E.Correct:E.Incorrect}function xe(e,t){return e.actionableItems.every((function(e){return!t(e.id)}))?E.UnAnswered:e.actionableItems.filter((function(e){return e.isCorrect})).every((function(e){return t(e.id)===e.name}))?E.Correct:E.Incorrect}function Oe(e,t){var n;return e.actionableItems.forEach((function(e){var r=t(e.id);n=r?r.status!==pe.Correct?r.status!==pe.Incorrect?E.AwaitingMarking:E.Incorrect:E.Correct:E.UnAnswered})),n}function Ce(e,t){return function(n){var r=t.attempts.find((function(t){return t.id===e.id}));return null==r?void 0:r.answers.find((function(e){return e.id===n}))}}function je(e,t){var n=Ce(e,t);return xe(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(pe||(pe={}));var Ne=Ee(Ee(Ee(Ee(Ee(Ee({},j.Z9.Annotation,Se),j.Z9.Image,Se),j.Z9.MissingWord,(function(e,t){var n=Ce(e,t);return ke(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),j.Z9.MultipleChoice,je),j.Z9.ShortAnswer,(function(e,t){return Oe(e,Ce(e,t))})),j.Z9.TrueOrFalse,je),Pe={notApplicable:Se,awaitingMarking:function(){return E.AwaitingMarking},isMissingWordCorrect:ke,isMultipleChoiceCorrect:xe,isShortAnswerMarkedCorrect:Oe,isInteractionCorrect:function(e,t){return(0,Ne[e.typeId])(e,t)}},Ie=n(40221);function Te(e){return Ie.m.last(e.results)}function Le(e,t){return Ie.m.findWhere(null==t?void 0:t.attempts,{id:e})}var Ae=n(76044),_e=n(57857),Fe=_e.T.encloseNamespace("interactives.responseTypes");function De(){return i().createElement("p",{className:"p-2"},i().createElement("em",null,Fe("noResponse")))}var Re="cv-missing-word-",Me="yodaE",Ue="KpbWq",Ve="uKRg2",Be=["A","B","C","D"];function qe(e){var t=1===e.interaction.actionableItems.filter((function(e){return e.isCorrect})).length;function n(t,n){e.onSelectAnswer&&e.onSelectAnswer(t,n)}return i().createElement(i().Fragment,null,e.interaction.actionableItems.map((function(r,o){var a=e.getSelectedAnswer(r.id);if(e.onlyShowSelectedAnswer&&!a)return i().createElement(i().Fragment,{key:o});var c=a?"bg-blue text-white":e.unCheckedBackground,s=function(){return i().createElement(i().Fragment,null,Be[o])};e.showFeedback&&(c=r.isCorrect?"bg-success text-white":"bg-danger text-white ".concat(Me),e.hideFeedbackIcons||(s=function(){return i().createElement(i().Fragment,null,r.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Close}))}));var l=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(r,!a)}};return i().createElement(i().Fragment,{key:o},i().createElement("input",{id:r.id,type:t?"radio":"checkbox",name:"multiple-choice",checked:!!a,onChange:function(){return n(r,!a)},disabled:e.showFeedback,hidden:!0,tabIndex:-1}),i().createElement("label",Object.assign({className:"\n d-block\n rounded-3\n shadow-sm\n mb-2\n ".concat("sm"===e.size?"p-2":"p-3","\n d-flex\n justify-content-between\n position-relative\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(Ue,"\n ").concat(c),key:o,htmlFor:r.id},l),i().createElement("span",{className:"d-inline-block me-3 cv-multiple-choice-bullet"},i().createElement(s,null)),i().createElement("span",{className:"flex-grow-1 pe-4"},r.name),!e.onlyShowSelectedAnswer&&i().createElement("span",{className:Ve},a&&i().createElement(be.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))})))}qe.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var Ge="Y7ls8",Ze="CBgCv",ze="CVTEm",He="tbPTs",We="GUAUz",Ke="ZCkyL",Qe="TKjXy",Ye="_2qC40";function $e(e){function t(t){e.onSelectAnswer&&e.onSelectAnswer(t)}return i().createElement("div",{className:"d-flex ".concat(e.className?e.className:""," ").concat("sm"===e.size?"mx-n1":"mx-n2")},e.interaction.actionableItems.map((function(n,r){var o=e.getSelectedAnswer(n.id),a=o?"bg-blue text-white":e.unCheckedBackground,c=function(){return i().createElement(i().Fragment,null)};e.showFeedback&&(a=n.isCorrect?"bg-success text-white":"bg-danger text-white ".concat(Ke),e.hideFeedbackIcons||(c=function(){return i().createElement(i().Fragment,null,n.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Close}))}));var s=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&t(n)}};return i().createElement("label",Object.assign({key:r,htmlFor:n.id,className:"\n rounded-3\n shadow-sm\n my-0\n position-relative\n overflow-hidden\n d-flex\n align-items-center\n justify-content-center\n ".concat("sm"===e.size?"".concat(Ye," mx-1 h5"):"".concat(Qe," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},s),i().createElement("input",{id:n.id,type:"radio",name:"multiple-choice",checked:!!o,onChange:function(){return t(n)},disabled:e.showFeedback,hidden:!0}),n.name,i().createElement("span",{className:"position-absolute p-2 ".concat(Ze)},i().createElement(c,null)),i().createElement("span",{className:"".concat(ze).concat("sm"===e.size?" ".concat(He):"")},o&&i().createElement(be.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?We:"")})))})))}function Xe(e){return Xe="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},Xe(e)}function Je(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Xe(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}$e.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var et=function(){return i().createElement(i().Fragment,null)},tt=Je(Je(Je(Je(Je(Je({},j.Z9.Annotation,et),j.Z9.Image,et),j.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(Re).concat(t,"}")})).split(/{([^{}]*)}/g),n="p-2";return e.reportsStyling||(n+=" border rounded"),i().createElement("div",{className:n},t.map((function(t,n){if(!t.startsWith(Re))return t;var r=t.replace(Re,""),o=e.interaction.actionableItems.find((function(e){return e.order.toString()===r}));if(o){var a=e.answers.find((function(e){return e.id==o.id}));if(a){if(!e.showFeedback)return i().createElement("strong",{key:n,className:"text-info"},a.text);var c=a.status===pe.Correct;return i().createElement(i().Fragment,{key:n},!c&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},i().createElement("strong",null,a.text))," "),i().createElement("strong",{className:"text-success"},o.name))}}})))})),j.Z9.MultipleChoice,(function(e){var t,n,r,o,a="my-2";return e.reportsStyling&&(a+=" mx-2"),i().createElement("div",{className:a},i().createElement(qe,{interaction:e.interaction,showFeedback:e.showFeedback,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.text},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?Ae.l.getInitialsFromFullName(e.anonymisedUserName):Ae.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(r=e.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,onlyShowSelectedAnswer:!e.showAvatar,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(Ge," text-white")}))})),j.Z9.TrueOrFalse,(function(e){var t,n,r,o,a="justify-content-start";return e.reportsStyling&&(a="justify-content-center"),i().createElement("div",{className:"my-2"},i().createElement($e,{className:a,interaction:e.interaction,showFeedback:e.showFeedback,hideFeedbackIcons:!e.showAvatar,getSelectedAnswer:function(t){var n=e.answers.find((function(e){return e.id==t}));return null==n?void 0:n.text},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?Ae.l.getInitialsFromFullName(e.anonymisedUserName):Ae.l.getInitials(null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.user)||void 0===n?void 0:n.surname),userAvatar:e.anonymisedUserName?null:null===(o=null===(r=e.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,size:"sm",unCheckedBackground:e.showFeedback?"":"".concat(Ge," text-white")}))})),j.Z9.ShortAnswer,(function(e){var t=Ie.m.first(e.answers);if(!t)return i().createElement(i().Fragment,null);var n="rounded p-2 mb-2";return e.reportsStyling||(n+=" bg-blue text-white"),i().createElement("div",{className:n},t.text)}));function nt(e){return i().createElement(i().Fragment,null,e.correctness===E.Correct&&i().createElement("div",{className:"ms-2 text-success"},i().createElement(x.x,{svgName:O.vn.Check})),e.correctness===E.Incorrect&&i().createElement("div",{className:"ms-2 text-danger"},i().createElement(x.x,{svgName:O.vn.Close})))}function rt(e){return i().createElement("div",{className:"d-flex align-items-center justify-content-between"},i().createElement("strong",null,e.anonymisedUserName||Ae.l.getFullName(e.studentResults.user)),i().createElement(nt,{correctness:e.correctness}))}function it(e){return e.correctness!==E.AwaitingMarking?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex justify-content-end mt-1"},i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===pe.Correct?"text-success":"")},i().createElement(x.x,{svgName:e.markedStatus===pe.Correct?O.vn.CheckCircle:O.vn.CheckCircleOutline,onClick:function(){return e.markInteraction(e.studentAttempt.answers,pe.Correct)}})),i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===pe.Incorrect?" text-danger":"")},i().createElement(x.x,{svgName:e.markedStatus===pe.Incorrect?O.vn.CrossCircleFilled:O.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,pe.Incorrect)}})))}var ot={avatarContainer:"FEdgT"};function at(e){var t,n,r,o,a,c=tt[e.interaction.typeId];if(!c)return i().createElement(i().Fragment,null);var s=Te(e.studentResults),l=Le(e.interaction.id,s),u=Pe.isInteractionCorrect(e.interaction,s);return i().createElement("div",{className:"rounded ".concat(null!==(t=e.className)&&void 0!==t?t:"")},i().createElement("div",{className:"d-flex"},!!e.showStudentDetails&&i().createElement("div",{className:"me-2"},i().createElement("div",{className:ot.avatarContainer},i().createElement(be.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?Ae.l.getInitialsFromFullName(e.anonymisedUserName):Ae.l.getInitials(null===(n=e.studentResults.user)||void 0===n?void 0:n.name,null===(r=e.studentResults.user)||void 0===r?void 0:r.surname),imageUrl:e.anonymisedUserName?null:null===(a=null===(o=e.studentResults.user)||void 0===o?void 0:o.avatar)||void 0===a?void 0:a.url}))),i().createElement("div",{className:"flex-grow-1"},!!e.showStudentDetails&&i().createElement(rt,{studentResults:e.studentResults,correctness:u,anonymisedUserName:e.anonymisedUserName}),i().createElement("div",{className:"d-flex justify-content-between"},i().createElement("div",{className:"flex-grow-1 ".concat(e.responseComponentClass?e.responseComponentClass:"")},l?i().createElement(c,{interaction:e.interaction,answers:l.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):i().createElement(De,null)),!e.showStudentDetails&&i().createElement(nt,{correctness:u})))),i().createElement(it,{studentAttempt:l,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus}))}var ct=n(29014),st=n(2248),lt=n(3026),ut=n(52076),ft={button:"nckQw"};function dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var pt=null,ht=!1,vt="shared.immersiveReader";function mt(e){var t,n,i=(t=r.useState(pt),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return dt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];return pt||ht||(ht=!0,(0,lt.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:st.k.GET,success:function(e){pt=e,a(e),window.setTimeout((function(){pt=null,ht=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=_e.T.getPhrase(vt,"titleFallback")),r.createElement("span",{className:"".concat(ft.button," ").concat(e.className||""),onClick:function(){l.q.isFunction(e.onLaunch)&&e.onLaunch(),ut.k.logUserAction(e.analyticsData,e.analyticsOptions);var t={title:e.title,chunks:[{content:e.text,mimeType:e.html?"text/html":"text/plain"}]},n=o.subdomain,r=o.token,i={uiZIndex:5e3,onExit:function(){l.q.isFunction(e.onExit)&&e.onExit()}};ct.launchAsync(r,n,t,i)}},r.createElement("svg",{viewBox:"0 0 40 37"},r.createElement("path",{d:"M37.4,0.9 L37.4,9.6 L35.4,9.6 L35.4,2.9 L24.4,2.9 C22.9,3.3 20,4.5 20,6 L20,17.2 L18,17.2 L18,6 C18,5 15.6,3.6 13.8,2.9 L2,2.9 L2,29 L12.4,29 L12.4,31 L0,31 L0,0.9 L14.1,0.9 L14.3,1 C15,1.2 17.5,2.2 18.9,3.7 C20.5,1.9 23.5,1.1 23.9,1 L24.1,1 L37.4,1 L37.4,0.9 Z",fill:"#000000"}),r.createElement("path",{d:"M27.4,37 L25.8,37 L18.4,29.4 L14,29.4 L14,21 L18.4,20.9 L26.1,13 L27.4,13 L27.4,37 Z M16,27.4 L19.2,27.4 L25.3,33.7 L25.3,16.6 L19.2,22.9 L15.9,22.9 L15.9,27.4 L16,27.4 Z",fill:"#0197F2"}),r.createElement("path",{d:"M31.3,32.7 L29.6,31.7 C29.6,31.7 31.7,28.3 31.7,25.2 C31.7,21.9 29.6,18.5 29.6,18.4 L31.3,17.4 C31.4,17.6 33.7,21.3 33.7,25.2 C33.7,28.8 31.4,32.6 31.3,32.7 Z",fill:"#0197F2"}),r.createElement("path",{d:"M36.4,36.2 L34.8,35 C34.8,35 38,30.8 38,25.2 C38,19.6 34.8,15.4 34.8,15.4 L36.4,14.2 C36.5,14.4 40,19 40,25.3 C40,31.5 36.5,36 36.4,36.2 Z",fill:"#0197F2"})))):r.createElement(r.Fragment,null)}var yt=["A","B","C","D"];function gt(e){if(!e.enableImmersiveReader)return i().createElement(i().Fragment,null);var t=e.interaction,n=e.className,r=N.w.getTypeInfo(t.typeId),o=r.name,a=r.typeName,c="";switch(t.typeId){case j.Z9.Annotation:c=t.data.annotation;break;case j.Z9.Image:c=t.data.caption;break;case j.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u> </u>"}));break;case j.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(yt[t],": ").concat(e.name)}));break;case j.Z9.ShortAnswer:c=t.name;break;case j.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var s=t.typeId===j.Z9.Annotation||t.typeId===j.Z9.MissingWord||t.typeId===j.Z9.MultipleChoice;return i().createElement(mt,{title:o,text:c,html:s,className:"pe-2 ".concat(n||""),analyticsData:{id:t.interactiveId,type:a},analyticsOptions:{location:d.LZ.InteractivePlayer,entity:d.py.Interactive,actionType:d.Vw.Click,descriptor:d._S.LaunchImmersiveReader}})}function bt(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}function wt(e){return wt="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},wt(e)}var Et="cv-missing-word-";function St(e){return St="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},St(e)}function kt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=St(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=St(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==St(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xt=n(41347);function Ot(e){return Ot="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},Ot(e)}function Ct(e){return Ct="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},Ct(e)}function jt(e){return jt="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},jt(e)}function Nt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=jt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pt=function(){return!0},It=function(){return!1},Tt=Nt(Nt(Nt(Nt(Nt(Nt({},j.Z9.Annotation,It),j.Z9.Image,It),j.Z9.MissingWord,Pt),j.Z9.MultipleChoice,Pt),j.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),j.Z9.TrueOrFalse,Pt);function Lt(e){return Tt[e]}var At=Nt(Nt(Nt(Nt(Nt(Nt({},j.Z9.Annotation,(function(e){var t=e.interaction.data.annotation.replace(/<(a)(.*?)>/g,'<$1 target="_blank" $2>');return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mb-2",dangerouslySetInnerHTML:{__html:t}}),i().createElement(gt,{interaction:e.interaction,enableImmersiveReader:e.enableImmersiveReader}))})),j.Z9.Image,(function(e){var t=e.interaction,n=e.recalculateScroll,r=i().useCallback((function(e){e&&(e.onload=function(){n()})}),[]);return i().createElement("div",{className:"cv-interactive-question cv-image-interactive"},i().createElement("div",{className:"cv-image-container text-center"},i().createElement("img",{className:"img-fluid shadow-lg",src:t.data.url,ref:r}),t.data.caption&&i().createElement(i().Fragment,null,i().createElement("p",{className:"mt-3"},t.data.caption,i().createElement(gt,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader})))))})),j.Z9.MissingWord,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=r.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(Et).concat(t,"}")})).split(/{([^{}]*)}/g);return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mb-2"},a.map((function(e,a){var c;if(!e.startsWith(Et))return e;var s=e.replace(Et,""),l=r.actionableItems.find((function(e){return e.order.toString()===s}));if(l){var u,f,d=t[l.id]||"",p=(u=l.name,(f=document.createElement("canvas").getContext("2d")).font="17pt arial",f.measureText(u).width);if(o){var h=l.name.toLowerCase().toString()===(null===(c=t[l.id])||void 0===c?void 0:c.toLowerCase().toString());return i().createElement(i().Fragment,{key:a},!h&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},d)," "),i().createElement("span",{className:"text-success"},l.name))}return i().createElement("span",{className:"cv-missing-word-input-container",key:a},i().createElement("input",{style:{width:p/16+"rem"},onChange:function(e){return function(e,r){if(r.stopPropagation(),r.target.value)n(function(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=wt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e.id,r.target.value));else{var i=t,o=e.id,a=(i[o],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,["symbol"===wt(o)?o:o+""]));n(a,!0)}}(l,e)},value:d,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),i().createElement(bt,{error:t.error}),i().createElement(gt,{interaction:e.interaction,enableImmersiveReader:e.enableImmersiveReader}))})),j.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,s=1===r.actionableItems.filter((function(e){return e.isCorrect})).length;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",null,r.name,i().createElement(gt,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader})),!s&&i().createElement("p",{className:"text-secondary"},i().createElement("small",null,"This question has multiple correct answers")),i().createElement(qe,{interaction:r,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(s)n(kt({},e.id,e.name),!0);else if(r)n(kt({},e.id,e.name));else{var i=t,o=e.id,a=(i[o],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,["symbol"===St(o)?o:o+""]));n(a,!0)}},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:Ae.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),i().createElement(bt,{error:t.error}))})),j.Z9.ShortAnswer,(function(e){var t=e.interaction,n=e.state,r=e.setState;return e.showFeedback?i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",null,t.name),i().createElement("label",{className:"cv-interaction-field-label"},"My answer"),i().createElement("p",null,n[t.actionableItems[0].id]),t.data.suggestedResponse&&i().createElement(i().Fragment,null,i().createElement("label",{className:"cv-interaction-field-label mt-1"},"Teacher's suggested answer"),i().createElement("p",null,t.data.suggestedResponse))):i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",null,t.name,i().createElement(gt,{interaction:t,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader})),i().createElement(xt.Z,{id:"short-answer-answer",className:"form-control mt-2",minRows:3,value:n[t.actionableItems[0].id]||"",onChange:function(e){var i,o,a;r(Object.assign(Object.assign({},n),(i={},o=t.actionableItems[0].id,a=e.target.value,(o=function(e){var t=function(e,t){if("object"!=Ot(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ot(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ot(t)?t:t+""}(o))in i?Object.defineProperty(i,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[o]=a,i)))},disabled:!!n.submitted}),i().createElement(bt,{error:n.error}))})),j.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,s=r.actionableItems.find((function(e){return e.isCorrect}));return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",null,r.name,i().createElement(gt,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader})),i().createElement($e,{className:"justify-content-center",interaction:r,showFeedback:o,onSelectAnswer:function(e){var r,i,o;t.submitted||n((r={},i=e.id,o=e.name,(i=function(e){var t=function(e,t){if("object"!=Ct(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ct(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ct(t)?t:t+""}(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r),!0)},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:Ae.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),o&&i().createElement("div",{className:"text-center px-5 mt-3"},i().createElement("p",null,"The answer is ",i().createElement("strong",null,s.name)),r.data.feedback&&i().createElement("p",null,r.data.feedback)),i().createElement(bt,{error:t.error}))}));function _t(){return""}var Ft=Nt(Nt(Nt(Nt(Nt(Nt({},j.Z9.Annotation,_t),j.Z9.Image,_t),j.Z9.MissingWord,(function(e,t){var n=Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length;return n?n!==t.actionableItems.length?"Please fill in all of the blanks":null:"Please fill in the blanks"})),j.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),j.Z9.ShortAnswer,(function(e){return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?null:"Please provide an answer to the question"})),j.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),Dt=Nt(Nt(Nt(Nt(Nt(Nt({},j.Z9.Annotation,null),j.Z9.Image,null),j.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),j.Z9.MultipleChoice,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))})),j.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),j.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))}));function Rt(e){return Dt[e]}var Mt=Nt(Nt(Nt(Nt(Nt(Nt({},j.Z9.Annotation,Pe.notApplicable),j.Z9.Image,Pe.notApplicable),j.Z9.MissingWord,(function(e,t){return Pe.isMissingWordCorrect(t,(function(t){return e[t]}))})),j.Z9.MultipleChoice,(function(e,t){return Pe.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),j.Z9.ShortAnswer,Pe.awaitingMarking),j.Z9.TrueOrFalse,(function(e,t){return t.actionableItems.filter((function(e){return e.isCorrect})).every((function(t){return e[t.id]===t.name}))?E.Correct:E.Incorrect}));function Ut(e){return Mt[e]}var Vt={feedback:"O6oD6"};function Bt(e){var t=e.studentResults,n=e.interaction,r=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,s=e.interactionNumber,l=e.imageCdnUrl,u=Te(t),f=Le(n.id,u),d=a.interactions[n.id],p=Ut(n.typeId)(d||{},n),h=n.typeId!==j.Z9.Annotation&&n.typeId!==j.Z9.Image,v=h;n.typeId===j.Z9.MissingWord&&f&&(v=!1);var m=n.data.suggestedResponse||n.data.feedback;return i().createElement("li",{className:"mb-3 position-relative"},i().createElement("div",{className:"d-flex flex-wrap mb-2 cursor-pointer",onClick:function(){return c(r.id,n.id)}},o.immediateFeedback&&i().createElement("div",{className:Vt.feedback},!!f&&(p===E.AwaitingMarking?i().createElement("span",{className:"text-secondary fst-italic"},"Waiting to be marked"):p===E.Correct?i().createElement("span",{className:"text-success"},"Correct ",i().createElement(x.x,{className:"svg-container align-middle",svgName:O.vn.Check})):p===E.Incorrect&&i().createElement("span",{className:"text-danger"},"Incorrect ",i().createElement(x.x,{className:"svg-container align-middle",svgName:O.vn.Close})))),i().createElement(I,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:v,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:s})),h&&!f&&i().createElement("button",{className:"btn btn-dark",onClick:function(){return c(r.id,n.id)}},"Answer question"),f&&h&&i().createElement(at,{interaction:n,studentResults:t,markedStatus:pe.PendingReview,markInteraction:function(){},imageCdnUrl:l,showFeedback:o.immediateFeedback,showAvatar:!0}),o.immediateFeedback&&f&&m&&i().createElement("div",{className:"bg-light rounded p-2"},i().createElement("div",null,i().createElement("strong",null,n.typeId===j.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),m))}var qt={interaction:"pUo8u"};function Gt(e){var t=e.interactive,n=e.duration;return n?i().createElement(i().Fragment,null,t.timepoints.map((function(t,r){if(!t.interactions.length)return i().createElement(i().Fragment,null);var o=N.w.getTypeInfo(t.interactions[0].typeId).bgClassName,a=t.visibleAt/1e3/n*100;return i().createElement("span",{key:r,className:"".concat(qt.interaction," ").concat(o),style:{left:"".concat(a,"%")},onClick:function(n){return r=t.id,i=t.interactions[0].id,n.stopPropagation(),void e.goToTimepoint(r,i);var r,i}})}))):i().createElement(i().Fragment,null)}var Zt={progress:"BnKli"};function zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ht(e){var t,n,r=e.duration,o=e.progress,a=e.player,c=(t=i().useState(o.length),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return zt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],s=[];if(o.length){var l=o[0];s.push(l),o.forEach((function(e,t){0!==t&&(l.end.time+1>e.start.time&&l.start.time<e.start.time?l.end=e.end:(l=e,s.push(l)))}))}return i().useEffect((function(){var e=function(){c(o.length)};return a.on("progressflush",e),function(){return a.off("progressflush",e)}}),[]),i().createElement(i().Fragment,null,s.map((function(e,t){var n=e.start.time/r*100,o=100*(1-e.end.time/r);return i().createElement("span",{key:t,className:Zt.progress,style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}var Wt=400;function Kt(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function Qt(e){return e.error,e.hasChanges,e.submitted,e.spinner,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}(e,["error","hasChanges","submitted","spinner"])}var Yt=function(e){var t=e.interactive,n=e.state,r=0,i=0,o=0,a=!1,c=[];return t.timepoints.forEach((function(e){e.interactions.forEach((function(e){var t=n.interactions[e.id],s=Ut(e.typeId)(t||{},e);s===E.Correct&&r++,s!==E.NotApplicable&&i++,s!==E.NotApplicable&&(null==t?void 0:t.submitted)&&o++,s===E.AwaitingMarking&&(a=!0);var l=Qt(t||{}),u=Object.keys(l).map((function(e){var t;return{id:e,text:null===(t=l[e])||void 0===t?void 0:t.toString()}}));u.length&&c.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:r,total:i,answered:o,studentAttempts:c,awaitingMarking:a}},$t={bar:"gxTA_"};function Xt(e){return function(e){if(Array.isArray(e))return en(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Jt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jt(e,t){if(e){if("string"==typeof e)return en(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?en(e,t):void 0}}function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tn(e){var t,n,r=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,s=e.player,l=e.progress,u=e.portalNode,f=i().useRef(),d=(t=i().useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||Jt(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],h=d[1];function v(){o(!1),s.show(),s.play()}function m(t,n){v(),e.goToTimepoint(t,n)}if(!u||!r)return i().createElement(i().Fragment,null);var y=Yt({interactive:c,state:a}),g=y.correctCount,b=y.total,w=y.answered,E=y.studentAttempts,S=y.awaitingMarking,x={name:e.currentUser.givenName,username:e.currentUser.username,user:{name:e.currentUser.givenName,surname:e.currentUser.familyName,avatar:{url:e.currentUser.avatar}},results:[{id:c.id,attempts:E}]},C=0,j=s.ended(),N=s.duration();return i().createElement(ve.Nq,{node:u},i().createElement("div",{className:"row pb-3"},i().createElement("div",{className:"col-4 col-xs-12"},i().createElement(ye.Z,{data:s.poster(),imageType:ge.__.Thumbnails,imageOptions:{size:ge.h2.Medium}})),i().createElement("div",{className:"col-8 col-xs-12"},i().createElement("span",{className:"float-end"},i().createElement(me.h,{svgName:O.vn.Play,className:"btn btn-outline-dark",onClick:function(){v(),s.ended()&&s.currentTime(0)}},j?"Play again":"Continue watching"),s.gradePassbackPlugin().enabled&&(p?i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){}},i().createElement(he.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(me.h,{svgName:O.vn.Check,className:"btn btn-dark ms-2",onClick:function(){h(!0),s.gradePassbackPlugin().submit(g/b,!S)}},"Submit"))),i().createElement("h1",{className:"h3"},e.title),i().createElement("p",null))),i().createElement("div",{className:"border rounder px-2 mb-3"},i().createElement("div",{className:"cursor-pointer my-4 ".concat($t.bar),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*N;v(),s.currentTime(n)}},ref:f},i().createElement(Ht,{duration:N,progress:l,interactive:c,player:s}),i().createElement(Gt,{duration:N,interactive:c,goToTimepoint:m}))),i().createElement("h2",{className:"h4"},"My Answers"),i().createElement("div",{className:"d-flex justify-content-between"},i().createElement("span",null,c.immediateFeedback&&i().createElement("div",null,"Score: ",g,"/",b),i().createElement("div",{className:"mb-3"},"You have answered ",i().createElement("strong",{className:w!==b?"text-danger":""},w)," of ",i().createElement("strong",null,b)," questions"))),i().createElement("div",{className:"row"},i().createElement("div",{className:"col-lg-7 col-12"},i().createElement("ul",{className:"list-unstyled"},c.timepoints.reduce((function(t,n){return[].concat(Xt(t),Xt(n.interactions.map((function(t){return C++,i().createElement(Bt,{key:t.id,studentResults:x,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:m,interactionNumber:C,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function nn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function on(e){var t=e.player,n=e.resultsService,r=e.interactive,o=e.setShowSummary,a=e.mobile,c=nn(i().useState(!1),2),s=c[0],l=c[1],u=nn(i().useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,h=e.player.activePlugins_.favouritePlugin;function v(){var e=t.currentTime(),n=r.timepoints[r.timepoints.length-1];f||e>n.visibleAt/1e3+1?l(!0):l(!1)}function m(){d(!0)}if(i().useEffect((function(){return t.on("ended",m),function(){return t.off("ended",m)}}),[]),i().useEffect((function(){if(n&&!a)return t.on("timeupdate",v),function(){return t.off("timeupdate",v)}}),[f]),!s)return null;var y="btn btn-outline-dark cv-show-summary";return h&&(y+=" cv-has-favourite-plugin"),p&&(y+=" cv-has-activity-status-plugin"),i().createElement(k.L,{className:y,onClick:function(){o(!0),t.pause(),t.hide()}},t.gradePassbackPlugin().enabled?"Submit answers":"View summary")}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function cn(e){var t,n,r=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,s=(t=i().useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return an(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?an(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=s[0],u=s[1];function f(e){u(e),a&&a(e)}function d(){f(!0),o.hide()}return i().useEffect((function(){if(r&&!c)return o.on("ended",d),function(){return o.off("ended",d)}}),[]),i().useEffect((function(){l&&o.isFullscreen()&&o.exitFullscreen()}),[l]),i().createElement(i().Fragment,null,i().createElement(on,Object.assign({setShowSummary:f},e)),i().createElement(tn,Object.assign({showSummary:l,setShowSummary:f},e)))}var sn=n(25692),ln=n(98985);function un(){var e=ln.o.getLiteArticle(sn.b.MakeInteractive);return i().createElement("div",{className:"my-5 text-center"},i().createElement("h2",{className:"h3"},"Select an interaction to get started"),i().createElement("p",{className:"mb-0"},"Choose a point in the video and add a question to interact and engage your students."),!!e&&i().createElement("a",{href:e,target:"_blank",className:"btn btn-link text-info"},"How do I make interactives?"))}function fn(e){var t=e.isCreate,n=e.interactive,r=e.interaction,o=e.portalNode,a=e.goToTimepoint,c=e.promptDelete;if(!o)return i().createElement(i().Fragment,null);var s=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return i().createElement(ve.Nq,{node:o},s?i().createElement(i().Fragment,null,i().createElement("h2",{className:"h4 mt-3"},"Question List (",s,")"),i().createElement(D,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==r?void 0:r.id,onClickDelete:t?c:void 0})):t?i().createElement(un,null):i().createElement(i().Fragment,null))}var dn=n(4234),pn=n(90547),hn=n(5256),vn=n(30708);function mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var yn=[j.Z9.MissingWord,j.Z9.MultipleChoice,j.Z9.TrueOrFalse,j.Z9.ShortAnswer,j.Z9.Image,j.Z9.Annotation];function gn(e){var t,n,r=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,s=e.open,l=e.isCreate,u=e.interaction,f=(t=i().useState((0,vn.m)(a.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return mn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=f[0],p=f[1];return i().useEffect((function(){var e=function(){p((0,vn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),u||!l?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex align-items-center justify-content-center h-100"},i().createElement("div",{className:"cv-interactive-type-selector d-flex flex-wrap justify-content-center align-items-center"},i().createElement("div",{className:"text-center fw-bold w-100 text-body mb-3 cv-add-question-copy"},c?"Add another question at:":"Add a question at:"," ",d),yn.map((function(e,t){var n=N.w.getTypeInfo(e),o=n.name,a=n.bgClassName,c=n.Svg;return i().createElement(k.L,{key:t,className:"cv-type-selector rounded py-2 m-1 ".concat(a),onClick:function(){return r(e)}},i().createElement("span",{className:"cv-create-type-icon mb-1"},i().createElement(c,null)),i().createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name px-1"},o))})),(c||s)&&i().createElement("div",{className:"text-center w-100 mt-2 ".concat(c?"":"cv-adding-first-cancel")},i().createElement(k.L,{className:"btn btn-link",onClick:o},"Cancel"))))}var bn=n(12704);function wn(e){var t=e.timepoint,n=e.interaction,r=e.promptDelete,o=e.optionsPortalNode,a=e.setView;if(!n)return i().createElement(i().Fragment,null);var c=[];if(c.push({label:"Move time point",onClick:function(){return a("move")}}),t.interactions.length>1){var s=Kt(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:s?"disabled":""})}return c.push({label:"Delete",onClick:function(){return r(n.id)},className:"text-danger"}),i().createElement(ve.Nq,{node:o},!!n&&i().createElement(bn.m,{actions:c}))}function En(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,s=e.onClickDiscard,l=Kt(t.id),u=!!(null==n?void 0:n.hasChanges),f=!!(null==n?void 0:n.spinner);return r.createElement("div",{className:"cv-timpoint-button-container"},l?r.createElement(k.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(k.L,{className:"btn btn-link",onClick:s},"Discard"):r.createElement(k.L,{className:"btn btn-link",onClick:c},"Add another question"),f?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(he.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):l?u?r.createElement(k.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(k.L,{className:"btn btn-dark ms-2 disabled",onClick:function(){}},"Save"):u?r.createElement(k.L,{className:"btn btn-dark ms-2",onClick:o},"Save"):r.createElement(fe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"))}function Sn(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,s=!!(null==n?void 0:n.submitted),l=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!Rt(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!s&&f&&r.createElement(k.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(fe,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:O.vn.ChevronUp}),u?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(he.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):s||!f?1===o||a===o-1?r.createElement(fe,{className:"btn btn-dark ms-2",onClick:i,svgName:O.vn.Play},"Continue"):r.createElement(k.L,{className:"btn btn-dark ms-2 ".concat(d?"":"disabled"),onClick:function(){d&&c(a+1)}},"Next"):r.createElement(k.L,{className:"btn btn-dark ms-2 ".concat(l?"":"disabled"),onClick:function(){l&&e.onClickSubmit()}},"Save"))}function kn(e){var t=e.isCreate,n=e.interaction,r=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,s=e.addAnotherQuestion,l=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,h=e.currentIndex;return i().createElement(i().Fragment,null,t?i().createElement(En,{interaction:n,interactionState:r,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:s,onClickDiscard:function(){return l()}}):i().createElement(Sn,{typeId:n.typeId,interactionState:r,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:h,numberOfInteractions:p.interactions.length}))}function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function On(e){var t,n,r=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,s=e.player,l=(t=i().useState((0,vn.m)(s.currentTime()||0)),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return xn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],f=l[1];i().useEffect((function(){var e=function(){f((0,vn.m)(s.currentTime()))};return s.on("timeupdate",e),function(){return s.off("timeupdate",e)}}),[]);var d=N.w.getTypeInfo(r),p=d.name,h=d.bgClassName,v=o<a-1,m=o>0;return i().createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(h)},i().createElement(k.L,{onClick:function(){m&&c(o-1)},className:m?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.ChevronLeft})),i().createElement("div",null,i().createElement("div",{className:"h6 mb-0"},p),a>1&&i().createElement("div",null,o+1," of ",a," at ",u)),i().createElement(k.L,{onClick:function(){v&&c(o+1)},className:v?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:O.vn.ChevronRight})))}function Cn(e){var t=e.typeId,n=N.w.getTypeInfo(t),r=n.name,o=n.prompt,a=n.bgClassName,c=n.Svg;return i().createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center px-3 pt-3"},i().createElement("div",{className:"d-flex align-items-center"},i().createElement("span",{className:"cv-interaction-icon rounded my-1 text-white ".concat(a)},i().createElement(c,null)),i().createElement("span",{className:"text-start flex-grow-1"},i().createElement("div",{className:"h5 ".concat(o?"":"mb-0")},i().createElement("strong",null,r)),o&&i().createElement("div",{className:"h6 mb-0"},o))))}function jn(e){var t=e.isCreate,n=e.interaction,r=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?i().createElement(On,{typeId:n.typeId,changeIndex:o,player:r,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):i().createElement(Cn,{typeId:n.typeId})}var Nn=n(10671),Pn=n(98886),In=n(6880);function Tn(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}var Ln=n(61380);function An(e){return An="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},An(e)}function _n(){_n=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==An(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(An(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Fn(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,Dn(r.key),r)}}function Dn(e){var t=function(e,t){if("object"!=An(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=An(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==An(t)?t:t+""}var Rn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Mn=function(e){return"/api/domain/v1/interactions/".concat(e)},Un=function(e){return"/api/domain/v1/timepoints/".concat(e)},Vn={},Bn=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"saveInteraction",value:function(e){return Rn(this,void 0,void 0,_n().mark((function t(){var n,r,i,o,a;return _n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Kt(e.id),r=n?"/api/domain/v1/interactions/bulk":(c=e.id,"/api/domain/v1/interactions/bulk/".concat(c)),i={name:e.name,data:e.data,timepointId:e.timepointId,interactiveId:e.interactiveId,typeId:e.typeId,actionableItems:e.actionableItems,order:e.order},n||(i.id=e.id),o=n?Ln.e.post(r,JSON.stringify(i),Vn):Ln.e.put(r,JSON.stringify(i),Vn),t.next=7,o;case 7:a=t.sent,n&&(e.id=a.id);case 9:case"end":return t.stop()}var c}),t)})))}},{key:"deleteInteraction",value:function(e){return Rn(this,void 0,void 0,_n().mark((function t(){return _n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ln.e.delete(Mn(e),Vn);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return Rn(this,void 0,void 0,_n().mark((function t(){var n,r;return _n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={interactiveId:e.interactiveId,shouldPause:1,visibleAt:e.visibleAt},t.next=3,Ln.e.post("/api/domain/v1/timepoints",JSON.stringify(n),Vn);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return Rn(this,void 0,void 0,_n().mark((function t(){return _n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ln.e.put((n=e.id,"/api/domain/v1/timepoints/".concat(n)),JSON.stringify(e),Vn);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return Rn(this,void 0,void 0,_n().mark((function t(){return _n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ln.e.delete(Un(e),Vn);case 2:case"end":return t.stop()}}),t)})))}}])&&Fn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),qn={styleToHTML:function(e){return"SUPERSCRIPT"===e?{start:"<sup>",end:"</sup>"}:"SUBSCRIPT"===e?{start:"<sub>",end:"</sub>"}:void 0},entityToHTML:function(e,t){return"LINK"===e.type?i().createElement("a",{href:e.data.url},t):t},htmlToStyle:function(e,t,n){return"sup"===e?n.add("SUPERSCRIPT"):"sub"===e?n.add("SUBSCRIPT"):n},htmlToEntity:function(e,t,n){if("a"===e)return n("LINK","MUTABLE",{url:t.href})}};function Gn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zn(e){var t=Gn(i().useState(""),2),n=t[0],r=t[1],o=Gn(i().useState(""),2),a=o[0],c=o[1];return i().createElement("div",{"aria-haspopup":"true","aria-expanded":e.expanded,"aria-label":"rdw-color-picker"},i().createElement("div",{className:"rdw-option-wrapper cv-annotation-toolbar-option cv-annotation-link",onClick:e.onExpandEvent}," "),e.expanded&&i().createElement("div",{className:"rdw-link-modal",onClick:function(e){return e.stopPropagation()}},i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-url"},"URL"),i().createElement("input",{id:"cv-annotation-url",className:"form-control",onChange:function(e){return r(e.target.value)},value:n,placeholder:"Enter URL",autoComplete:"off"})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"cv-annotation-text"},"Text"),i().createElement("input",{id:"cv-annotation-text",className:"form-control",onChange:function(e){return c(e.target.value)},value:a,placeholder:"Enter Text",autoComplete:"off"})),i().createElement(k.L,{onClick:function(){return e.onChange("link",a||n,n,"_blank")},className:"btn btn-dark"},"Add")))}function Hn(e){return Hn="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},Hn(e)}function Wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qn(){Qn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Hn(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Hn(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}var Yn=n(48088);function $n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xn=!0,Jn=function(e){"boolean"==typeof e&&(Xn=e);var t,n,r=(t=i().useState(Xn),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return $n(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$n(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1],c=Yn.Radio.channel("video:drag:drop:lock");function s(){a(Xn)}return i().useEffect((function(){if(Xn)return c.on("update",s),function(){c.off("update",s)}}),[]),{enabled:o,disable:function(){Xn=!1,c.trigger("update")},enable:function(){Xn=!0,c.trigger("update")}}},er=n(24365),tr=n(99828),nr={onFileSelect:function(e,t,n,r){if(t&&t.length){var i=new FileReader;i.addEventListener("load",(function(){return nr.onReaderLoad(i,e,n,r)})),i.readAsDataURL(t[0])}},onReaderLoad:function(e,t,n,r){var i,o,a=new Image;a.src=e.result;var c=null!==(i=null==r?void 0:r.width)&&void 0!==i?i:tr.y[t].width,s=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:tr.y[t].height;a.addEventListener("load",(function(){nr.isImageValid(t,a,r)&&l.q.isFunction(n)?n(a):alert("Image too small: minimum dimensions are ".concat(c," x ").concat(s))}))},isImageValid:function(e,t,n){var r,i,o=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:tr.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:tr.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case ge.__.Avatars:return"avatars";case ge.__.Thumbnails:return"thumbnails";case ge.__.Logos:return"logos";case ge.__.Covers:return"covers";case ge.__.Posters:return"posters";case ge.__.TallPosters:return"tallposters";case ge.__.HeroBanners:return"herobanners";case ge.__.None:default:return""}}};function rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ir(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ir(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function or(e){var t=rr(i().useState(!1),2),n=t[0],r=t[1],o=rr(i().useState(0),2),a=o[0],c=o[1];return i().useEffect((function(){0===a&&n&&r(!1)}),[a,n,r]),i().createElement("div",{onDragOver:function(e){e.preventDefault(),e.stopPropagation()},onDragEnter:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e+1})),e.dataTransfer.items&&e.dataTransfer.items.length>0&&!n&&r(!0)},onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),c((function(e){return e-1}))},onDrop:function(t){t.preventDefault(),t.stopPropagation(),r(!1),a>0&&c(0),t.dataTransfer.files&&t.dataTransfer.files.length>0&&(e.onDropImage(t.dataTransfer.files),t.dataTransfer.clearData())},className:n?"cv-image-upload-mask":""},e.children)}function ar(){return i().createElement("svg",{viewBox:"0 0 43 38",className:"cv-upload-image-icon"},i().createElement("g",{transform:"translate(-1193.000000, -185.000000)"},i().createElement("g",{transform:"translate(1183.000000, 173.000000)"},i().createElement("path",{d:"M49.875,12.9166667 C51.3247475,12.9166667 52.5,14.0732644 52.5,15.5 L52.5,46.5 C52.5,47.9267356 51.3247475,49.0833333 49.875,49.0833333 L13.125,49.0833333 C11.6752525,49.0833333 10.5,47.9267356 10.5,46.5 L10.5,15.5 C10.5,14.0732644 11.6752525,12.9166667 13.125,12.9166667 L49.875,12.9166667 Z M49.875,15.5 L13.125,15.5 L13.125,46.5 L49.875,46.5 L49.875,15.5 Z M35.5085905,22.5470241 L45.7260956,38.0470241 C46.1206004,38.6454897 45.9474325,39.445375 45.3393142,39.8336178 C44.731196,40.2218607 43.9184093,40.0514415 43.5239044,39.4529759 L34.3641741,25.5576247 L29.9489593,31.7425222 C29.4803332,32.3989804 28.5233602,32.4806343 27.9469223,31.9133463 L26.3920049,30.38311 L19.425,39.525 C18.9900758,40.0956942 18.167399,40.211354 17.5875,39.7833333 C17.007601,39.3553127 16.8900758,38.5456942 17.325,37.975 L25.2,27.6416667 C25.6792326,27.0128323 26.6132966,26.9475041 27.1780777,27.5033204 L28.6987913,28.9998957 L33.3335357,22.5074778 C33.8680838,21.758675 35.0025121,21.7793009 35.5085905,22.5470241 Z M21,19.375 C23.1746212,19.375 24.9375,21.1098966 24.9375,23.25 C24.9375,25.3901034 23.1746212,27.125 21,27.125 C18.8253788,27.125 17.0625,25.3901034 17.0625,23.25 C17.0625,21.1098966 18.8253788,19.375 21,19.375 Z M21,21.9583333 C20.2751263,21.9583333 19.6875,22.5366322 19.6875,23.25 C19.6875,23.9633678 20.2751263,24.5416667 21,24.5416667 C21.7248737,24.5416667 22.3125,23.9633678 22.3125,23.25 C22.3125,22.5366322 21.7248737,21.9583333 21,21.9583333 Z",id:"Combined-Shape"}))))}function cr(e){return cr="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},cr(e)}function sr(){sr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==cr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(cr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function lr(e){return lr="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},lr(e)}function ur(){ur=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==lr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(lr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}var fr=/[.\?!,;:\-''\(\)]/g;function dr(e){for(var t=e.split("");t.length&&t[0].match(fr);)t.shift();for(;t.length&&t[t.length-1].match(fr);)t.pop();return t.join("")}function pr(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(fr);)r.push(n.shift());for(;n.length&&n[n.length-1].match(fr);)i.unshift(n.pop());return r.join("")+t+i.join("")}function hr(e){return e.map((function(e){if(!e.selected)return e.text;var t=dr(e.text).length,n=new Array(t).fill("_").join("");return pr(e.text,n)})).join(" ")}function vr(e){return e.map((function(e){var t;return e.selected?null===(t=pr(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var mr=n(63946);function yr(e){return i().createElement(mr.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},i().createElement(x.x,{svgName:O.vn.Info}))}function gr(e){var t=i().useRef(null);function n(){e.onChange(Object.assign(Object.assign({},e.answer),{isCorrect:!e.answer.isCorrect}))}return i().createElement("li",{className:"p-1 my-1 w-100 bg-white d-flex align-items-center border rounded"},i().createElement("div",{className:"form-check",onKeyDown:function(e){return"Enter"===e.key&&n()}},i().createElement("input",{id:"multiple-choice--".concat(e.answer.order),type:e.isTrueOrFalse?"radio":"checkbox",className:"form-check-input me-2",name:"multiple-choice-answer",checked:e.answer.isCorrect,onChange:n,disabled:!e.answer.name}),i().createElement("label",{ref:t,htmlFor:"multiple-choice--".concat(e.answer.order),className:"cursor-pointer form-check-label"})),e.isTrueOrFalse?i().createElement("label",{className:"mb-0",htmlFor:"multiple-choice--".concat(e.answer.order)},e.answer.name):i().createElement("input",{placeholder:"Answer",onChange:function(t){e.onChange(Object.assign(Object.assign({},e.answer),{name:t.target.value}))},value:e.answer.name,className:"border-0 outline-none w-100",autoComplete:"off"}))}function br(e){return br="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},br(e)}function wr(){wr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==br(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(br(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Er(e){var t;if(!(null===(t=e.question)||void 0===t?void 0:t.trim()))return"Please provide a question";if(!e.answers.find((function(e){return e.isCorrect})))return"Please select the correct answer";var n=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())}));if(n.length<2)return"Please provide at least two answers";var r=!1,i={};return n.forEach((function(e){r||(i[e.name]?r=!0:i[e.name]=!0)})),r?"There are duplicates in your answers":null}function Sr(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=wr().mark((function r(){return wr().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.actionableItems=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())})),e.feedback&&(t.data.feedback=e.feedback),r.next=5,Bn.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function c(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}s((a=a.apply(r,i||[])).next())}))}function kr(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===j.Z9.TrueOrFalse,r=null===(t=e.actionableItems)||void 0===t?void 0:t.map((function(e){return{order:e.order,name:e.name,isCorrect:e.isCorrect}}));return(null==r?void 0:r.length)?!n&&(null==r?void 0:r.length)<4&&r.push({order:r.length,name:"",isCorrect:!1}):r=[{order:0,name:n?"True":"",isCorrect:!1},{order:1,name:n?"False":"",isCorrect:!1}],{question:e.name||"",answers:r,feedback:e.data.feedback||""}}(e.interaction):t,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback,s=o.typeId===j.Z9.TrueOrFalse;function l(e){var t,i,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!s&&t.isCorrect}):e}));if(o.find((function(e){return!e.name}))&&(i=(t=o).find((function(e){return!e.name})),o=t.length>2?t.filter((function(e){return e.order!==i.order})).map((function(e,t){return Object.assign(Object.assign({},e),{order:t})})):t.map((function(e){return e.order!==i.order?e:Object.assign(Object.assign({},e),{isCorrect:!1})}))),!s&&o.length<4&&!o.find((function(e){return!e.name}))){var a=Ie.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1})}r(Object.assign(Object.assign({},n),{answers:o}))}return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-1"},i().createElement("label",{className:"cv-interaction-field-label mb-0",htmlFor:"multiple-choice-question"},"Question"),i().createElement(ve.t0,{node:a})),i().createElement("input",{id:"multiple-choice-question",className:"form-control",placeholder:"Enter your question here",value:n.question,onChange:function(e){r(Object.assign(Object.assign({},n),{question:e.target.value}))},autoComplete:"off"}),!n.question&&i().createElement(Tn,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},"Answers"),n.answers.map((function(e){return i().createElement(gr,{key:e.order,answer:e,onChange:l,isTrueOrFalse:s})})),n.question&&i().createElement(Tn,{error:n.error})),c&&s&&i().createElement("div",{className:"form-group mb-0"},i().createElement("label",{className:"cv-true-or-false-feedback-label cv-interaction-field-label",htmlFor:"true-or-false-feedback"},"Feedback ",i().createElement("span",{className:"text-secondary"},"(optional)")," ",i().createElement(yr,{tooltipText:"Provide answer feedback for your students"})),i().createElement(xt.Z,{id:"true-or-false-feedback",className:"form-control",minRows:2,value:n.feedback||"",onChange:function(e){r(Object.assign(Object.assign({},n),{feedback:e.target.value}))},placeholder:"Give feedback for this question"})))}function xr(e){return xr="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},xr(e)}function Or(){Or=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==xr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(xr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Cr(e){return Cr="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},Cr(e)}function jr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Cr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Cr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Cr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Nr=jr(jr(jr(jr(jr(jr({},j.Z9.Annotation,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{annotation:(null===(t=e.data)||void 0===t?void 0:t.annotation)||""}}(e.interaction):t,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=Wn(i().useState(function(){var e=o.data.annotation;if(e){var t=(0,Pn.h4)(qn)(e);return In.EditorState.createWithContent(t)}return In.EditorState.createEmpty()}()),2),s=c[0],l=c[1],u=Wn(i().useState(null),2),f=u[0],d=u[1];return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-1"},i().createElement("label",{className:"cv-interaction-field-label mb-0",onClick:function(){return null==f?void 0:f.focusEditor()}},"Annotation"),i().createElement(ve.t0,{node:a})),i().createElement("div",{className:"cv-annotation ".concat(function(){if(!s)return!1;var e=s.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},s&&i().createElement(Nn.Editor,{editorState:s,onEditorStateChange:function(e){l(e);var t=e.getCurrentContent();if(t.hasText()){var i=(0,Pn.cn)(qn)(t);r(Object.assign(Object.assign({},n),{annotation:i}))}else r(Object.assign(Object.assign({},n),{annotation:""}))},toolbarClassName:"cv-annotation-toolbar",editorClassName:"form-control cv-annotation-editor",ref:d,placeholder:"Enter your annotation here",spellCheck:!0,toolbar:{options:["inline","list","link"],inline:{options:["bold","italic","underline","superscript","subscript"],bold:{className:"cv-annotation-toolbar-option cv-annotation-bold",icon:""},italic:{className:"cv-annotation-toolbar-option cv-annotation-italic",icon:""},underline:{className:"cv-annotation-toolbar-option cv-annotation-underline",icon:""},superscript:{className:"cv-annotation-toolbar-option cv-annotation-superscript",icon:""},subscript:{className:"cv-annotation-toolbar-option cv-annotation-subscript",icon:""}},list:{options:["unordered","ordered"],unordered:{className:"cv-annotation-toolbar-option cv-annotation-bullet-list",icon:""},ordered:{className:"cv-annotation-toolbar-option cv-annotation-number-list",icon:""}},link:{component:zn,options:["link"]}}}),i().createElement(Tn,{error:n.error}))))})),j.Z9.Image,(function(e){var t,n,r,o=e.state,a=void 0===o?function(e){var t;return{url:(null===(t=e.data)||void 0===t?void 0:t.url)||"",caption:e.data.caption}}(e.interaction):o,c=e.setState,s=e.interaction,l=e.optionsPortalNode;t=Jn(),n=t.enable,r=t.disable,i().useEffect((function(){return r(),function(){return n()}}),[]);var u=i().useRef(null);function f(e){e&&e[0]&&nr.onFileSelect(ge.__.None,e,(function(e){er.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:d})}))}function d(t,n){var r=t.split(",")[1];Ln.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(r,'"'),{tokenName:"gateway"}).then((function(e){c(Object.assign(Object.assign({},a),{url:e.location})),n()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-1"},i().createElement("label",{className:"cv-interaction-field-label mb-0"},"Image"),i().createElement(ve.t0,{node:l})),a.url?i().createElement("div",{className:"text-center"},i().createElement("div",{className:"cv-uploaded-image-container"},i().createElement("img",{className:"img img-fluid",src:a.url,alt:a.caption}),i().createElement(k.L,{className:"cv-remove-uploaded-image d-flex justify-content-center align-items-center",onClick:function(){c(Object.assign(Object.assign({},a),{url:""}))}},i().createElement("div",{className:"btn btn-link text-light"},"Remove")))):i().createElement(or,{onDropImage:f},i().createElement("div",{className:"cv-image-interaction-upload-container rounded py-4 text-center"},i().createElement("div",{className:"svg-container xlg mb-2"},i().createElement(ar,null)),i().createElement("p",{className:"mb-0"},"Drag and drop an image file or"),i().createElement(k.L,{type:"button",className:"text-underline d-inline-block",onClick:function(){u.current.value=null,u.current.click(null)}},"upload from your device"),i().createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:u,onChange:function(e){return f(e.target.files)}}))),i().createElement(Tn,{error:a.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"image-caption"},"Caption ",i().createElement("span",{className:"text-secondary"},"(optional)")),i().createElement("textarea",{id:"image-caption",className:"form-control",placeholder:"Caption your image",value:a.caption||s.data.caption||"",onChange:function(e){c(Object.assign(Object.assign({},a),{caption:e.target.value}))},rows:2})))})),j.Z9.MissingWord,(function(e){var t,n,r,o,a,c,s=e.state,l=void 0===s?(o=(null===(n=(t=e.interaction).data)||void 0===n?void 0:n.sentence)||"",a=o.split(" ").filter(Boolean),c=a.map((function(e,t){return{text:e,order:t,selected:!1}})),null===(r=t.actionableItems)||void 0===r||r.forEach((function(e){var t=e.order,n=pr(a[t],e.name);a[t]=n,c[t].text=n,c[t].selected=!0})),{fullSentence:a.join(" "),sentence:o,preview:t.name,words:c}):s,u=e.setState,f=e.optionsPortalNode,d=!!l.sentence;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-1"},i().createElement("label",{className:"cv-interaction-field-label mb-0",htmlFor:"missing-word-sentence"},"Sentence"),i().createElement(ve.t0,{node:f})),i().createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:l.fullSentence||"",onChange:function(e){var t=e.target.value,n=t.split(" ").filter(Boolean).map((function(e,t){return{text:e,order:t,selected:!1}}));u(Object.assign(Object.assign({},l),{fullSentence:t,sentence:vr(n),preview:hr(n),words:n}))},autoComplete:"off"})),d&&i().createElement(i().Fragment,null,i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label"},"Select the missing word(s)"),i().createElement("ul",{className:"list-unstyled d-flex flex-wrap mx-n1 mb-n1"},l.words.map((function(e,t){var n;return(null===(n=dr(e.text))||void 0===n?void 0:n.trim())?i().createElement("li",{key:"".concat(t,"-").concat(e.text)},i().createElement(k.L,{className:"rounded border p-2 mx-1 mb-1 cursor-pointer ".concat(e.selected?"bg-blue text-white":"bg-white"),onClick:function(){return e=t,n=l.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},l),{words:n,preview:hr(n),sentence:vr(n)}));var e,n}},dr(e.text))):i().createElement(i().Fragment,{key:"".concat(t,"-").concat(e.text)})})))),i().createElement("div",null,i().createElement("label",{className:"cv-interaction-field-label"},"Preview"),i().createElement("p",null,l.preview))),i().createElement(Tn,{error:l.error}))})),j.Z9.MultipleChoice,kr),j.Z9.ShortAnswer,(function(e){var t=e.state,n=void 0===t?function(e){return{question:e.name,suggestedResponse:e.data.suggestedResponse||""}}(e.interaction):t,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center mb-1"},i().createElement("label",{className:"cv-interaction-field-label mb-0",htmlFor:"short-answer-question"},"Question"),i().createElement(ve.t0,{node:a})),i().createElement("input",{id:"short-answer-question",className:"form-control",onChange:function(e){r(Object.assign(Object.assign({},n),{question:e.target.value}))},value:n.question||o.data.text||"",placeholder:"Enter your question here",autoComplete:"off"}),i().createElement(Tn,{error:n.error})),c&&i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"short-answer-suggested-response"},"Suggested Response ",i().createElement("span",{className:"text-secondary"},"(optional)")," ",i().createElement(yr,{tooltipText:"Provide a suggested response for your students"})),i().createElement(xt.Z,{id:"short-answer-suggested-response",className:"form-control",minRows:2,value:n.suggestedResponse||"",onChange:function(e){r(Object.assign(Object.assign({},n),{suggestedResponse:e.target.value}))},placeholder:"Give a suggested response for this question"})))})),j.Z9.TrueOrFalse,kr),Pr=jr(jr(jr(jr(jr(jr({},j.Z9.Annotation,(function(e){var t;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?null:"Please provide an annotation"})),j.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),j.Z9.MissingWord,(function(e){var t;return(null===(t=e.sentence)||void 0===t?void 0:t.trim())?e.words.find((function(e){return e.selected}))?null:"Please select a missing word":"Please provide a sentence"})),j.Z9.MultipleChoice,Er),j.Z9.ShortAnswer,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),j.Z9.TrueOrFalse,Er),Ir=jr(jr(jr(jr(jr(jr({},j.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Qn().mark((function r(){return Qn().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t.name="Annotation",t.data.annotation=null===(n=e.annotation)||void 0===n?void 0:n.trim(),t.actionableItems=[{name:"Answer"}],r.next=5,Bn.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function c(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}s((a=a.apply(r,i||[])).next())}))})),j.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=sr().mark((function i(){return sr().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.data.url=e.url,t.name=(null===(n=e.caption)||void 0===n?void 0:n.trim())||"Image",t.data.caption=null===(r=e.caption)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=6,Bn.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function r(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}s((c=c.apply(i,o||[])).next())}))})),j.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=ur().mark((function n(){var r;return ur().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=vr(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:dr(e.text),order:e.order,isCorrect:!0}})),n.next=6,Bn.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{s(o.next(e))}catch(e){t(e)}}function c(e){try{s(o.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}s((o=o.apply(n,r||[])).next())}));var n,r,i,o})),j.Z9.MultipleChoice,Sr),j.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Or().mark((function i(){return Or().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t.name=null===(n=e.question)||void 0===n?void 0:n.trim(),t.data.suggestedResponse=null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim(),t.actionableItems=[{name:"Answer"}],i.next=5,Bn.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function r(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}s((c=c.apply(i,o||[])).next())}))})),j.Z9.TrueOrFalse,Sr);function Tr(e){return Ir[e]}function Lr(e){return Lr="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},Lr(e)}function Ar(){Ar=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Lr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Lr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function _r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Rr=13,Mr=37,Ur=39,Vr=null,Br=0,qr=1;function Gr(e){var t=e.timepoint,n=e.updateTimepointTime,r=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=_r(i().useState((0,vn.m)(t.visibleAt/1e3)),2),s=c[0],l=c[1],u=_r(i().useState(!1),2),f=u[0],d=u[1];function p(e){n(e*qr),l((0,vn.m)(t.visibleAt/1e3)),2==++Br?qr=5:4===Br?qr=20:6===Br?qr=60:8===Br&&(qr=120),Vr||(Vr=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",h))}function h(){window.removeEventListener("mouseup",h),window.clearInterval(Vr),Vr=null,Br=0,qr=1}return i().useEffect((function(){return h}),[]),i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-timepoint flex-grow-1"},i().createElement("div",{className:"cv-timepoint-padding"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("label",{className:"cv-interaction-field-label mb-0"},"Move time point"),i().createElement("div",{className:"text-center mt-3"},i().createElement(k.L,{className:"cv-left-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(-1)},onKeyDown:function(e){e.stopPropagation(),e.keyCode===Rr&&0===Br&&p(-1)},onKeyUp:h}),i().createElement("input",{className:"form-control text-center d-inline-block cv-move-timepoint-input",value:s,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),e.keyCode===Mr&&0===Br&&p(-1),e.keyCode===Ur&&0===Br&&p(1)},onKeyUp:h}),i().createElement(k.L,{className:"cv-right-arrow d-inline-block cursor-pointer",onClick:function(){},onMouseDown:function(){return p(1)},onKeyDown:function(e){e.stopPropagation(),e.keyCode===Rr&&0===Br&&p(1)},onKeyUp:h}))))),i().createElement("div",{className:"cv-timpoint-button-container"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){a(!0),o()}},"Cancel"),f?i().createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},i().createElement(he.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark",onClick:function(){return Dr(this,void 0,void 0,Ar().mark((function e(){return Ar().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,r();case 3:o();case 4:case"end":return e.stop()}}),e)})))}},"Save")))}var Zr=n(20455),zr=n(95339),Hr=n(67445);function Wr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Kr(e){var t,n,r=(t=i().useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Wr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wr(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1],c=(0,Zr.Dy)((0,Zr.VT)(Zr.we,{activationConstraint:{distance:10}}),(0,Zr.VT)(Zr.Lg,{coordinateGetter:Hr.is}));return e.disabled?i().createElement(i().Fragment,null,e.children):i().createElement(Zr.LB,{sensors:c,collisionDetection:Zr.pE,onDragStart:function(t){var n;a(t.active.id),null===(n=e.onSortStart)||void 0===n||n.call(e,t)},onDragEnd:function(t){a(null),e.onSortEnd(t)},modifiers:e.vertical?[zr.DL]:[]},i().createElement(Hr.Fo,{items:e.ids,strategy:e.vertical?Hr.qw:Hr.U2},e.children),i().createElement(Zr.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}Kr.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var Qr=n(17592);function Yr(e){var t=(0,Hr.nB)({id:e.id}),n=t.setNodeRef,r=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,s=t.attributes,l=t.activeIndex,u=t.overIndex,f=t.index,d={transform:Qr.ux.Transform.toString(r),transition:o,touchAction:"none",position:"relative"};a&&f===l&&(d.visibility="hidden");var p=e.childComponent,h=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,l,u);return i().createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:s,dragDirection:h}))}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},$r(e)}function Xr(){Xr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==$r(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError($r(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Jr(e){return function(e){if(Array.isArray(e))return ni(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ti(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||ti(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(e,t){if(e){if("string"==typeof e)return ni(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ni(e,t):void 0}}function ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ri=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},ii=function(e){var t=e.interaction,n=N.w.getTypeInfo(t.typeId).bgClassName,r=i().forwardRef((function(e,r){return i().createElement("div",Object.assign({className:"py-2 text-start"},e.dragAttributes,e.dragListeners,{ref:r,style:e.style}),i().createElement("span",{className:"fB8W8"},i().createElement(x.x,{size:x.S.Small,svgName:O.vn.Handle})),i().createElement(I,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return i().createElement(Yr,{id:t.id,childComponent:r,childProps:{}})},oi=function(e){var t=e.interactions,n=function(){var e=i().useRef();function t(){document.body.style.cursor="",document.removeEventListener("mouseup",t),e.current&&(e.current.style.cursor="grab")}return{ref:e,style:{cursor:"grab"},onMouseDown:function(){document.body.style.cursor="grabbing",document.addEventListener("mouseup",t),e.current&&(e.current.style.cursor="grabbing")},onMouseUp:t}}();return i().createElement(Kr,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return i().createElement(ii,{key:e,interaction:t.find((function(t){return t.id===e}))})},onSortEnd:e.onSortEnd},i().createElement("div",Object.assign({tabIndex:0},n),t.map((function(e){return i().createElement(ii,{key:e.id,interaction:e})}))))};function ai(e){var t=ei(i().useState(!1),2),n=t[0],r=t[1],o=ei(i().useState(Jr(e.interactions)),2),a=o[0],c=o[1],s=ei(i().useState(!1),2),l=s[0],u=s[1];return i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-timepoint flex-grow-1"},i().createElement("div",{className:"cv-timepoint-padding"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("label",{className:"cv-interaction-field-label mb-0"},"Re-order questions"),i().createElement("div",{className:"text-center mt-3"},i().createElement(oi,{onSortEnd:function(e){var t=e.active,n=e.over,r=a.findIndex((function(e){return e.id.toString()===t.id.toString()})),i=a.findIndex((function(e){return e.id.toString()===n.id.toString()}));r!==i&&(c(Jr(function(e,t,n){for(;t<0;)t+=e.length;for(;n<0;)n+=e.length;if(n>=e.length)for(var r=n-e.length+1;r--;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e}(a,r,i))),u(!0))},interactions:a}))))),i().createElement("div",{className:"cv-timpoint-button-container"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){c(Jr(e.interactions)),u(!1),e.back()}},"Cancel"),n?i().createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},i().createElement(he.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark ".concat(l?"":"disabled"),onClick:function(){return ri(this,void 0,void 0,Xr().mark((function t(){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l){t.next=2;break}return t.abrupt("return");case 2:return r(!0),t.next=5,e.reOrderQuestions(a);case 5:r(!1),e.back();case 7:case"end":return t.stop()}}),t)})))}},"Save")))}function ci(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return si(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function li(e){var t=e.isCreate,n=e.interaction,r=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,s=e.delayFocus,l=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,h=e.skip,v=i().useRef(),m=i().useRef(),y=i().useRef(0),g=(0,hn.a)(pn.r.XLDown),b=!t||g;function w(){return!!v.current&&!!c&&!!l}function E(){v.current&&(v.current.focus(),x(!0))}var S=ci(i().useState(!1),2),k=S[0],x=S[1];i().useEffect((function(){w()&&(k||(s&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),Wt):E()))}),[v.current,k]);var O=ci(i().useState("question"),2),C=O[0],j=O[1],N=i().useMemo((function(){return(0,ve.oD)()}),[]),P=n?function(e,t){if(t===ce.Create)return function(e){return Nr[e]}(e);if(t===ce.View)return function(e){return At[e]}(e);throw new Error("Cannot find components for the mode ".concat(t))}(n.typeId,r):null,I=o;return t||(I=I&&(null==a?void 0:a.submitted)),i().createElement(i().Fragment,null,i().createElement(wn,Object.assign({optionsPortalNode:N,setView:j},e)),i().createElement(dn.Z,{style:{height:"100%"},ref:m},i().createElement(gn,Object.assign({},e)),!!n&&i().createElement("div",{className:"d-flex flex-column h-100"},i().createElement(jn,Object.assign({},e)),"question"===C&&i().createElement(i().Fragment,null,i().createElement("form",{className:"cv-timepoint flex-grow-1",tabIndex:-1,onSubmit:function(e){e.preventDefault(),t?p():d()}},i().createElement("div",{className:"cv-timepoint-padding"},i().createElement("div",{ref:v,tabIndex:0}),i().createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){m.current.recalculate()},showFeedback:I,optionsPortalNode:N},e)))),i().createElement(kn,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),h()}},e))),"move"===C&&i().createElement(Gr,Object.assign({back:function(){return j("question")}},e)),"reorder"===C&&i().createElement(ai,Object.assign({back:function(){return j("question")},interactions:u.interactions},e)))))}function ui(e){var t=e.open,n=e.nextInteraction,r=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,s=n&&o.nextInteractionIndex<o.interactionIndex,l=n&&o.nextInteractionIndex>o.interactionIndex,u=l&&o.slideIn,f=s&&o.slideIn;return i().createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},s&&i().createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(li,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r}))),i().createElement("div",{className:"\n cv-main-slide\n ".concat(u?"cv-slide-out-up":"","\n ").concat(f?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},i().createElement(li,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!s&&!l,delayFocus:c}))),l&&i().createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(li,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r}))))}var fi=n(44645),di=n(71575),pi=n(83996),hi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,fi.s)(document.getElementById("dialog-region"));function r(){var e;l.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),n.unmount()}var o=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){var e;l.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)&&t.submitButtonProps.onClick(),n.unmount()}}),a=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){r()}});n.render(i().createElement(di.G,{title:t.title,closePopup:r,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&i().createElement(pi.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&i().createElement(pi.u.Cancel,Object.assign({},a)),t.submitButtonProps&&i().createElement(pi.u.Submit,Object.assign({},o)))))};function vi(e){return vi="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},vi(e)}function mi(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=vi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yi={interactions:{},timepoints:{}};function gi(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),mi({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),mi({},t.id,t.value))}:void 0}function bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var wi={interactionIndex:0},Ei=function(e){var t,n,r=e.mode,o=e.timepoint,a=e.latestSession,c=r===ce.Create,s=i().useReducer(gi,null,(function(){return function(e){return e?{timepoints:{},interactions:e.actions.reduce((function(e,t){return e[t.interactionId]=Object.assign(Object.assign({},e[t.interactionId]),mi(mi({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:yi}(a)})),l=(n=2,function(e){if(Array.isArray(e))return e}(t=s)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return bi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],f=l[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],h="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,v=g(null==p?void 0:p.id),m=g(null==h?void 0:h.id);function y(e){return e&&u.timepoints[e]||wi}function g(e){if(!e)return{};var t=u.interactions[e];return t||c?t:{}}function b(e,t,n){var r=g(e);f({type:"interaction",id:e,value:Object.assign(Object.assign({},n?{}:r),t)})}return{state:u,interaction:p,interactionState:v,timepointState:d,nextInteraction:h,nextInteractionState:m,getTimepointState:y,getInteractionState:g,updateTimepointState:function(e,t){var n=y(e);f({type:"timepoint",id:e,value:Object.assign(Object.assign({},n),t)})},updateInteractionState:b,clearTimepointState:function(e){f({type:"timepoint",id:e,value:void 0})},clearInteractionState:function(e){f({type:"interaction",id:e,value:void 0})},userUpdateInteractionState:function(e,t){b(p.id,Object.assign(Object.assign({},e),{hasChanges:!0,error:null}),t)}}};function Si(e){return Si="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},Si(e)}function ki(){ki=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Si(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Si(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}var xi=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Oi=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},Ci=!1;function ji(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ni(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ni(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Pi=n(25417),Ii=n(81937),Ti=n(69184);function Li(e,t){if(e){if("string"==typeof e)return Ai(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(e,t):void 0}}function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _i=_e.T.encloseNamespace("shared.hooks"),Fi=function(){var e,t,n=(e=i().useState([]),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||Li(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=n[0],o=n[1],a=Yn.Radio.channel(Pi.G.SHELL);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.find((function(t){return t.id===e.id}))||(e.allowAppLinks||a.trigger(V.Q.Vy.LOCK_NAV),o([].concat(function(e){return function(e){if(Array.isArray(e))return Ai(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Li(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r),[e])))}function s(e){var t=r.filter((function(t){return t.id!==e}));0!==t.length&&t.find((function(e){return!e.allowAppLinks}))||a.trigger(V.Q.Vy.UNLOCK_NAV),o(t)}function u(e){var t;if(r.length){var n=r.find((function(e){return!e.allowAppLinks}));if(null===(t=n.appLinkWhitelist)||void 0===t?void 0:t.find((function(t){return t.action===e.action&&t.application===e.application})))return a.trigger(V.Q.Vy.UNLOCK_NAV),void window.setTimeout((function(){V.Q.C$.trigger(e),a.trigger(V.Q.Vy.LOCK_NAV)}),0);l.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():hi(i().createElement("p",null,n.text),{title:n.title,submitButtonProps:{onClick:function(){n.onConfirmUnlock&&n.onConfirmUnlock(),function(e){a.trigger(V.Q.Vy.NAV_UNLOCKED_BY_USER),r.forEach((function(e){e.allowAppLinks||s(e.id)})),window.removeEventListener("beforeunload",f),V.Q.C$.trigger(e)}(e)},variant:"danger",text:_i("discard")},cancelButtonProps:{text:_i("cancel"),variant:"outline-dark"}})}}function f(e){var t=r.find((function(e){return e.allowAppLinks}));return t||(t=Ie.m.first(r)),e.returnValue=t.text,t.text}return i().useEffect((function(){return r.find((function(e){return!e.allowAppLinks}))&&a.on(V.Q.Vy.NAV_IS_LOCKED,u),r.length&&window.addEventListener("beforeunload",f),function(){a.off(V.Q.Vy.NAV_IS_LOCKED,u),window.removeEventListener("beforeunload",f)}}),[r]),i().useEffect((function(){function e(){c({id:"upload",title:_i("navLockTitle"),text:_i("navLockBody"),allowAppLinks:!0})}var t=Yn.Radio.channel(Ti.Q4.VIDEO_UPLOAD);return t.on(Ii.S.FILES_ADDED,e),t.on(Ii.S.UNLOCK_NAV,s),function(){t.off(Ii.S.FILES_ADDED,e),t.off(Ii.S.UNLOCK_NAV,s)}}),[]),{lock:c,unlock:s}};function Di(e){return Di="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},Di(e)}function Ri(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mi(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,Vi(r.key),r)}}function Ui(e,t,n){return t&&Mi(e.prototype,t),n&&Mi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vi(e){var t=function(e,t){if("object"!=Di(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Di(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Di(t)?t:t+""}function Bi(e,t,n){return t=Zi(t),function(e,t){if(t&&("object"==Di(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,qi()?Reflect.construct(t,n||[],Zi(e).constructor):t.apply(e,n))}function qi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(qi=function(){return!!e})()}function Gi(){return Gi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Zi(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Gi.apply(null,arguments)}function Zi(e){return Zi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zi(e)}function zi(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hi(e,t)}function Hi(e,t){return Hi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hi(e,t)}var Wi=function(e){function t(e,n){return Ri(this,t),Bi(this,t,[e,n])}return zi(t,e),Ui(t,[{key:"dispose",value:function(){var e=this;setImmediate((function(){var t;null===(t=e.root)||void 0===t||t.unmount()})),Gi(Zi(t.prototype),"dispose",this).call(this)}}])}(q.Z.getComponent("Component")),Ki={tagName:"div"};function Qi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ki;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return Ri(this,r),Bi(this,r,arguments)}return zi(r,n),Ui(r,[{key:"createEl",value:function(){var n=q.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,fi.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(Wi);return n}var Yi=n(42120),$i=n(50028);function Xi(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===$i.X.Published,r=function(e){var t,n=0;return null===(t=null==e?void 0:e.timepoints)||void 0===t||t.forEach((function(e){var t;return null===(t=e.interactions)||void 0===t?void 0:t.forEach((function(){return n++}))})),n>0}(e.interactive)&&n,o=[];return e.onClickEditDetails&&o.push({label:"Edit details",svgName:O.vn.Edit,button:!0,className:"btn btn-outline-dark",onClick:e.onClickEditDetails}),e.onClickPublish&&o.push({label:"Publish",button:!0,className:"btn btn-dark ms-2".concat(r?"":" disabled"),disabled:!r,tooltip:r?"":n?"Interactives cannot be published without questions":"Parent video must be published before interactives can be published",onClick:function(){r&&e.onClickPublish&&e.onClickPublish()}}),e.onClickCopy&&o.push({label:"Copy interactive",button:!1,onClick:e.onClickCopy}),e.onClickDelete&&o.push({label:"Delete interactive",button:!1,onClick:e.onClickDelete,className:"text-danger"}),o.length?i().createElement(ve.Nq,{node:e.portalNode},i().createElement(Yi.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):i().createElement(i().Fragment,null)}var Ji=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 eo(e){var t=e.title,n=e.player,r=e.track,o=e.mode,a=e.interactive,c=e.imageApi,s=e.actionsPortalNode,l=e.questionListPortalNode,u=e.summaryPortalNode,f=e.resultsService,p=e.currentUser,h=e.progress,v=e.latestSession,m=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=function(e){var t=e.player,n=e.track,r=e.interactive,o=e.clipOffset,a=ji(i().useState(!1),2),c=a[0],s=a[1],l=ji(i().useState(!1),2),u=l[0],f=l[1],d=ji(i().useState(null),2),p=d[0],h=d[1];function v(e){return o?e+o:e}function m(e){f(!!e&&c),s(e)}function y(){var e=n.activeCues;if(!e.length)return m(!1),void h(null);var i=r.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!i)return m(!1),void h(null);i.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),m(!0),h(i)}function g(e){for(var t=0;t<n.cues.length;t++){var r=n.cues[t];if(r.text.toString()===e.toString())return r}}return i().useEffect((function(){return n.addEventListener("cuechange",y),function(){return n.removeEventListener("cuechange",y)}})),{open:c,setOpen:m,wasOpen:u,timepoint:p,continueInteractive:function(){m(!1),t.play()},updateCue:function(e,t){var n=g(e);n.text=t.toString(),n.originalCue_.text=t.toString()},addCue:function(e){var r=t.currentTime();n.addCue({startTime:v(r)-.001,endTime:v(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=v(e);for(var t=0;t<n.cues.length;){var r=n.cues[t];if(r.startTime<=e&&r.endTime>=e){n.removeCue(r),n.trigger("cv:cuechange"),n.trigger("cuechange");break}t++}},moveTimepoint:function(e){var r=g(p.id);if(r){var i=e/1e3;r.startTime=v(i),r.endTime=v(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:v}}({player:n,track:r,interactive:a,mode:o,clipOffset:m}),S=E.open,k=E.timepoint,x=E.wasOpen,O=Ji(E,["open","timepoint","wasOpen"]),C=function(e){var t=e.interactive,n=e.timepoint,r=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,s=e.analyticsService,l=Oi(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService"]),u=Ei({mode:o,timepoint:n,latestSession:c}),f=u.state,p=u.interaction,h=u.interactionState,v=u.timepointState,m=u.nextInteraction,y=u.nextInteractionState,g=Oi(u,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),b=o===ce.Create;function w(e){for(var n=0;n<t.timepoints.length;){for(var r=t.timepoints[n],i=0;i<r.interactions.length;){var o=r.interactions[i];if(o.id===e)return{localTimepoint:r,localInteraction:o};i++}n++}return{localInteraction:null,localTimepoint:null}}function E(e){var n=N.w.getTypeInfo(e.typeId);return{id:Kt(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:Kt(e.timepointId)?void 0:e.timepointId,order:e.order}}function S(e){return xi(this,void 0,void 0,ki().mark((function n(){var r,i,o,a,c,u,f;return ki().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=w(e),i=r.localInteraction,o=r.localTimepoint,i&&o){n.next=3;break}throw new Error("Could not find the interaction and timepoint for the interactionId ".concat(e));case 3:if(a=E(i),Kt(i.id)){n.next=10;break}return n.next=7,Bn.deleteInteraction(i.id);case 7:null==s||s.logUserAction(a,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Complete}),n.next=11;break;case 10:null==s||s.logUserAction(a,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Discard});case 11:if(c=o.interactions.findIndex((function(e){return e.id===i.id})),o.interactions.splice(c,1),g.clearInteractionState(i.id),u=g.getTimepointState(o.id),c<u.interactionIndex&&g.updateTimepointState(o.id,{interactionIndex:u.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(Kt(o.id)){n.next=21;break}return n.next=21,Bn.deleteTimepoint(o.id);case 21:f=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(f,1),l.removeCue(o.visibleAt/1e3),g.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function k(e){if(p){var t=Kt(p.id);t||(null==h?void 0:h.hasChanges)||(null==v?void 0:v.hasChanges)?hi(i().createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==v?void 0:v.hasChanges)&&P(!0),t?S(p.id):g.clearInteractionState(p.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function x(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(b)k((function(){g.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){g.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){g.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){g.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),Wt)}))};t?k(r):r()}}function O(){v.interactionIndex+1>=n.interactions.length?l.continueInteractive():x(v.interactionIndex+1,!1)}function C(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function j(){x(n.interactions.length)}function P(e){(null==v?void 0:v.hasChanges)&&(e&&l.moveTimepoint(v.originalVisibleAt),g.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),Ci=!1)}return{state:f,interaction:p,interactionState:h,timepointState:v,nextInteraction:m,nextInteractionState:y,skip:O,cancel:function(){return xi(this,void 0,void 0,ki().mark((function e(){return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return k(),e.abrupt("return");case 3:return e.next=5,S(p.id);case 5:l.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:j,goToTimepoint:function(e,n){var i=function(e){for(var n=0;n<t.timepoints.length;){var r=t.timepoints[n];if(r.id===e)return r;n++}return null}(e),o=i.interactions.find((function(e){return e.id.toString()===n.toString()}));r.currentTime(i.visibleAt/1e3),g.updateTimepointState(i.id,{interactionIndex:i.interactions.indexOf(o)})},discardChanges:k,changeIndex:x,promptDelete:function(e){var t=E(w(e).localInteraction);null==s||s.logUserAction(t,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Start}),hi(i().createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return S(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){r.pause(),l.setOpen(!0),n&&j()},cancelTypeSelector:function(){n?x(v.interactionIndex-1):(l.setOpen(!1),r.play())},deleteInteraction:S,saveInteraction:function(){return xi(this,void 0,void 0,ki().mark((function e(){var t,r,i,o,a,c,u;return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(f=p.typeId,t=Pr[f],!(r=t(g.getInteractionState(p.id),p))){e.next=7;break}return g.updateInteractionState(p.id,{error:r}),e.abrupt("return");case 7:if(g.updateInteractionState(p.id,{spinner:!0}),!Kt(n.id)){e.next=15;break}return i=n.id,e.next=12,Bn.saveTimepoint(n);case 12:l.updateCue(i,n.id),g.clearTimepointState(i),(null==v?void 0:v.hasChanges)&&(C(),P());case 15:return p.timepointId=n.id,o=p.id,a=Tr(p.typeId),e.next=20,a(g.getInteractionState(p.id),p);case 20:g.clearInteractionState(o),c=Kt(o),u=E(p),null==s||s.logUserAction(u,{actionType:c?d.Vw.Create:d.Vw.Edit,entity:d.py.Interaction,workflowPhase:c?d.eu.Complete:d.eu.Save});case 24:case"end":return e.stop()}var f}),e)})))},addInteraction:function(e){var i;r.pause();var o=(null==n?void 0:n.id)||"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),a={id:"new_".concat(Math.round(Math.random()*Number.MAX_SAFE_INTEGER)),timepointId:o,typeId:e,order:(null===(i=null==n?void 0:n.interactions)||void 0===i?void 0:i.length)||0,interactiveId:t.id,data:{}},c=E(a);if(null==s||s.logUserAction(c,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Start}),n)return n.interactions.push(a),void x(v.interactionIndex);var u=r.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*u,interactiveId:t.id,shouldPause:1,interactions:[a]}),C(),l.addCue(o)},submitInteractionAnswer:function(){return xi(this,void 0,void 0,ki().mark((function e(){var r,i,c,u,f;return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o===ce.View){e.next=2;break}throw new Error("Should not be calling onClickSubmit while creating an interactive");case 2:if(!h.submitted){e.next=8;break}if(!(v.interactionIndex>=n.interactions.length)){e.next=6;break}return l.continueInteractive(),e.abrupt("return");case 6:return x(v.interactionIndex+1),e.abrupt("return");case 8:if(r=Qt(h),m=p.typeId,i=Ft[m],!(c=i(r,p))){e.next=14;break}return g.updateInteractionState(p.id,{error:c}),e.abrupt("return");case 14:if(!a||!h.hasChanges){e.next=22;break}if(u=Rt(p.typeId),g.updateInteractionState(p.id,{spinner:!0}),!u){e.next=22;break}return e.next=20,u(r,p,a.save);case 20:f=E(p),null==s||s.logUserAction(f,{actionType:d.Vw.Submit,entity:d.py.Interaction});case 22:if(g.updateInteractionState(p.id,{submitted:!0,error:null,hasChanges:!1,spinner:!1}),t.immediateFeedback){e.next=26;break}return O(),e.abrupt("return");case 26:Lt(p.typeId)(p)||O();case 29:case"end":return e.stop()}var m}),e)})))},userUpdateInteractionState:g.userUpdateInteractionState,updateTimepointTime:function(e){var i=r.duration(),o=function(e){for(var r=n.visibleAt+1e3*e,i=e>0,o=0;o<t.timepoints.length;o++){var a=t.timepoints[o];r<a.visibleAt-1e3||r>a.visibleAt+1e3||(r=i?a.visibleAt+1001:a.visibleAt-1001,o=0)}return r}(e);if(!(o/1e3>i||o<0)){var a=n.visibleAt;Ci||(Ci=!0,g.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),l.moveTimepoint(o)}},saveTimepoint:function(){return xi(this,void 0,void 0,ki().mark((function e(){return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Kt(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Bn.updateTimepoint(n);case 4:C(),P();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:P,reOrderQuestions:function(e){return xi(this,void 0,void 0,ki().mark((function t(){var r,i;return ki().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r<e.length)){t.next=7;break}return t.next=4,Bn.saveInteraction(Object.assign(Object.assign({},e[r]),{order:r}));case 4:r++,t.next=1;break;case 7:i=n.interactions[v.interactionIndex],n.interactions=e,g.updateTimepointState(n.id,{interactionIndex:e.indexOf(i)});case 10:case"end":return t.stop()}}),t)})))}}}(Object.assign({mode:o,interactive:a,timepoint:k,player:n,resultsService:f,latestSession:v,analyticsService:y},O)),j=C.interaction,P=C.interactionState,I=C.nextInteraction,T=C.nextInteractionState,L=C.timepointState,A=C.state,_=Ji(C,["interaction","interactionState","nextInteraction","nextInteractionState","timepointState","state"]);!function(e){var t,n=e.mode,r=e.player,o=e.timepoint,a=e.interaction,c=e.discardChanges,s=e.interactionState,l=e.timepointState,u=Fi(),f=n===ce.Create;i().useEffect((function(){if(f){if(Kt(null==a?void 0:a.id)||(null==s?void 0:s.hasChanges)||(null==l?void 0:l.hasChanges))return u.lock({id:"interactive",title:"Are you sure you want to leave?",text:"Your interactive still has unsaved changes"}),void r.lock((function(e){c(e)}));r.unlock(),u.unlock("interactive")}}),[a,null==s?void 0:s.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==l?void 0:l.hasChanges])}({mode:o,player:n,timepoint:k,interaction:j,discardChanges:_.discardChanges,interactionState:P,timepointState:L});var F={mode:o,open:S,isCreate:o===ce.Create,interaction:j,nextInteraction:I,timepoint:k,interactive:a,interactionState:P,nextInteractionState:T,timepointState:L,player:n};return i().createElement(i().Fragment,null,!!s&&i().createElement(Xi,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:s,parentVideo:w}),i().createElement(de,Object.assign({},F,_)),i().createElement(ui,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!x,enableImmersiveReader:g},F,_,O)),i().createElement(cn,Object.assign({title:t,currentUser:p,state:A,portalNode:u,progress:h,resultsService:f,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},F,_)),i().createElement(fn,Object.assign({portalNode:l},F,_)))}q.Z.registerComponent("Interactive",Qi((function(e,t){return i().createElement(eo,Object.assign({player:e},t))})));function to(e){var t=e.player;function n(){var e=t.getChild("ContinueSession");t.removeChild(e),e.dispose()}function r(){e.continue(!0),n()}return i().createElement(di.G,{title:"Continue interactive?",closePopup:r,dialogClassName:"VVqKz"},i().createElement("p",null,"It looks like you've already started this interactive. Would you like to continue your attempt or start a new one?"),i().createElement(pi.u,{className:"kw8gW"},i().createElement(pi.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),i().createElement(pi.u.Submit,{variant:"dark",text:"Continue",onClick:r})))}function no(e){return no="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},no(e)}function ro(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,io(r.key),r)}}function io(e){var t=function(e,t){if("object"!=no(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=no(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==no(t)?t:t+""}function oo(e,t,n){return t=co(t),function(e,t){if(t&&("object"==no(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ao()?Reflect.construct(t,n||[],co(e).constructor):t.apply(e,n))}function ao(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ao=function(){return!!e})()}function co(e){return co=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},co(e)}function so(e,t){return so=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},so(e,t)}q.Z.registerComponent("ContinueSession",Qi((function(e,t){return i().createElement(to,Object.assign({player:e},t))})));var lo=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=oo(this,t,[e])).enabled=!1,n.player.ready((function(){return n.initialize()})),n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&so(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.onReceiveMessage=this.onReceiveMessage.bind(this),window.addEventListener("message",this.onReceiveMessage,!1),window.parent.postMessage(JSON.stringify({type:"cv-app-loaded"}),"*")}},{key:"dispose",value:function(){window.removeEventListener("message",this.onReceiveMessage)}},{key:"onReceiveMessage",value:function(e){var t={};try{t=JSON.parse(e.data)}catch(e){return}"enable-grade-passback"===t.type&&(this.enabled=!0,window.removeEventListener("message",this.onReceiveMessage))}},{key:"submit",value:function(e,t){var n={type:"cv-lms-submit-score",data:{score:e,fullyGraded:t}};window.parent.postMessage(JSON.stringify(n),"*")}}])&&ro(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getPlugin("plugin"));function uo(e){return uo="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},uo(e)}function fo(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,po(r.key),r)}}function po(e){var t=function(e,t){if("object"!=uo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=uo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==uo(t)?t:t+""}function ho(e,t,n){return t=mo(t),function(e,t){if(t&&("object"==uo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,vo()?Reflect.construct(t,n||[],mo(e).constructor):t.apply(e,n))}function vo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(vo=function(){return!!e})()}function mo(e){return mo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},mo(e)}function yo(e,t){return yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yo(e,t)}q.Z.registerPlugin("gradePassbackPlugin",lo);var go=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=ho(this,t,[e])).continueSession=!1,r.options=n,e.ready((function(){return r.initialize()})),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yo(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),le.O.useTrack(this.player,"metadata","interactive",this.onTrackLoaded.bind(this)),this.player.addClass("cv-interactive-plugin"),this.options.resultsService&&!this.options.latestSession&&(this.startSession=this.startSession.bind(this),this.player.one("play",this.startSession),this.on("dispose",(function(){e.player.off("play",e.startSession)})))}},{key:"startSession",value:function(){var e,t=null===(e=this.options.latestSession)||void 0===e?void 0:e.resultId;this.continueSession||(t=null),this.options.resultsService.start(t)}},{key:"onTrackLoaded",value:function(e){var t=this;this.options.resultsService&&this.options.latestSession?this.player.addChild("ContinueSession",{continue:function(n){var r;null===(r=t.options.analyticsService)||void 0===r||r.logUserAction({},{actionType:d.Vw.Click,entity:d.py.Interactive,descriptor:n?d.r.ContinueSession:d.r.NewSession}),t.continueSession=n,t.startSession(),t.addChildren(e),t.continueSession||t.player.currentTime(0),t.player.play()}}):this.addChildren(e)}},{key:"getClipOffset",value:function(){return this.options.clipOffset?parseFloat(this.options.clipOffset.toPrecision(4)):null}},{key:"addChildren",value:function(e){this.player.addChild("Interactive",Object.assign(Object.assign({},this.options),{track:e,clipOffset:this.getClipOffset(),mode:this.options.mode||ce.View,latestSession:this.continueSession&&this.options.latestSession})),this.player.controlBar.getChild("progressControl").getChild("SeekBar").addChild(new se(this.player,{interactive:this.options.interactive,track:e}))}}])&&fo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getPlugin("plugin"));function bo(e){return bo="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},bo(e)}function wo(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,Eo(r.key),r)}}function Eo(e){var t=function(e,t){if("object"!=bo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=bo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bo(t)?t:t+""}function So(e,t,n){return t=xo(t),function(e,t){if(t&&("object"==bo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ko()?Reflect.construct(t,n||[],xo(e).constructor):t.apply(e,n))}function ko(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ko=function(){return!!e})()}function xo(e){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xo(e)}function Oo(e,t){return Oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oo(e,t)}q.Z.registerPlugin("viewInteractivePlugin",go),n(51976);var Co=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),So(this,t,["Could not connect to submit interactive results"])}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oo(e,t)}(t,e),n=t,(r=[{key:"name",get:function(){return"InternetConnectivityError"}},{key:"dialogOptions",get:function(){return{title:"Connection issues",text:"There seems to be an issue with your internet connection. Refresh the page to try again. ",buttons:[{text:"Refresh",className:"btn btn-dark",success:!0}]}}},{key:"onDone",value:function(){window.location.reload()}}])&&wo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(n(85835).S);function jo(e){return jo="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},jo(e)}function No(){No=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==jo(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(jo(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Po(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,Io(r.key),r)}}function Io(e){var t=function(e,t){if("object"!=jo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=jo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jo(t)?t:t+""}var To=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},Lo=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.save=this.save.bind(this)},(t=[{key:"start",value:function(e){e&&(this.resultId=e),this.startSession()}},{key:"startSession",value:function(){return To(this,void 0,void 0,No().mark((function e(){var t,n,r,i,o,a,c,s,l;return No().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.resultId){e.next=2;break}return e.abrupt("return");case 2:return t=this.options,n=t.interactiveId,r=t.metadataId,i=t.userId,o=t.customerId,a=t.shareId,c=t.playerApi,s={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a},e.prev=4,e.next=7,Ln.e.post(c+"interactive/start-session",JSON.stringify(s));case 7:l=e.sent,this.resultId=l.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),V.Q.Ry.throw(new Co);case 14:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"save",value:function(e,t){return To(this,void 0,void 0,No().mark((function n(){var r;return No().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.resultId){n.next=3;break}return n.next=3,this.startSession();case 3:return r={resultId:this.resultId,interactionId:e,results:t},n.prev=4,n.next=7,Ln.e.post(this.options.playerApi+"interactive/save-actions",JSON.stringify(r),void 0,!1);case 7:n.next=13;break;case 9:n.prev=9,n.t0=n.catch(4),console.log(n.t0),V.Q.Ry.throw(new Co);case 13:case"end":return n.stop()}}),n,this,[[4,9]])})))}}])&&Po(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),Ao=n(6950);function _o(e){return _o="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},_o(e)}function Fo(){Fo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==_o(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_o(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Do(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ro(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,Mo(r.key),r)}}function Mo(e){var t=function(e,t){if("object"!=_o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_o(t)?t:t+""}function Uo(e,t,n){return t=qo(t),function(e,t){if(t&&("object"==_o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Vo()?Reflect.construct(t,n||[],qo(e).constructor):t.apply(e,n))}function Vo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vo=function(){return!!e})()}function Bo(){return Bo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=qo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Bo.apply(null,arguments)}function qo(e){return qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qo(e)}function Go(e,t){return Go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Go(e,t)}var Zo=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Uo(this,t,[e,n])).totalProgress=[],Ln.e.setToken("gateway",r.options.authToken),r.options.mode===ce.Create&&r.player.addClass("cv-create-interactives"),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Go(e,t)}(t,e),n=t,r=[{key:"togglePreviewPreventScrubbing",value:function(){var e=this.player.preventScrubbingPlugin();e&&e.togglePreview(!e.isPreviewing)}},{key:"getPlayerOptions",value:function(){var e=Bo(qo(t.prototype),"getPlayerOptions",this).call(this);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e}},{key:"onFlushProgress",value:function(e){var n;Bo(qo(t.prototype),"onFlushProgress",this).call(this,e),this.options.mode!==ce.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return Do(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Do(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Do(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e))}},{key:"additionalSetup",value:function(e){var n,r,i,o,a=this,c=Object.create(null,{additionalSetup:{get:function(){return Bo(qo(t.prototype),"additionalSetup",a)}}});return n=this,r=void 0,i=void 0,o=Fo().mark((function t(){return Fo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c.additionalSetup.call(this,e),this.setupClipPlugin(e),this.setupPreventScrubbingPlugin(e);case 3:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(e,t){function a(e){try{s(o.next(e))}catch(e){t(e)}}function c(e){try{s(o.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}s((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){Bo(qo(t.prototype),"setupAnalyticsDependentPlugins",this).call(this,e),this.setupViewInteractivePlugin(e)}},{key:"handleAutoplay",value:function(e){var n;this.options.collectResults&&this.options.currentUser&&this.options.shareId&&(null===(n=e.additionalData)||void 0===n?void 0:n.latestSession)?this.options.autoplay&&this.showSplash():Bo(qo(t.prototype),"handleAutoplay",this).call(this,e)}},{key:"setupPreventScrubbingPlugin",value:function(e){var t,n;if(null===(t=e.additionalData)||void 0===t?void 0:t.interactive){var r=e.additionalData.interactive,i=this.options.mode===ce.Create||!this.options.collectResults;this.player.preventScrubbingPlugin({isEnabled:!i&&r.preventScrubbing,furthestVisitedTime:null!==(n=this.options.furthestVisitedTime)&&void 0!==n?n:0})}}},{key:"setupClipPlugin",value:function(e){var t;if(null===(t=null==e?void 0:e.additionalData)||void 0===t?void 0:t.clipData){var n=e.additionalData.clipData;this.player.clipPlugin({startTime:n.startTime,endTime:n.endTime})}}},{key:"setupViewInteractivePlugin",value:function(e){var t;this.track=function(e,t){var n,r=e.addTextTrack("metadata","interactive"),i=t.additionalData.interactive,o=null===(n=t.additionalData.clipData)||void 0===n?void 0:n.startTime;return i.timepoints.forEach((function(e){var t,n=e.visibleAt/1e3,i=e.visibleFor?n+e.visibleFor/1e3:n+1;o&&(n+=o,i+=o),(null===(t=e.interactions)||void 0===t?void 0:t.length)&&r.addCue({startTime:Math.max(.001,n-.001),endTime:i,text:e.id})})),r}(this.player,e);var n=e.additionalData.interactive,r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.options.currentUser||V.Q.Ry.throw(new B.H("Must provide a currentUser in order to collect interactive results")),this.options.shareId||V.Q.Ry.throw(new B.H("Must provide a shareId in order to collect interactive results")),this.resultsService=new Lo({interactiveId:n.id,metadataId:e.mediaId,userId:this.options.currentUser.id,customerId:this.options.currentUser.customerId,playerApi:this.options.playerApi,shareId:this.options.shareId})),this.player.viewInteractivePlugin({interactive:n,title:e.title,mode:this.options.mode,imageApi:this.options.imageApi,resultsService:this.resultsService,actionsPortalNode:this.options.actionsPortalNode,questionListPortalNode:this.options.questionListPortalNode,summaryPortalNode:this.options.summaryPortalNode,currentUser:this.options.currentUser,latestSession:e.additionalData.latestSession,progress:this.totalProgress,parentVideo:this.options.parentVideo,clipOffset:r,analyticsService:this.analyticsService,enableImmersiveReader:this.options.enableImmersiveReader,onShowSummary:this.options.onShowSummary,onClickCopy:this.options.onClickCopy,onClickEditDetails:this.options.onClickEditDetails,onClickPublish:this.options.onClickPublish,onClickDelete:this.options.onClickDelete,mobile:this.options.mobile})}},{key:"getAdditionalAnalyticsData",value:function(e){var t,n,r,i;return(null===(n=null===(t=e.additionalData)||void 0===t?void 0:t.clipData)||void 0===n?void 0:n.clipId)?{clip:{id:null===(i=null===(r=e.additionalData)||void 0===r?void 0:r.clipData)||void 0===i?void 0:i.clipId}}:{}}},{key:"getSeekBarOptions",value:function(){return{ignoreChapters:!0}}},{key:"getAnalyticsPlayerType",value:function(){return"interactive-player"}},{key:"setActivityStatus",value:function(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}}],r&&Ro(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ao.r);function zo(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var Ho=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 Wo(e){var t=e.onReady,n=e.className,r=Ho(e,["onReady","className"]),o=i().useRef();return i().useEffect((function(){var e=new Zo(o.current,r);return t&&e.ready((function(){t(zo(e))})),function(){window.requestAnimationFrame((function(){return e.dispose()}))}}),[]),i().createElement(i().Fragment,null,i().createElement("div",{ref:o,className:n}),i().createElement("div",{id:"popup-region"}))}var Ko={placeholder:"YUoDl"};function Qo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Yo(){return i().createElement("div",{className:"".concat(Ko.placeholder," partial-loading-background")})}function $o(e){var t,n,r,o=(n=i().useState(),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Qo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qo(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],c=o[1];return i().useEffect((function(){e.createViewKey(null,(function(e){c(e.get("viewKey"))}))}),[e.video.id]),a?i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(Wo,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:a,currentUser:e.currentUser,imageApi:new URL(e.config.get("imageCdnUrl")),furthestVisitedTime:null===(t=e.video._videoProgress)||void 0===t?void 0:t.furthest})):i().createElement(Yo,null)}var Xo=n(82602),Jo={avatarContainer:"hwnEk",comment:"LyFKD"},ea="libraryRequests.comments",ta=_e.T.encloseNamespace(ea);function na(e){var t,n,r,o,a,c,s=e.comment,l="".concat(null===(t=s.user)||void 0===t?void 0:t.name," ").concat(null===(n=s.user)||void 0===n?void 0:n.surname);return s.user||(l=ta("deletedUser")),i().createElement("div",{className:"d-flex ".concat(Jo.comment)},i().createElement("div",{className:"".concat(Jo.avatarContainer," me-2 flex-shrink-0")},i().createElement(be.q,{imageUrl:null===(o=null===(r=s.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:Ae.l.getInitials(null===(a=s.user)||void 0===a?void 0:a.name,null===(c=s.user)||void 0===c?void 0:c.surname)})),i().createElement("div",null,i().createElement("span",{className:"fw-bold pe-2"},l),i().createElement("span",{className:"text-secondary"},(0,Xo.WU)(s.dateCreated)),i().createElement("p",{className:"mb-0"},s.message)))}function ra(e){var t;return(null===(t=e.comments)||void 0===t?void 0:t.length)?i().createElement("div",{className:"pb-3 border-bottom mb-3"},i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:ea,phrase:"comments"})),i().createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return i().createElement(na,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):i().createElement(i().Fragment,null)}var ia=n(56285),oa=n(41087),aa=n(98496),ca=n(50997),sa=n(89707),la={seriesLink:"Z5BW7"};function ua(e){var t,n;return(null===(n=null===(t=e.items)||void 0===t?void 0:t.data)||void 0===n?void 0:n.length)?i().createElement("p",{className:"mb-0"},e.items.data.map((function(e,t){return i().createElement("span",{key:t},e.name)}))):null}function fa(e){var t,n,r,o,a,c,s,l,u,f,d,p,h,v,m=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==m?void 0:m.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==m?void 0:m.name)||e.libraryRequest.name),!!m&&i().createElement(i().Fragment,null,!!m.series&&i().createElement(g,{phrase:"series"},i().createElement("a",{target:"_blank",href:(p=m.series,h=e.config,v="series/".concat(p.id),sa.k.getMainProductUrl(h,v,v)),className:"".concat(la.seriesLink," text-reset")},m.series.name,i().createElement(aa.Q,{video:m,withSeriesTitle:!0}))),!!(null===(t=m.rating)||void 0===t?void 0:t.code)&&i().createElement(g,{phrase:"rating"},i().createElement("div",{className:"d-flex"},i().createElement(oa.C,{type:oa.g.Rating,data:m.rating}))),!!m.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},m.description)),!!m.productionYear&&i().createElement(g,{phrase:"productionYear"},m.productionYear),!!(null===(r=null===(n=m.producers)||void 0===n?void 0:n.data)||void 0===r?void 0:r.length)&&i().createElement(g,{phrase:"producers"},i().createElement(ua,{items:m.producers})),!!(null===(a=null===(o=m.directors)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)&&i().createElement(g,{phrase:"directors"},i().createElement(ua,{items:m.directors})),!!(null===(s=null===(c=m.productionCompanies)||void 0===c?void 0:c.data)||void 0===s?void 0:s.length)&&i().createElement(g,{phrase:"productionCompanies"},i().createElement(ua,{items:m.productionCompanies})),!!(null===(u=null===(l=m.distributors)||void 0===l?void 0:l.data)||void 0===u?void 0:u.length)&&i().createElement(g,{phrase:"distributors"},i().createElement(ua,{items:m.distributors})),!e.hideBroadcastInfo&&!!(null===(f=m.channel)||void 0===f?void 0:f.name)&&i().createElement(g,{phrase:"channel"},null===(d=m.channel)||void 0===d?void 0:d.name),!e.hideBroadcastInfo&&!!m.dateBroadcast&&i().createElement(g,{phrase:"broadcastDate"},ia.O.format(m.dateBroadcast,ca.K4.FULL_YEAR))))}var da,pa,ha=n(10423),va=n(33937);function ma(e){return ma="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},ma(e)}function ya(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,ga(r.key),r)}}function ga(e){var t=function(e,t){if("object"!=ma(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ma(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(da||(da={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(pa||(pa={}));var ba=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this[Symbol.toStringTag]=t[Symbol.toStringTag],this.innerPromise=t,this.onTimeout=n,this.bindFunctions()}return t=e,r=[{key:"reject",value:function(t){return new e(Promise.reject(t))}},{key:"fromPromise",value:function(t){return new e(t)}}],(n=[{key:"bindFunctions",value:function(){this.timeout=this.timeout.bind(this),this.then=this.then.bind(this),this.catch=this.catch.bind(this),this.finally=this.finally.bind(this)}},{key:"timeout",value:function(e){var t=this;return new Promise((function(n,r){t.then(n).catch(r).finally((function(){return clearTimeout(i)}));var i=setTimeout((function(){var e;null===(e=t.onTimeout)||void 0===e||e.call(t),r(new Error("Promise timed out"))}),e)}))}},{key:"then",value:function(e,t){return this.innerPromise.then(e,t)}},{key:"catch",value:function(e){return this.innerPromise.catch(e)}},{key:"finally",value:function(e){return this.innerPromise.finally(e)}}])&&ya(t.prototype,n),r&&ya(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function wa(e){return wa="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},wa(e)}function Ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sa(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,xa(r.key),r)}}function ka(e,t,n){return t&&Sa(e.prototype,t),n&&Sa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xa(e){var t=function(e,t){if("object"!=wa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=wa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wa(t)?t:t+""}Symbol.toStringTag;var Oa=function(){return ka((function e(){Ea(this,e),this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}),[{key:"trigger",value:function(e){var t=this;this.callbacks.forEach((function(n,r){var i=t.predicates[r];i&&!i(e)||n(e)}))}},{key:"on",value:function(e){var t=this;this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");var n=this.callbacks.length;this.callbacks[n]=e,this.predicates[n]=function(){return!0};var r=function(){t.off(e)};return{off:r,filter:function(e){return t.predicates[n]=e,r}}}},{key:"one",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return this.isDisposed()?ba.reject(new Error("This EventChannel instance has been disposed")):new ba(new Promise((function(r,i){e=t.on((function(n){t.signal.removeEventListener("abort",o),e(),r(n)})).filter(n);var o=function(){e(),i(new Error("Aborted while waiting for message"))};t.signal.addEventListener("abort",o,{once:!0})})),(function(){e()}))}},{key:"off",value:function(e){var t=this.callbacks.indexOf(e);-1!==t&&(this.callbacks.splice(t,1),this.predicates.splice(t,1))}},{key:"dispose",value:function(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}},{key:"isDisposed",value:function(){return this.signal.aborted}}])}(),Ca=function(){return ka((function e(){Ea(this,e),this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}),[{key:"trigger",value:function(e,t){this.getChannel(e).trigger(t)}},{key:"on",value:function(e,t){return this.getChannel(e).on(t)}},{key:"one",value:function(e,t){return this.getChannel(e).one(t)}},{key:"off",value:function(e,t){this.getChannel(e).off(t)}},{key:"dispose",value:function(){this.trigger("dispose",ja.void),Object.values(this.channels).forEach((function(e){return e.dispose()})),this.channels={}}},{key:"getChannel",value:function(e){return this.channels[e]||(this.channels[e]=new Oa),this.channels[e]}}])}(),ja={void:void 0};function Na(e){return Na="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},Na(e)}function Pa(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,Ia(r.key),r)}}function Ia(e){var t=function(e,t){if("object"!=Na(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Na(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Na(t)?t:t+""}var Ta,La,Aa,_a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions()},(t=[{key:"bindFunctions",value:function(){this.schedule=this.schedule.bind(this),this.every=this.every.bind(this),this.trigger=this.trigger.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this)}},{key:"schedule",value:function(e){return this.task=e,this}},{key:"every",value:function(e){return this.intervalInMilliseconds=e,this}},{key:"trigger",value:function(){var e;return null===(e=this.task)||void 0===e||e.call(this,this),this}},{key:"start",value:function(){var e=this;return this.intervalId||(this.intervalId=setInterval((function(){return e.trigger()}),this.intervalInMilliseconds)),this}},{key:"stop",value:function(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this}}])&&Pa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),Fa=n(90244),Da=function(e,t){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(n,r,i,o){var a=e._lastModified[r.toString()];return!!(a&&Date.now()<a+t)||Reflect.set(n,r,i,o)}})},Ra=function(e){return e._lastModified||(e._lastModified={}),new Proxy(e,{set:function(t,n,r,i){return e._lastModified[n.toString()]=Date.now(),Reflect.set(t,n,r,i)}})};function Ma(e){return Ma="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},Ma(e)}function Ua(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,Ba(r.key),r)}}function Va(e,t,n){return t&&Ua(e.prototype,t),n&&Ua(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ba(e){var t=function(e,t){if("object"!=Ma(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ma(t)?t:t+""}!function(e){e[e.Offline=0]="Offline",e[e.Online=1]="Online",e[e.Locked=2]="Locked",e[e.Suspended=3]="Suspended"}(Ta||(Ta={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(La||(La={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(Aa||(Aa={}));var qa=Va((function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.title=t,this.device=n,this.locked=!1,this.position=0,this.playbackStatus=Aa.Load,this.debounced=Da(this,2e3),Ra(this)}));function Ga(e){return Ga="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},Ga(e)}function Za(){Za=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Ga(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ga(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function za(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,Ha(r.key),r)}}function Ha(e){var t=function(e,t){if("object"!=Ga(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ga(t)?t:t+""}function Wa(e,t,n){return t=Ya(t),function(e,t){if(t&&("object"==Ga(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ka()?Reflect.construct(t,n||[],Ya(e).constructor):t.apply(e,n))}function Ka(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ka=function(){return!!e})()}function Qa(){return Qa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ya(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Qa.apply(null,arguments)}function Ya(e){return Ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ya(e)}function $a(e,t){return $a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$a(e,t)}var Xa=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Wa(this,t)).client=e,r.localState=new qa(n.title,n.device),r.bindFunctions(),r.initialize(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$a(e,t)}(t,e),n=t,(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleDisconnected=this.handleDisconnected.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handlePlaybackChange=this.handlePlaybackChange.bind(this),this.handlePositionChange=this.handlePositionChange.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){this.client.on("dispose",this.dispose),this.client.on("disconnected",this.handleDisconnected),this.client.on("message",this.handleAllVideoMessages)}},{key:"dispose",value:function(){this.client.off("dispose",this.dispose),this.client.off("disconnected",this.handleDisconnected),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),Qa(Ya(t.prototype),"dispose",this).call(this)}},{key:"handleDisconnected",value:function(){this.trigger("error",new Error("The connection to the Apple TV has been lost and cannot be recovered"))}},{key:"handleAllVideoMessages",value:function(e){if(e.deviceId===this.getDevice().id){var t=this.localState.debounced;switch(e.event){case La.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case La.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",ja.void),e.playbackStatus===Aa.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",ja.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=Za().mark((function e(){return Za().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!this.localState.locked){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.client.lock(this.getDevice().id);case 5:return this.localState.locked=!0,e.next=8,this.client.loadVideo(this.getDevice().id);case 8:this.trigger("sourceloaded",ja.void),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not load video on Apple TV device"));case 15:case"end":return e.stop()}}),e,this,[[0,11]])})),new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Aa.Play&&(this.localState.playbackStatus=Aa.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",ja.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Aa.Pause&&(this.localState.playbackStatus=Aa.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",ja.void))}},{key:"seek",value:function(e){this.localState.locked&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ja.void))}},{key:"setVolume",value:function(){console.info("Setting the volume is not supported on Apple TV")}},{key:"setMuted",value:function(){console.info("Muting is not supported on Apple TV")}},{key:"setSubtitles",value:function(){console.info("Subtitles are not supported on Apple TV")}},{key:"isPlaying",value:function(){return this.localState.playbackStatus===Aa.Play||this.localState.playbackStatus===Aa.Begin||this.localState.playbackStatus===Aa.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Aa.Stop}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){}},{key:"getVolume",value:function(){return 1}},{key:"getMuted",value:function(){return!1}},{key:"getSubtitles",value:function(){}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}])&&za(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ca);function Ja(e){return Ja="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},Ja(e)}function ec(){ec=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Ja(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ja(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function tc(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,nc(r.key),r)}}function nc(e){var t=function(e,t){if("object"!=Ja(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ja(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ja(t)?t:t+""}function rc(e,t,n){return t=ac(t),function(e,t){if(t&&("object"==Ja(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ic()?Reflect.construct(t,n||[],ac(e).constructor):t.apply(e,n))}function ic(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ic=function(){return!!e})()}function oc(){return oc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ac(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},oc.apply(null,arguments)}function ac(e){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ac(e)}function cc(e,t){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},cc(e,t)}var sc,lc,uc,fc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))};!function(e){e.DeviceList="DeviceList",e.DeviceStateChange="DeviceStateChange",e.Paired="Paired",e.Unpaired="Unpaired",e.PlayStatusChange="PlayStatusChange",e.TimeSync="TimeSync"}(sc||(sc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(lc||(lc={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(uc||(uc={}));var dc=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=rc(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new _a,n.bindFunctions(),n.initialize(),n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.connect=this.connect.bind(this),this.subscribe=this.subscribe.bind(this),this.tryFixConnection=this.tryFixConnection.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=(0,Fa.Ds)(this.invoke,500,!0),this.handleDeviceList=this.handleDeviceList.bind(this),this.handleDeviceStateChange=this.handleDeviceStateChange.bind(this),this.handleDevicePaired=this.handleDevicePaired.bind(this),this.handleDeviceUnpaired=this.handleDeviceUnpaired.bind(this),this.handlePlayStatusChange=this.handlePlayStatusChange.bind(this),this.handleTimeSync=this.handleTimeSync.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.lock=this.lock.bind(this),this.loadVideo=this.loadVideo.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.stop=this.stop.bind(this),this.pair=this.pair.bind(this),this.unpair=this.unpair.bind(this),this.renameDevice=this.renameDevice.bind(this)}},{key:"initialize",value:function(){return fc(this,void 0,void 0,ec().mark((function e(){return ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,this.connection=(0,va.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(sc.DeviceList,this.handleDeviceList),this.hubProxy.on(sc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(sc.Paired,this.handleDevicePaired),this.hubProxy.on(sc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(sc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(sc.TimeSync,this.handleTimeSync),e.next=14,this.connect();case 14:return e.next=16,this.subscribe(this.accessToken.token);case 16:this.heartbeat.schedule(this.tryFixConnection).every(5e3).start(),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Online API"));case 23:case"end":return e.stop()}}),e,this,[[0,19]])})))}},{key:"connect",value:function(){return fc(this,void 0,void 0,ec().mark((function e(){var t=this;return ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){t.connection.start({jsonp:!1,withCredentials:!1}).done((function(){return e()})).fail((function(){return n(new Error("Could not connect to SignalR hub"))}))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"subscribe",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Subscribe,e);case 2:if(t.sent){t.next=5;break}throw new Error("The subscription request was rejected by Online API");case 5:case"end":return t.stop()}}),t,this)})))}},{key:"tryFixConnection",value:function(){return fc(this,void 0,void 0,ec().mark((function e(){return ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===uc.Disconnected){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.heartbeat.stop(),e.next=6,this.options.fetchAccessToken();case 6:return this.accessToken=e.sent,e.next=9,this.connect();case 9:return e.next=11,this.subscribe(this.accessToken.token);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),console.warn(e.t0),console.warn("Could not reconnect to Online API");case 17:return e.prev=17,this.heartbeat.start(),e.finish(17);case 20:case"end":return e.stop()}}),e,this,[[2,13,17,20]])})))}},{key:"invoke",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return fc(this,void 0,void 0,ec().mark((function t(){var r,i=this;return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Promise((function(t,r){var o,a;(null===(a=i.hubProxy)||void 0===a?void 0:(o=a).invoke.apply(o,[e].concat(n))).done(t).fail(r)})),t.abrupt("return",ba.fromPromise(r).timeout(2e4));case 2:case"end":return t.stop()}}),t)})))}},{key:"handleDeviceList",value:function(e){this.devices=e.filter((function(e){return"vivi"!==e.type})).map(t.convertToGenericDevice),this.trigger("deviceschange",ja.void)}},{key:"handleDeviceStateChange",value:function(e){var n=this.devices.findIndex((function(t){return t.id===e.deviceId}));n>=0&&(this.devices[n]=t.convertToGenericDevice(e),this.trigger("deviceschange",ja.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",ja.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",ja.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:La.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:La.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){this.hubProxy.off(sc.DeviceList,this.handleDeviceList),this.hubProxy.off(sc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(sc.Paired,this.handleDevicePaired),this.hubProxy.off(sc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(sc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(sc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),oc(ac(t.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(e){return e===da.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Xa(this,e)}},{key:"lock",value:function(e){var t;return fc(this,void 0,void 0,ec().mark((function n(){return ec().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(lc.Lock,e,this.options.userId,null!==(t=this.options.username)&&void 0!==t?t:"");case 2:if(n.sent){n.next=5;break}throw new Error("Could not lock device");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadVideo",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.options.trackingCode){t.next=2;break}throw new Error("Tracking code must be provided to cast videos");case 2:return t.next=4,this.invoke(lc.Command,{DeviceId:e,CommandType:Aa.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Command,{DeviceId:e,CommandType:Aa.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Command,{DeviceId:e,CommandType:Aa.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(lc.Command,{DeviceId:e,CommandType:Aa.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Command,{DeviceId:e,CommandType:Aa.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){var n;return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Pair,e);case 2:if(n=t.sent){t.next=5;break}throw new Error("Could not pair device");case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}}),t,this)})))}},{key:"unpair",value:function(e){return fc(this,void 0,void 0,ec().mark((function t(){return ec().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(lc.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return fc(this,void 0,void 0,ec().mark((function e(){return ec().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(lc.RenameDevice,t,n);case 2:if(e.sent){e.next=5;break}throw new Error("Could not rename device");case 5:case"end":return e.stop()}}),e,this)})))}}],i=[{key:"convertToGenericDeviceStatus",value:function(e){switch(e){case Ta.Online:return pa.Available;case Ta.Locked:return pa.Busy;case Ta.Suspended:case Ta.Offline:return pa.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:da.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&tc(n.prototype,r),i&&tc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Ca);function pc(e){return pc="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},pc(e)}function hc(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,vc(r.key),r)}}function vc(e){var t=function(e,t){if("object"!=pc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pc(t)?t:t+""}var mc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},yc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mc;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bindFunctions(),this.url=t,this.options=Object.assign(Object.assign({},mc),r),this.webSocket=this.connect(),this.heartbeat=(new _a).schedule((function(){return n.send(n.options.heartbeatMessage)})).every(this.options.heartbeatIntervalInMillseconds)},(t=[{key:"bindFunctions",value:function(){this.cleanup=this.cleanup.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleMessage=this.handleMessage.bind(this),this.handleClose=this.handleClose.bind(this),this.handleError=this.handleError.bind(this),this.connect=this.connect.bind(this),this.send=this.send.bind(this),this.dipose=this.dipose.bind(this)}},{key:"cleanup",value:function(){this.heartbeat.stop(),this.webSocket.removeEventListener("error",this.handleError),this.webSocket.removeEventListener("message",this.handleMessage),this.webSocket.removeEventListener("open",this.handleOpen),this.webSocket.removeEventListener("close",this.handleClose)}},{key:"handleOpen",value:function(e){var t;null===(t=this.onOpen)||void 0===t||t.call(this,e),this.options.heartbeatEnabled&&this.heartbeat.start()}},{key:"handleMessage",value:function(e){var t;null===(t=this.onMessage)||void 0===t||t.call(this,e)}},{key:"handleClose",value:function(e){var t,n=this;null===(t=this.onClose)||void 0===t||t.call(this,e),this.cleanup(),setTimeout((function(){n.webSocket=n.connect()}),this.options.reconnectIntervalInMilliseconds)}},{key:"handleError",value:function(e){var t;null===(t=this.onError)||void 0===t||t.call(this,e),this.handleClose()}},{key:"connect",value:function(){var e=new WebSocket(this.url);return e.addEventListener("open",this.handleOpen),e.addEventListener("message",this.handleMessage),e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),e}},{key:"send",value:function(e){this.webSocket.send(e)}},{key:"dipose",value:function(){this.cleanup(),this.webSocket.close()}}])&&hc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),gc=n(27993);function bc(e){return bc="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},bc(e)}function wc(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,Ec(r.key),r)}}function Ec(e){var t=function(e,t){if("object"!=bc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=bc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bc(t)?t:t+""}var Sc,kc=function(){return e=function e(t,n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._timerStartedAt=0,this.position=0,this.duration=void 0,this.playing=!1,this.mute=!1,this.videoSource="",this.subtitleSource="",this.subtitles=!1,this.volume=0,this.title=t,this.device=n,this.ready=!1,this.playbackFinished=!1,this.debounced=Da(this,2e3),Ra(this)},(t=[{key:"position",get:function(){return this._position+this.getTimerDurationInSeconds()},set:function(e){this._position=e,this.restartTimer()}},{key:"playing",get:function(){return this._playing},set:function(e){this._playing=e,e?this.restartTimer():(this._position+=this.getTimerDurationInSeconds(),this.stopTimer())}},{key:"restartTimer",value:function(){this._timerStartedAt=Date.now()}},{key:"stopTimer",value:function(){this._timerStartedAt=0}},{key:"getTimerDurationInSeconds",value:function(){return this._timerStartedAt?(Date.now()-this._timerStartedAt)/1e3:0}}])&&wc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var 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},xc(e)}function Oc(){Oc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==xc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(xc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Cc(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,jc(r.key),r)}}function jc(e){var t=function(e,t){if("object"!=xc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xc(t)?t:t+""}function Nc(e,t,n){return t=Tc(t),function(e,t){if(t&&("object"==xc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Pc()?Reflect.construct(t,n||[],Tc(e).constructor):t.apply(e,n))}function Pc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pc=function(){return!!e})()}function Ic(){return Ic="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Tc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ic.apply(null,arguments)}function Tc(e){return Tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tc(e)}function Lc(e,t){return Lc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Lc(e,t)}!function(e){e.Update="update",e.Volume="volume",e.Playing="playing",e.Paused="paused",e.NewChapter="new_chapter",e.Stopped="stopped",e.Ready="ready",e.Mute="mute",e.Finished="finished",e.Subtitles="subtitles"}(Sc||(Sc={}));var Ac=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},_c=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Nc(this,t)).client=e,r.localState=new kc(n.title,n.device),r.bindFunctions(),r.initialize(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lc(e,t)}(t,e),n=t,(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleClientConnected=this.handleClientConnected.bind(this),this.handleDisconnectMessage=this.handleDisconnectMessage.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handleUpdateMessage=this.handleUpdateMessage.bind(this),this.handleVolumeMessage=this.handleVolumeMessage.bind(this),this.handlePlayingMessage=this.handlePlayingMessage.bind(this),this.handlePausedMessage=this.handlePausedMessage.bind(this),this.handleFinishedMessage=this.handleFinishedMessage.bind(this),this.handleNewChapterMessage=this.handleNewChapterMessage.bind(this),this.handleStoppedMessage=this.handleStoppedMessage.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}},{key:"initialize",value:function(){var e=this;this.client.on("dispose",this.dispose),this.client.on("connected",this.handleClientConnected),this.client.on("message",this.handleDisconnectMessage).filter((function(t){return t.source===e.getDevice().id&&"disconnect"===t.message.type})),this.client.on("message",this.handleAllVideoMessages).filter((function(t){return t.source===e.getDevice().id&&"video_event"===t.message.type}))}},{key:"dispose",value:function(){this.client.off("dispose",this.dispose),this.client.off("connected",this.handleClientConnected),this.client.off("message",this.handleDisconnectMessage),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch((function(e){return console.error(e)})),Ic(Tc(t.prototype),"dispose",this).call(this)}},{key:"handleClientConnected",value:function(){return Ac(this,void 0,void 0,Oc().mark((function e(){return Oc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.joinRoom(this.getDevice().id);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),this.trigger("error",e.t0);case 8:case"end":return e.stop()}}),e,this,[[0,5]])})))}},{key:"handleDisconnectMessage",value:function(){this.dispose()}},{key:"handleAllVideoMessages",value:function(e){var t=this.localState.debounced,n=e.message.payload.params||{};switch(e.message.payload.event){case Sc.Update:this.handleUpdateMessage(t,n);break;case Sc.NewChapter:this.handleNewChapterMessage(t,n);break;case Sc.Volume:this.handleVolumeMessage(t,n);break;case Sc.Playing:this.handlePlayingMessage(t);break;case Sc.Paused:this.handlePausedMessage(t);break;case Sc.Finished:this.handleFinishedMessage(t);break;case Sc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",ja.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",ja.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",ja.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",ja.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",ja.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",ja.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",ja.void))}},{key:"handleNewChapterMessage",value:function(e,t){var n,r=(null!==(n=t.queue)&&void 0!==n?n:[]).find((function(t){return t.url===e.videoSource}));if(!r)return console.info("The device is no longer playing the source we loaded - disposing the session"),void this.dispose();e.subtitleSource!==r.suburl&&(e.subtitleSource=r.suburl,this.trigger("subtitleschange",ja.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return Ac(this,void 0,void 0,Oc().mark((function n(){var r,i;return Oc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.localState.videoSource!==e||this.localState.subtitleSource!==t){n.next=2;break}return n.abrupt("return");case 2:return n.prev=2,r=this.getDevice().id,i=this.getPosition(),this.localState.videoSource=e,this.localState.subtitleSource=t,this.localState.ready=!1,n.next=10,this.client.joinRoom(r);case 10:return n.next=12,this.client.loadQueue({title:this.getTitle(),roomId:r,videoSource:e,subtitleSource:t});case 12:this.localState.ready=!0,this.trigger("sourceloaded",ja.void),i>0&&this.seek(i),t&&this.setSubtitles(t),n.next=22;break;case 18:n.prev=18,n.t0=n.catch(2),console.error(n.t0),this.trigger("error",new Error("Could not load video on Vivi device"));case 22:case"end":return n.stop()}}),n,this,[[2,18]])})))}},{key:"play",value:function(){this.localState.ready&&!0!==this.localState.playing&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger("playingchange",ja.void))}},{key:"pause",value:function(){this.localState.ready&&!1!==this.localState.playing&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger("playingchange",ja.void))}},{key:"seek",value:function(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger("positionchange",ja.void))}},{key:"setVolume",value:function(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger("volumechange",ja.void))}},{key:"setMuted",value:function(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger("volumechange",ja.void))}},{key:"setSubtitles",value:function(e){return Ac(this,void 0,void 0,Oc().mark((function t(){var n;return Oc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.localState.ready){t.next=2;break}return t.abrupt("return");case 2:if(!e){t.next=5;break}return t.next=5,this.loadSource(this.localState.videoSource,e);case 5:n=!!e,this.localState.subtitles!==n&&(this.localState.subtitles=n,this.client.setSubtitles(this.getDevice().id,n),this.trigger("subtitleschange",ja.void));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"isPlaying",value:function(){return this.localState.playing}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackFinished}},{key:"getPosition",value:function(){return this.localState.position}},{key:"getDuration",value:function(){return this.localState.duration}},{key:"getVolume",value:function(){return this.localState.volume}},{key:"getMuted",value:function(){return this.localState.mute}},{key:"getSubtitles",value:function(){if(this.localState.subtitles)return this.localState.subtitleSource}},{key:"getDevice",value:function(){return this.localState.device}},{key:"getTitle",value:function(){return this.localState.title}}])&&Cc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ca);function Fc(e){return Fc="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},Fc(e)}function Dc(){Dc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:C(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",m={};function y(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(T([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=y.prototype=Object.create(w);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var s=f(e[i],e,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==Fc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function C(t,n,r){var i=d;return function(o,a){if(i===h)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=j(c,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=h;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?v:p,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function j(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Fc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new O(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(k),l(k,s,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Rc(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,Mc(r.key),r)}}function Mc(e){var t=function(e,t){if("object"!=Fc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Fc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fc(t)?t:t+""}function Uc(e,t,n){return t=qc(t),function(e,t){if(t&&("object"==Fc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Vc()?Reflect.construct(t,n||[],qc(e).constructor):t.apply(e,n))}function Vc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vc=function(){return!!e})()}function Bc(){return Bc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=qc(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Bc.apply(null,arguments)}function qc(e){return qc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qc(e)}function Gc(e,t){return Gc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Gc(e,t)}var Zc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},zc=1e4,Hc=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=Uc(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new _a,n.bindFunctions(),n.initialize(),n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gc(e,t)}(t,e),n=t,i=[{key:"createAckId",value:function(){return gc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,Fa.Ds)(this.sendMessage,500,!0),this.beginDeviceDiscovery=this.beginDeviceDiscovery.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.authenticateWithVivi=this.authenticateWithVivi.bind(this),this.getRoomList=this.getRoomList.bind(this),this.joinRoom=this.joinRoom.bind(this),this.query=this.query.bind(this),this.loadQueue=this.loadQueue.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.stop=this.stop.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.setMuted=this.setMuted.bind(this),this.setSubtitles=this.setSubtitles.bind(this)}},{key:"initialize",value:function(){var e=this;this.webSocket=new yc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return Zc(e,void 0,void 0,Dc().mark((function e(){return Dc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.options.fetchAccessToken();case 3:return this.accessToken=e.sent,e.next=6,this.authenticateWithVivi();case 6:this.beginDeviceDiscovery(),this.trigger("connected",ja.void),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error(e.t0),this.trigger("error",new Error("Could not connect to Vivi"));case 14:case"end":return e.stop()}}),e,this,[[0,10]])})))}}},{key:"sendMessage",value:function(e){var t;null===(t=this.webSocket)||void 0===t||t.send(JSON.stringify(e))}},{key:"beginDeviceDiscovery",value:function(){var e=this;this.deviceDiscovery.every(1e4).schedule((function(){return Zc(e,void 0,void 0,Dc().mark((function e(){var n,r;return Dc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRoomList();case 3:if(n=e.sent,(r=t.calculateFingerprint(n))!==this.devicesFingerprint){e.next=7;break}return e.abrupt("return");case 7:this.devices=n.map((function(e){return{id:e.id,name:e.name,type:da.Vivi,status:pa.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",ja.void),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.warn(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))})).trigger().start()}},{key:"dispose",value:function(){var e;this.deviceDiscovery.stop(),null===(e=this.webSocket)||void 0===e||e.dipose(),Bc(qc(t.prototype),"dispose",this).call(this)}},{key:"canCastToDevice",value:function(e){return e===da.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new _c(this,e)}},{key:"authenticateWithVivi",value:function(){return Zc(this,void 0,void 0,Dc().mark((function e(){return Dc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{token:this.accessToken,type:"identify_video_api"}}),e.next=3,this.one("message",(function(e){return"video_api_identified"===e.message.type})).timeout(zc).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return Zc(this,void 0,void 0,Dc().mark((function e(){var t;return Dc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:"relay",message:{type:"video_api_rooms"}}),e.next=3,this.one("message",(function(e){return"video_api_rooms"===e.message.type})).timeout(zc).catch((function(){throw new Error("Failed to fetch rooms")}));case 3:return t=e.sent,e.abrupt("return",t.message.rooms||[]);case 5:case"end":return e.stop()}}),e,this)})))}},{key:"joinRoom",value:function(e){return Zc(this,void 0,void 0,Dc().mark((function t(){return Dc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:"relay",message:{destination_type:"box",new_destination:e,token:this.accessToken,type:"connect"}}),t.next=3,this.one("message",(function(t){return t.source===e&&"connect"===t.message.type||"error"===t.message.type&&"already_connected"===t.message.error_type||void 0})).timeout(zc).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return Zc(this,void 0,void 0,Dc().mark((function n(){var r;return Dc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:r,name:"query"}}),n.next=4,this.one("message",(function(e){return e.message.ack_id===r})).timeout(zc).catch((function(){throw new Error("Failed to fetch query")}));case 4:return n.abrupt("return",n.sent);case 5:case"end":return n.stop()}}),n,this)})))}},{key:"loadQueue",value:function(e){var n=e.roomId,r=e.title,i=e.videoSource,o=e.subtitleSource;return Zc(this,void 0,void 0,Dc().mark((function e(){return Dc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.sendMessage({destination:n,message:{type:"message_with_ack",ack_id:t.createAckId(),name:"queue_load",payload:{urls:[{title:r,url:i,suburl:o}]}}}),e.next=3,this.one("message",(function(e){var t;return e.source===n&&"ready"===(null===(t=e.message.payload)||void 0===t?void 0:t.event)})).timeout(zc).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return Zc(this,void 0,void 0,Dc().mark((function t(){return Dc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_play",payload:{}}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Zc(this,void 0,void 0,Dc().mark((function t(){return Dc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_pause"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"paused"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return Zc(this,void 0,void 0,Dc().mark((function t(){return Dc().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"video_stop"}}),t.next=3,this.one("message",(function(t){var n;return t.source===e&&"stopped"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to stop video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){return Zc(this,void 0,void 0,Dc().mark((function n(){return Dc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"video_seek",payload:{position:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"playing"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to seek video")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setVolume",value:function(e,t){return Zc(this,void 0,void 0,Dc().mark((function n(){return Dc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.sendMessageDebounced({destination:e,message:{type:"message",name:"set_volume",payload:{volume:t}}})){n.next=4;break}return n.next=4,this.one("message",(function(t){var n;return t.source===e&&"volume"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to set volume")}));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"setMuted",value:function(e,t){return Zc(this,void 0,void 0,Dc().mark((function n(){return Dc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.sendMessage({destination:e,message:{type:"message",name:"set_mute",payload:{mute:t}}}),n.next=3,this.one("message",(function(t){var n;return t.source===e&&"mute"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to set mute")}));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"setSubtitles",value:function(e,n){return Zc(this,void 0,void 0,Dc().mark((function r(){var i;return Dc().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=t.createAckId(),this.sendMessage({destination:e,message:{type:"message_with_ack",ack_id:i,name:"set_subtitles",payload:{subtitles:n}}}),r.next=4,this.one("message",(function(t){var n;return t.source===e&&"subtitles"===(null===(n=t.message.payload)||void 0===n?void 0:n.event)})).timeout(zc).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}])&&Rc(n.prototype,r),i&&Rc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Ca);function Wc(e){return Wc="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},Wc(e)}function Kc(e){return function(e){if(Array.isArray(e))return Qc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Qc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qc(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Yc(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,$c(r.key),r)}}function $c(e){var t=function(e,t){if("object"!=Wc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Wc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wc(t)?t:t+""}function Xc(e,t,n){return t=ts(t),function(e,t){if(t&&("object"==Wc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Jc()?Reflect.construct(t,n||[],ts(e).constructor):t.apply(e,n))}function Jc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Jc=function(){return!!e})()}function es(){return es="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ts(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},es.apply(null,arguments)}function ts(e){return ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ts(e)}function ns(e,t){return ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ns(e,t)}var rs=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=Xc(this,t)).instanceId=e,n.clients=[],n.bindFunctions(),n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ns(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.addClient=this.addClient.bind(this),this.hasInstanceOfClient=this.hasInstanceOfClient.bind(this),this.startCastSession=this.startCastSession.bind(this),this.gatherAndPublishDevices=this.gatherAndPublishDevices.bind(this),this.dispose=this.dispose.bind(this)}},{key:"addClient",value:function(e){var t=this;e.on("deviceschange",this.gatherAndPublishDevices),e.on("error",(function(e){return t.trigger("error",e)})),this.clients.push(e)}},{key:"hasInstanceOfClient",value:function(e){return this.clients.some((function(t){return t instanceof e}))}},{key:"startCastSession",value:function(e){var t=this;if(this.castSession){if(this.castSession.getDevice().id===e.device.id)return void console.info("A session with device ".concat(e.device.id," already exists - this is a no-op"));this.castSession.dispose()}var n=this.clients.find((function(t){return t.canCastToDevice(e.device.type)}));n&&(this.castSession=n.startCastSession(e),this.castSession.on("error",(function(e){t.castSession.dispose(),t.trigger("error",e)})),this.castSession.on("dispose",(function(){t.castSession=void 0,t.trigger("castsessionchange",void 0)})),this.trigger("castsessionchange",this.castSession))}},{key:"getCastSession",value:function(){return this.castSession}},{key:"gatherAndPublishDevices",value:function(){var e=this.clients.map((function(e){return e.getDevices()})).reduce((function(e,t){return[].concat(Kc(e),Kc(t))}),[]);this.trigger("deviceschange",e)}},{key:"dispose",value:function(){var e;null===(e=this.castSession)||void 0===e||e.dispose(),this.clients.forEach((function(e){return e.dispose()})),this.castSession=void 0,this.clients=[],es(ts(t.prototype),"dispose",this).call(this)}}],i=[{key:"getOrCreateInstance",value:function(e){if(!e)throw new Error("instanceId is required");return this.instances[e]||(this.instances[e]=new t(e)),this.instances[e]}},{key:"disposeAndRemoveInstance",value:function(e){e.dispose(),delete this.instances[e.instanceId]}},{key:"isActive",value:function(){return Object.keys(this.instances).length>0}}],r&&Yc(n.prototype,r),i&&Yc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Ca);rs.instances={};var is=n(12424),os=n(4579);function as(e){return as="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},as(e)}function cs(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,ss(r.key),r)}}function ss(e){var t=function(e,t){if("object"!=as(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=as(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==as(t)?t:t+""}function ls(e,t,n){return t=ds(t),function(e,t){if(t&&("object"==as(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,us()?Reflect.construct(t,n||[],ds(e).constructor):t.apply(e,n))}function us(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(us=function(){return!!e})()}function fs(){return fs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ds(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},fs.apply(null,arguments)}function ds(e){return ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ds(e)}function ps(e,t){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ps(e,t)}var hs=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=ls(this,t,[e,n])).isVisible=r.isVisible.bind(r),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ps(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){return fs(ds(t.prototype),"createEl",this).call(this,"li",{className:"vjs-menu-item cv-device-menu-item",innerHTML:'\n <span class="cv-device-icon '.concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[this.options_.type],'"></span>\n <span class="vjs-menu-item-text">').concat(this.options_.label,"</span>\n ")})}},{key:"handleClick",value:function(){this.options_.onClick()}},{key:"show",value:function(){fs(ds(t.prototype),"show",this).call(this)}},{key:"hide",value:function(){fs(ds(t.prototype),"hide",this).call(this)}},{key:"isVisible",value:function(){return!fs(ds(t.prototype),"hasClass",this).call(this,"vjs-hidden")}}])&&cs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("MenuItem")),vs=n(86777);function ms(e){return ms="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},ms(e)}function ys(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,gs(r.key),r)}}function gs(e){var t=function(e,t){if("object"!=ms(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ms(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ms(t)?t:t+""}function bs(e,t,n){return t=Es(t),function(e,t){if(t&&("object"==ms(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ws()?Reflect.construct(t,n||[],Es(e).constructor):t.apply(e,n))}function ws(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ws=function(){return!!e})()}function Es(e){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Es(e)}function Ss(e,t){return Ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ss(e,t)}var ks=q.Z.getComponent("Menu"),xs=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),bs(this,t,arguments)}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ss(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=ks.originalProto.createEl.apply(this),t=this.contentEl_;return this.contentWrapper=q.Z.dom.createEl("div",{className:"vjs-menu-content"}),e.className="vjs-menu cv-devices-menu",t.className="cv-devices-menu-item-list",e.removeChild(t),e.appendChild(this.contentWrapper),this.contentWrapper.appendChild(t),this.simpleBar=new vs.Z(t,{autoHide:!1}),e}},{key:"addCta",value:function(e){this.ctaElement?console.warn("CTA has already been added to the menu - this is a no-op"):(this.ctaElement=e.el(),this.contentWrapper.prepend(this.ctaElement),this.el().classList.add("has-cta"))}},{key:"removeCta",value:function(){this.ctaElement&&(this.contentWrapper.removeChild(this.ctaElement),this.el().classList.remove("has-cta"))}}])&&ys(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ks);function Os(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,s=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var l,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return l=f(da.AppleTv)&&f(da.Vivi)?"vivi_and_apple_tv":f(da.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(Cs,{context:l,localize:u,onDismiss:function(){return o(l)}}),r.createElement(js,{context:l}),r.createElement(Ns,{context:l,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return s(l)},onInstall:function(){return a(l)},onLearnMore:function(){return c(l)}}))}function Cs(e){var t=e.context,n=e.localize,i=e.onDismiss;return r.createElement("div",{className:"cv-devices-cta-header"},r.createElement("span",{className:"cv-devices-badge"},n("New")),r.createElement("span",{className:"cv-devices-title"},"vivi_and_apple_tv"===t&&n("Cast to Vivi and Apple TV"),"vivi"===t&&n("Cast to Vivi"),"apple_tv"===t&&n("Cast to Apple TV")),r.createElement("span",{className:"cv-devices-close",onClick:i},r.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"white",d:"M11.9588 10.6413L16.3612 6.34478C16.7361 5.97191 17.3439 5.97191 17.7188 6.34478C18.0937 6.71764 18.0937 7.32218 17.7188 7.69505L13.3165 11.9916L17.7188 16.3701C18.0937 16.7429 18.0937 17.3475 17.7188 17.7203C17.3439 18.0932 16.7361 18.0932 16.3612 17.7203L11.9588 13.3419L7.63882 17.7203C7.26392 18.0932 6.65608 18.0932 6.28118 17.7203C5.90627 17.3475 5.90627 16.7429 6.28118 16.3701L10.6012 11.9916L6.28118 7.62993C5.90627 7.25706 5.90627 6.65252 6.28118 6.27965C6.65608 5.90678 7.26392 5.90678 7.63882 6.27965L11.9588 10.6413Z"}))))}function js(e){var t=e.context,n="vivi_and_apple_tv"===t?"bg-vivi-and-apple":"vivi"===t?"bg-vivi":"bg-apple";return r.createElement("div",{className:"cv-devices-cta-body ".concat(n)},("vivi_and_apple_tv"===t||"apple_tv"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon apple"})),("vivi_and_apple_tv"===t||"vivi"===t)&&r.createElement("div",{className:"cv-devices-icon-container"},r.createElement("span",{className:"cv-devices-icon vivi"})))}function Ns(e){var t=e.context,n=e.canUserManageIntegrations,i=e.localize,o=e.onInstall,a=e.onLearnMore,c=e.onContactSupport;return n?r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Discover our new device integrations to make presenting in the classroom easy!"),"vivi"===t&&i("Discover our new Vivi integration."),"apple_tv"===t&&i("Discover our new Apple TV integration.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:o},i("Click here to install"))):r.createElement("div",{className:"cv-devices-cta-footer"},r.createElement("span",null,"vivi_and_apple_tv"===t&&i("Cast to Vivi and Apple TV is now available! Please contact "),"vivi"===t&&i("Cast to Vivi is now available! Please contact "),"apple_tv"===t&&i("Cast to Apple TV is now available! Please contact ")),r.createElement("span",{className:"cv-devices-link",onClick:c},"ClickView Support"),r.createElement("span",null,"vivi_and_apple_tv"===t&&i(" or your administrator to set up Apple TV and Vivi."),"vivi"===t&&i(" or your administrator to set up Vivi."),"apple_tv"===t&&i(" or your administrator to set up Apple TV.")),r.createElement("br",null),r.createElement("span",{className:"cv-devices-link",onClick:a},"Learn more"))}function Ps(e){return Ps="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},Ps(e)}function Is(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,Ts(r.key),r)}}function Ts(e){var t=function(e,t){if("object"!=Ps(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ps(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ps(t)?t:t+""}function Ls(e,t,n){return t=Fs(t),function(e,t){if(t&&("object"==Ps(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,As()?Reflect.construct(t,n||[],Fs(e).constructor):t.apply(e,n))}function As(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(As=function(){return!!e})()}function _s(){return _s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Fs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_s.apply(null,arguments)}function Fs(e){return Fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fs(e)}function Ds(e,t){return Ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ds(e,t)}q.Z.registerComponent("DevicesMenu",xs),q.Z.registerComponent("DevicesCta",Qi((function(e,t){return r.createElement(Os,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var Rs=q.Z.getComponent("DevicesCta"),Ms=q.Z.getComponent("MenuButton"),Us=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Ls(this,t,[e,n])).alwaysCollapsed=!1,r.isCollapsed=!1,r.isCollabsible=!0,r.className="cv-devices-menu-button",r.searchText="",r.devices=[],r.castSession=void 0,r.bindFunctions(),r.bindEventListeners(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ds(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.setDevices=this.setDevices.bind(this),this.setCastSession=this.setCastSession.bind(this),this.setSearchText=this.setSearchText.bind(this),this.getDeviceMenuItems=this.getDeviceMenuItems.bind(this),this.showNotificationBadge=this.showNotificationBadge.bind(this),this.hideNotificationBadge=this.hideNotificationBadge.bind(this),this.render=this.render.bind(this),this.removeMenuItems=this.removeMenuItems.bind(this),this.addMenuItemsForDevices=this.addMenuItemsForDevices.bind(this),this.shouldShowSearchInput=this.shouldShowSearchInput.bind(this),this.toggleSearchInput=this.toggleSearchInput.bind(this),this.toggleDeviceMenuItems=this.toggleDeviceMenuItems.bind(this),this.toggleEmptyStatePlaceholder=this.toggleEmptyStatePlaceholder.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.$("button"),n=function(t){e.menu.handleBlur(t)};t.addEventListener("blur",n),this.one("dispose",(function(){var r;t.removeEventListener("blur",n),null===(r=e.cta)||void 0===r||r.dispose()}))}},{key:"createEl",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=Ms.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(_s(Fs(t.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"createMenu",value:function(){var e=this,t=new xs(this.player_,{menuButton:this});if(!this.options_.ctaOptions.hasBeenDismissed&&this.options_.ctaOptions.inactiveIntegrations.length>0){var n=this.options_.ctaOptions,r=n.onDismiss,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}(n,["onDismiss"]);this.cta=new Rs(this.player(),Object.assign(Object.assign({},i),{onDismiss:function(n){e.hideNotificationBadge(),t.removeCta(),r(n)}})),this.showNotificationBadge(),t.addCta(this.cta)}return this.createItems().forEach((function(e){return t.addItem(e)})),t}},{key:"createItems",value:function(){var e=this,t=[];return this.headingItem=new is.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new os.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new os.C(this.player_,{label:"No devices found",selected:!1,selectable:!1,multiSelectable:!1}),this.headingItem.show(),this.searchInputItem.hide(),this.emptyPlaceholder.show(),t.push(this.headingItem,this.searchInputItem,this.emptyPlaceholder),t}},{key:"pressButton",value:function(){var e;_s(Fs(t.prototype),"pressButton",this).call(this),this.shouldShowSearchInput()&&(null===(e=this.searchInputItem)||void 0===e||e.focus())}},{key:"setDevices",value:function(e){this.devices=e,this.render()}},{key:"setCastSession",value:function(e){this.castSession=e,this.render()}},{key:"setSearchText",value:function(e){this.searchText=e,this.render()}},{key:"getDeviceMenuItems",value:function(){return this.menu.children_.filter((function(e){return e instanceof hs}))}},{key:"showNotificationBadge",value:function(){this.addClass("notification-badge")}},{key:"hideNotificationBadge",value:function(){this.removeClass("notification-badge")}},{key:"render",value:function(){this.removeMenuItems(this.getDeviceMenuItems()),this.addMenuItemsForDevices(this.devices),this.toggleSearchInput(),this.toggleDeviceMenuItems(),this.toggleEmptyStatePlaceholder()}},{key:"removeMenuItems",value:function(e){var t=this;e.forEach((function(e){t.menu.removeChild(e),e.dispose()}))}},{key:"addMenuItemsForDevices",value:function(e){var t=this;e.sort((function(e,t){return"".concat(e.type,"-").concat(e.name).localeCompare("".concat(t.type,"-").concat(t.name))})).forEach((function(e){var n=new hs(t.player(),{id:e.id,label:e.name,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===pa.Available,type:e.type,onClick:function(){t.options_.onDeviceMenuItemClick(n,e)}});t.menu.addItem(n)}))}},{key:"shouldShowSearchInput",value:function(){return this.getDeviceMenuItems().length>=20}},{key:"toggleSearchInput",value:function(){this.shouldShowSearchInput()?(this.searchInputItem.show(),this.menu.addClass("vertical-fill")):(this.searchInputItem.hide(),this.menu.removeClass("vertical-fill"))}},{key:"toggleDeviceMenuItems",value:function(){var e=this,t=this.getDeviceMenuItems(),n=this.shouldShowSearchInput(),r=this.searchText.toLowerCase();t.forEach((function(t){var i,o=e.devices.find((function(e){return e.id===t.options_.id}));if(o){var a=o.status===pa.Available,c=!n||-1!==o.name.toLowerCase().indexOf(r),s=o.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id);a?t.enable():t.disable(),c?t.show():t.hide(),s?t.selected(!0):t.selected(!1)}}))}},{key:"toggleEmptyStatePlaceholder",value:function(){var e=this.getDeviceMenuItems();e.filter((function(e){return e.isVisible()})).length?this.emptyPlaceholder.hide():this.emptyPlaceholder.show(),e.length?this.emptyPlaceholder.setLabel(this.localize("No matching results")):this.emptyPlaceholder.setLabel(this.localize("No devices found"))}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){var e,t;return null!==(t=null===(e=this.castSession)||void 0===e?void 0:e.getDevice().name)&&void 0!==t?t:" "}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){this.handleClick()}},{key:"handleClick",value:function(){_s(Fs(t.prototype),"handleClick",this).call(this,null),this.options_.onClick()}}],r&&Is(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Ms);function Vs(e){return Vs="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},Vs(e)}function Bs(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,qs(r.key),r)}}function qs(e){var t=function(e,t){if("object"!=Vs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vs(t)?t:t+""}function Gs(e,t,n){return t=Hs(t),function(e,t){if(t&&("object"==Vs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Zs()?Reflect.construct(t,n||[],Hs(e).constructor):t.apply(e,n))}function Zs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Zs=function(){return!!e})()}function zs(){return zs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Hs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},zs.apply(null,arguments)}function Hs(e){return Hs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hs(e)}function Ws(e,t){return Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ws(e,t)}Us.prototype.controlText_="Devices",q.Z.registerComponent("DevicesButton",Us);var Ks=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Gs(this,t,[null,e])}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ws(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){return zs(Hs(t.prototype),"createEl",this).call(this,"div",{className:"cv-devices-tech"})}},{key:"setPoster",value:function(e){this.poster=e,this.update()}},{key:"setDevice",value:function(e){this.device=e,this.update()}},{key:"update",value:function(){var e,t,n,r,i=this;this.el_.innerHTML='\n <div class="cv-devices-content">\n <p>'.concat(this.localize("Currently playing on"),'</p>\n <h2><span class="cv-device-icon ').concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[null!==(t=null===(e=this.device)||void 0===e?void 0:e.type)&&void 0!==t?t:da.Vivi],'"></span>').concat(null!==(r=null===(n=this.device)||void 0===n?void 0:n.name)&&void 0!==r?r:"",'</h2>\n </div>\n <div class="cv-devices-background" style="background-image: url(').concat(this.poster,')"></div>\n ');var o=document.createElement("button"),a=function(e){e.stopPropagation(),i.options_.onStopCasting()};o.onclick=a,o.ontouchstart=a,o.className="stop-casting-button",o.innerHTML=this.localize("Stop casting"),this.el_.querySelector(".cv-devices-content").appendChild(o)}},{key:"play",value:function(){}}])&&Bs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("Component"));function Qs(e){return Qs="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},Qs(e)}function Ys(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,$s(r.key),r)}}function $s(e){var t=function(e,t){if("object"!=Qs(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qs(t)?t:t+""}function Xs(e,t,n){return t=tl(t),function(e,t){if(t&&("object"==Qs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Js()?Reflect.construct(t,n||[],tl(e).constructor):t.apply(e,n))}function Js(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Js=function(){return!!e})()}function el(){return el="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=tl(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},el.apply(null,arguments)}function tl(e){return tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tl(e)}function nl(e,t){return nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nl(e,t)}var rl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Xs(this,t,[e,n])).featuresVolumeControl=!0,r.featuresPlaybackRate=!1,r.movingMediaElementInDOM=!1,r.featuresFullscreenResize=!0,r.featuresTimeupdateEvents=!0,r.featuresProgressEvents=!1,r.featuresNativeTextTracks=!1,r.featuresNativeAudioTracks=!1,r.featuresNativeVideoTracks=!1,r.featuresMuteControl=!0,r.featuresSourceset=!1,r.videojsPlayer=(0,q.Z)(r.options_.playerId),r.bindFunctions(),r.bindEventListeners(),r.ready((function(){r.setSource(r.options_.source)})),r.triggerReady(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nl(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.bindEventListeners=this.bindEventListeners.bind(this),this.onTextTrackChanged=this.onTextTrackChanged.bind(this),this.getSelectedTextTrack=this.getSelectedTextTrack.bind(this),this.setSelectedTextTrack=this.setSelectedTextTrack.bind(this),this.showUI=this.showUI.bind(this),this.hideUI=this.hideUI.bind(this),this.dispose=this.dispose.bind(this),this.setSource=this.setSource.bind(this),this.getCastSession=this.getCastSession.bind(this)}},{key:"bindEventListeners",value:function(){var e=this,t=this.getCastSession();t&&(this.textTracks().on("change",this.onTextTrackChanged),this.videojsPlayer.one("ended",(function(){t.dispose()})),t.on("durationchange",(function(){e.trigger("durationchange")})),t.on("dispose",(function(){e.trigger("ended"),e.hideUI()})),t.on("playingchange",(function(){t.isPlaying()?(e.trigger("play"),e.trigger("playing")):e.trigger("pause")})),t.on("volumechange",(function(){e.trigger("volumechange")})),t.on("sourceloaded",(function(){e.trigger("loadeddata")})),t.on("subtitleschange",(function(){e.setSelectedTextTrack(t.getSubtitles())})))}},{key:"onTextTrackChanged",value:function(){var e,t=this.getSelectedTextTrack();null===(e=this.getCastSession())||void 0===e||e.setSubtitles(null==t?void 0:t.src)}},{key:"getSelectedTextTrack",value:function(){return le.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){le.O.forEachTrack(this.videojsPlayer.player_,(function(t){t.src===e?t.mode="showing":t.mode="hidden"}))}},{key:"showUI",value:function(e){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(e),this.ui.show())}},{key:"hideUI",value:function(){var e;null===(e=this.ui)||void 0===e||e.hide()}},{key:"dispose",value:function(){this.textTracks().off("change",this.onTextTrackChanged);var e=this.getCastSession();e&&e.dispose(),el(tl(t.prototype),"cleanupAutoTextTracks",this).call(this),el(tl(t.prototype),"dispose",this).call(this)}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new Ks({onStopCasting:function(){var t;null===(t=e.getCastSession())||void 0===t||t.dispose()}}),this.ui.el()}},{key:"setSource",value:function(e){var t=this.getCastSession();if(t){this.showUI(t.getDevice()),this.trigger("loadstart");var n=this.getSelectedTextTrack();t.loadSource(e.src,null==n?void 0:n.src)}}},{key:"addRemoteTextTrack",value:function(e){return el(tl(t.prototype),"addRemoteTextTrack",this).call(this,e,!0)}},{key:"getCastSession",value:function(){var e;return rs.getOrCreateInstance(null!==(e=this.options_.instanceId)&&void 0!==e?e:"").getCastSession()}},{key:"play",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.play()}},{key:"pause",value:function(){var e;null===(e=this.getCastSession())||void 0===e||e.pause()}},{key:"paused",value:function(){var e;return!1===(null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaying())}},{key:"ended",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.isPlaybackFinished())&&void 0!==t&&t}},{key:"setCurrentTime",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.seek(null!=e?e:0)}},{key:"currentTime",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getPosition())&&void 0!==t?t:0}},{key:"duration",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this.videojsPlayer.duration()}},{key:"volume",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getVolume())&&void 0!==t?t:1}},{key:"setVolume",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setVolume(e)}},{key:"muted",value:function(){var e,t;return null!==(t=null===(e=this.getCastSession())||void 0===e?void 0:e.getMuted())&&void 0!==t&&t}},{key:"setMuted",value:function(e){var t;null===(t=this.getCastSession())||void 0===t||t.setMuted(e)}},{key:"buffered",value:function(){}},{key:"seekable",value:function(){return q.Z.createTimeRanges(0,this.duration())}},{key:"playbackRate",value:function(){return 1}},{key:"readyState",value:function(){return 4}},{key:"controls",value:function(){return!1}},{key:"playsinline",value:function(){return!0}},{key:"supportsFullScreen",value:function(){return!0}},{key:"setAutoplay",value:function(){}},{key:"preload",value:function(){}},{key:"load",value:function(){}},{key:"setPlaybackRate",value:function(){}}],i=[{key:"canPlayType",value:function(){return""}},{key:"canPlaySource",value:function(e,t){var n;return!!rs.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return rs.isActive()}}],r&&Ys(n.prototype,r),i&&Ys(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(q.Z.getComponent("Tech"));function il(e){return il="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},il(e)}function ol(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,al(r.key),r)}}function al(e){var t=function(e,t){if("object"!=il(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=il(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==il(t)?t:t+""}function cl(e,t,n){return t=ul(t),function(e,t){if(t&&("object"==il(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,sl()?Reflect.construct(t,n||[],ul(e).constructor):t.apply(e,n))}function sl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(sl=function(){return!!e})()}function ll(){return ll="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ul(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ll.apply(null,arguments)}function ul(e){return ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ul(e)}function fl(e,t){return fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fl(e,t)}q.Z.registerTech("devices",rl);var dl=function(e){function t(e,n){var r,i,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=cl(this,t,[e,n])).options=n,r.instanceId=null!==(o=null===(i=r.player.options_.devices)||void 0===i?void 0:i.instanceId)&&void 0!==o?o:"",r.bindFunctions(),r.initialize(),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fl(e,t)}(t,e),n=t,(r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}},{key:"initialize",value:function(){this.player.ready(this.onReady)}},{key:"onReady",value:function(){var e=this,t=this.player.getChild("collapserator"),n=null==t?void 0:t.children().findIndex((function(e){return"CustomControlSpacer"===e.name()})),r=null==t?void 0:t.children().findIndex((function(e){return"OpenExternallyButton"===e.name()})),i=Math.max(n,r)+1,o=this.getSessionManager();if(t&&n&&-1!==n&&o){o.on("deviceschange",this.onDevicesChanged),o.on("castsessionchange",this.onCastSessionChanged),o.on("error",this.onDevicesError);var a=this.options.ctaOptions,c=this.options.vivi,s=[];this.options.appleTv.enabled||s.push(da.AppleTv),c.enabled&&c.accountConnected||s.push(da.Vivi);var l={onClick:function(){e.addViviClient(o),e.addAppleTvClient(o)},onDeviceMenuItemClick:function(t,n){var r;o.startCastSession({device:n,title:e.options.title}),null===(r=e.options.analyticsService)||void 0===r||r.logUserAction(n,{actionType:d.Vw.Select,workflowPhase:d.eu.Complete,descriptor:d.UX.ChangeDevice,entity:d.py.Device,eventVersion:d.eq.V3})},ctaOptions:Object.assign(Object.assign({},a),{inactiveIntegrations:s})};this.devicesButton=t.addChild("DevicesButton",l,i)}}},{key:"onDevicesChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setDevices(e)}},{key:"onCastSessionChanged",value:function(e){var t;null===(t=this.devicesButton)||void 0===t||t.setCastSession(e),this.reloadTech(),e?(this.player.addClass("cv-device-casting"),this.player.addClass("cv-device-".concat(e.getDevice().type)),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass("cv-device-casting"),this.player.removeClass("cv-device-".concat(da.AppleTv)),this.player.removeClass("cv-device-".concat(da.Vivi)))}},{key:"onDevicesError",value:function(e){this.player.error(e.message),this.player.pause()}},{key:"addViviClient",value:function(e){if(this.options.vivi.enabled&&this.options.vivi.accountConnected&&this.options.vivi.apiUrl&&!e.hasInstanceOfClient(Hc)){var t=new Hc({url:this.options.vivi.apiUrl,fetchAccessToken:this.options.vivi.fetchAccessToken});e.addClient(t)}}},{key:"addAppleTvClient",value:function(e){if(this.options.appleTv.enabled&&this.options.trackingCode&&this.options.userId&&!e.hasInstanceOfClient(dc)){var t=new dc({fetchAccessToken:this.options.appleTv.fetchAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId});e.addClient(t)}}},{key:"reloadTech",value:function(){var e=this.player,t=e.currentSources(),n=e.volume(),r=e.muted(),i=e.currentTime(),o=e.paused();e.src(t),e.one("playing",(function(){e.volume(n),e.muted(r),e.currentTime(i),o?e.pause():e.play()}))}},{key:"getSessionManager",value:function(){if(this.instanceId)return rs.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var e=this.getSessionManager();e&&(e.off("deviceschange",this.onDevicesChanged),e.off("castsessionchange",this.onCastSessionChanged),e.off("error",this.onDevicesError),rs.disposeAndRemoveInstance(e),ll(ul(t.prototype),"dispose",this).call(this))}}])&&ol(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getPlugin("plugin"));function pl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hl(e){var t,n,i,o=r.useRef(e.player.duration()-e.player.currentTime()),a=(n=r.useState(o.current),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return pl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pl(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],s=a[1];function l(){var t=e.player.duration()-e.player.currentTime();s(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",l),function(){e.player.off("timeupdate",l)}}),[]),!e.nextVideo||!e.onPlayNext)return r.createElement(r.Fragment,null);var u=Math.ceil(c),f=1===u?"second":"seconds";return r.createElement(r.Fragment,null,r.createElement("div",{className:"cv-up-next-container"},r.createElement("div",{className:"cv-cancel-up-next cursor-pointer",role:"button",onClick:e.onCancel},"×"),r.createElement("div",{className:"cv-up-next-heading"},"Up next in ",u," ",f,":"),r.createElement("div",{className:"cv-up-next-image cursor-pointer",onClick:e.onPlayNext,style:{backgroundImage:"url(".concat(null===(t=e.nextVideo)||void 0===t?void 0:t.thumbnailUrl,")")}}),r.createElement("div",{className:"cv-up-next-title"},e.nextVideo.name)))}function vl(e){return vl="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},vl(e)}function ml(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,yl(r.key),r)}}function yl(e){var t=function(e,t){if("object"!=vl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vl(t)?t:t+""}function gl(e,t,n){return t=El(t),function(e,t){if(t&&("object"==vl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,bl()?Reflect.construct(t,n||[],El(e).constructor):t.apply(e,n))}function bl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(bl=function(){return!!e})()}function wl(){return wl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=El(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},wl.apply(null,arguments)}function El(e){return El=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},El(e)}function Sl(e,t){return Sl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Sl(e,t)}q.Z.registerPlugin("devicesPlugin",dl),q.Z.registerComponent("UpNext",Qi((function(e,t){return r.createElement(hl,Object.assign({player:e},t))})));var kl=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=gl(this,t,[e,n])).playNext=e.nextVideoPlugin().getShouldPlayNext(),r.toggle(r.playNext),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Sl(e,t)}(t,e),n=t,(r=[{key:"handleToggle",value:function(){this.toggle(!this.playNext)}},{key:"toggle",value:function(e){e?this.toggleOn():this.toggleOff()}},{key:"toggleOn",value:function(){this.playNext=!0,q.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,q.Z.dom.removeClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"handleClick",value:function(e){e.stopImmediatePropagation()}},{key:"createEl",value:function(e,n,r){this.handlerBound||(this.handleToggle=this.handleToggle.bind(this),this.handlerBound=!0),this.toggleEl&&this.toggleEl.removeEventListener("click",this.handleToggle),this.toggleEl=q.Z.dom.createEl("div",{className:"custom-toggle toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var i=wl(El(t.prototype),"createEl",this).call(this,e,{className:"vjs-menu-item cv-cog-menu-item",innerHTML:'\n <span class="vjs-menu-item-text">Play next video</span>\n <span class="cv-toggle-container"></span>'},r);return i.children[1].appendChild(this.toggleEl),i}}])&&ml(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("MenuItem"));function xl(e){return xl="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},xl(e)}function Ol(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,Cl(r.key),r)}}function Cl(e){var t=function(e,t){if("object"!=xl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=xl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xl(t)?t:t+""}function jl(e,t,n){return t=Il(t),function(e,t){if(t&&("object"==xl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Nl()?Reflect.construct(t,n||[],Il(e).constructor):t.apply(e,n))}function Nl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Nl=function(){return!!e})()}function Pl(){return Pl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Il(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Pl.apply(null,arguments)}function Il(e){return Il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Il(e)}function Tl(e,t){return Tl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tl(e,t)}q.Z.registerComponent("NextVideoMenuItem",kl);var Ll="cv-persisttest",Al="cv-play-next-video",_l=q.Z.getPlugin("plugin"),Fl=(q.Z.getComponent("MenuItem"),q.Z.getComponent("NextVideoMenuItem")),Dl=function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=jl(this,t,[e])).setShouldPlayNext=n.setShouldPlayNext.bind(n),n.getShouldPlayNext=n.getShouldPlayNext.bind(n),n.getChapterTrack=n.getChapterTrack.bind(n),n.onTimeUpdate=n.onTimeUpdate.bind(n),n.hasLocalStorage=n.testHasLocalStorage(),n.shouldPlayNextVideo=!1,n.hasLocalStorage){var r=window.localStorage.getItem(Al);n.shouldPlayNextVideo="true"===r}return e.ready((function(){n.initialize()})),n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tl(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return le.O.getTrack(this.player,"chapters",null)}},{key:"setNextVideo",value:function(e,t,n){var r;this.nextVideo=e,this.callback=n,t&&this.setShouldPlayNext(!0),(null===(r=this.player.getChild("collapserator"))||void 0===r?void 0:r.getChild("cogButton")).addItem({index:0,ctor:Fl,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(Al,e.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),Pl(Il(t.prototype),"dispose",this).call(this)}},{key:"onTimeUpdate",value:function(){var e,t;if(!this.player.pictureInPicture||!this.player.isInPictureInPicture())if(this.getShouldPlayNext()){if(this.player.ended())return this.callback(),void this.hideUpNext();if(!(this.player.duration()<=0||this.upNextRendered&&this.player.currentTime()>this.upNextTimepoint)){var n=this.getChapterTrack(),r=(null===(e=null==n?void 0:n.activeCues)||void 0===e?void 0:e.length)&&n.activeCues[0];"credits"===(null===(t=null==r?void 0:r.text)||void 0===t?void 0:t.toLowerCase())||this.player.currentTime()>=this.player.duration()-5?this.showUpNext():this.hideUpNext()}}else this.hideUpNext()}},{key:"showUpNext",value:function(){var e=this;this.upNextRendered||(this.upNextRendered=!0,this.upNextTimepoint=this.player.currentTime(),this.player.addChild("UpNext",{nextVideo:this.nextVideo,onPlayNext:this.callback,onCancel:function(){e.hideUpNext(),e.setShouldPlayNext(!1)}}))}},{key:"hideUpNext",value:function(){if(this.upNextRendered){this.upNextRendered=!1,this.upNextTimepoint=null;var e=this.player.getChild("UpNext");e&&(this.player.removeChild(e),e.dispose())}}},{key:"testHasLocalStorage",value:function(){try{return window.localStorage.setItem(Ll,"persistPlayNext"),window.localStorage.removeItem(Ll),!0}catch(e){return!1}}}])&&Ol(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(_l);q.Z.registerPlugin("nextVideoPlugin",Dl);var Rl=n(52765),Ml=n(75390),Ul=n(86257),Vl=n(87013),Bl=n(38e3),ql={imageStyle:"FFgf3",imageTypeResource:"z4O5p",fallBackImage:"Xy4zX"},Gl={width:200,resizeType:ge.Nq.Cover};function Zl(e){var t;return Bl.G.isResource(e)?e.metadata.type===Ul.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?ge.__.Pdf:ge.__.Thumbnails:ge.__.Link}function zl(e){var t,n,r,o=null,a=0;Bl.G.isResource(e.resource)&&(o=e.resource.metadata,a=null!==(r=null===(n=null===(t=e.resource.thumbnail)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.rotation)&&void 0!==r?r:0);var c=function(e,t){var n,r,i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Gl,a=Zl(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return Vl.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=Ml._.safeUrlConcat(e,"/v1/previews");return Bl.G.isResource(t)?a===ge.__.Pdf?t.metadata.type===Ul.L.Pdf?Vl.j.createResourceImage(c,t.url,Object.assign({},o)):Vl.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==Ul.L.Zip?Vl.j.createUrl(t.url,{size:ge.h2.Medium,resizeType:ge.Nq.Cover}):"/images/zip-resource.png":Vl.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return i().createElement(ye.Z,{data:c,imageType:Zl(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:ql.fallBackImage,imageClassName:(null==o?void 0:o.type)===Ul.L.Image?"".concat(ql.imageTypeResource," ").concat(ql.imageStyle):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var Hl=n(96461),Wl=n(43803),Kl=n(74421),Ql=n(13799),Yl={getResourceTypeName:function(e){switch(e){case"additional-materials":return"Additional Materials";case"atom-guide":return"ATOM Guide";case"teacher-pack":return"Teacher Pack";case"student-activity":return"Student Activity";default:return"N/A"}}},$l={imageStyle:"I9E5O",item:"tqUFn",dashboard:"o7j7p",playPage:"V2RwX",aspectRatio:"OnJDH",outerContainer:"CIFy7",innerContainer:"oUZPD",actions:"jzGAm",titleBelow:"Cpjs3",thumbnailContainer:"EDiGi",titleAbove:"e9ejn",teacherPack:"_tdVE",text:"g5NWS",hoverState:"xRYhX",atomGuide:"X39wU",studentActivity:"X9pMl",additionalMaterials:"qRVUo",userUploaded:"_18JaV",imageTypeResource:"KYtZL",download:"fbb_e"};function Xl(e){var t,n,r,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=Bl.G.isType(e.data,Kl.E.Resource);return i().createElement(i().Fragment,null,i().createElement("div",{className:$l.aspectRatio},i().createElement("div",{className:$l.outerContainer},i().createElement("div",{className:function(t){var n,r="\n d-flex flex-column align-items-center justify-content-end rounded-3 h-100\n position-relative ".concat(function(e){switch(e){case"atom-guide":return $l.atomGuide;case"student-activity":return $l.studentActivity;case"teacher-pack":return $l.teacherPack;case"additional-materials":return $l.additionalMaterials;default:return $l.userUploaded}}(t)," ").concat($l.innerContainer);return(null===(n=e.theme)||void 0===n?void 0:n.containerClass)?r+=" ".concat(e.theme.containerClass):r+=" pt-3 px-3",e.applyHoverState&&(r+=" ".concat($l.hoverState)),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&i().createElement(mr.u,{title:e.data.name},i().createElement("h3",{className:"text-center text-break h5 mb-3 ".concat($l.text)},i().createElement("span",{className:"clamp-1"},e.data.name))),i().createElement("div",{className:"\n ".concat(null!==(n=null===(t=e.theme)||void 0===t?void 0:t.thumbnailContainerClass)&&void 0!==n?n:""," w-75 overflow-hidden \n ").concat($l.thumbnailContainer," ").concat("above"===e.titlePosition?$l.titleAbove:""," \n ").concat($l.imageStyle,"\n ")},i().createElement(zl,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&i().createElement("div",{className:$l.actions},i().createElement(k.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat($l.download," d-flex align-items-center justify-content-center")},i().createElement(x.x,{svgName:O.vn.Download}))),!e.hideTypeBadge&&c&&i().createElement(Wl.y,{typeId:Kl.E.Resource})))),"below"===e.titlePosition&&i().createElement("div",{className:"mt-1 ".concat($l.titleBelow)},Bl.G.isType(e.data,Kl.E.Resource)&&!!(null===(o=null===(r=e.data)||void 0===r?void 0:r.metadata)||void 0===o?void 0:o.resourceType)&&i().createElement(Hl.m,null,Yl.getResourceTypeName(e.data.metadata.resourceType)),i().createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function Jl(e){return Jl="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},Jl(e)}function eu(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,tu(r.key),r)}}function tu(e){var t=function(e,t){if("object"!=Jl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jl(t)?t:t+""}function nu(e,t,n){return t=iu(t),function(e,t){if(t&&("object"==Jl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ru()?Reflect.construct(t,n||[],iu(e).constructor):t.apply(e,n))}function ru(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ru=function(){return!!e})()}function iu(e){return iu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},iu(e)}function ou(e,t){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ou(e,t)}function au(e){return i().createElement("div",{className:"cv-resource-item"},i().createElement(Xl,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}Xl.defaultProps={preloadImage:!0,actionBehaviour:"normal"},i().memo((function(e){var t,n,r,o,a=(t=e.data,n=e.actionBehaviour,o=i().useContext(Ql.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===Ul.L.Image||(t.metadata.type===Ul.L.Pdf?!!t.url:!!(null===(r=t.pdf)||void 0===r?void 0:r.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),s=Object.assign(Object.assign({},e.analyticsOptions),{actionType:d.Vw.Click,entity:e.data.typeId===Kl.E.Resource?d.py.Resource:d.py.Link});function l(){ut.k.logUserAction(c,s)}var u,f=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return i().createElement("div",{className:"px-1 flex-shrink-0 ".concat($l.item," ").concat("play-page"===e.location?$l.playPage:$l.dashboard," ").concat("resource-item")},(u="d-block no-decoration","link"===e.data.type?i().createElement("a",{href:e.data.url,target:"_blank",className:u,onClick:l},i().createElement(Xl,Object.assign({},f))):a?"public"===e.actionBehaviour?i().createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){l(),Rl.C$.trigger(e.getAppLink(e.data))}},i().createElement(Xl,Object.assign({},f))):i().createElement(C.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:s},i().createElement(Xl,Object.assign({},f))):e.data.url?i().createElement("a",{href:e.data.url,className:u,onClick:l},i().createElement(Xl,Object.assign({},f))):i().createElement("div",{className:u},i().createElement(Xl,Object.assign({},f)))))}));var cu=Qi((function(e,t){return i().createElement(au,Object.assign({},t))})),su=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=nu(this,t,[e,n]);var i=new cu(e,{resource:n.resource,imageCdnUrl:n.imageCdnUrl});return r.addChild(i),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ou(e,t)}(t,e),n=t,(r=[{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}])&&eu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("MenuItem"));function lu(e){return lu="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},lu(e)}function uu(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,fu(r.key),r)}}function fu(e){var t=function(e,t){if("object"!=lu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lu(t)?t:t+""}function du(e,t,n){return t=vu(t),function(e,t){if(t&&("object"==lu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,pu()?Reflect.construct(t,n||[],vu(e).constructor):t.apply(e,n))}function pu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(pu=function(){return!!e})()}function hu(){return hu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=vu(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},hu.apply(null,arguments)}function vu(e){return vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vu(e)}function mu(e,t){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},mu(e,t)}var yu=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=du(this,t,arguments)).alwaysCollapsed=!1,e.isCollapsed=!1,e.isCollabsible=!0,e}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mu(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(hu(vu(t.prototype),"buildWrapperCSSClass",this).call(this))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(hu(vu(t.prototype),"buildCSSClass",this).call(this))}},{key:"update",value:function(){hu(vu(t.prototype),"update",this).call(this)}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new is.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new su(e.player(),{resource:n,imageCdnUrl:e.options_.imageCdnUrl,downloadResource:function(t){return e.downloadResource(t)},label:n.name});t.push(r)})),t}},{key:"downloadResource",value:function(e){"link"!==e.type?this.getDownloadIframe().src=e.url:Rl.Ab.PageLoad(e.url,!0)}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=q.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",q.Z.dom.appendContent(q.Z.dom.$("body"),this.downloadIframe)),this.downloadIframe}},{key:"getCollabsibleName",value:function(){return this.controlText_}},{key:"getCollabsibleValue",value:function(){return""}},{key:"showInCollabsibleMenu",value:function(){return!0}},{key:"showCollapsibleMenu",value:function(){hu(vu(t.prototype),"handleClick",this).call(this,null)}}])&&uu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getComponent("MenuButton"));function gu(e){return gu="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},gu(e)}function bu(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,wu(r.key),r)}}function wu(e){var t=function(e,t){if("object"!=gu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=gu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gu(t)?t:t+""}function Eu(e,t,n){return t=ku(t),function(e,t){if(t&&("object"==gu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Su()?Reflect.construct(t,n||[],ku(e).constructor):t.apply(e,n))}function Su(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Su=function(){return!!e})()}function ku(e){return ku=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ku(e)}function xu(e,t){return xu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xu(e,t)}yu.prototype.controlText_="Resources",q.Z.registerComponent("ResourcesButton",yu);var Ou=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=Eu(this,t,[e,n])).options=n,e.ready((function(){return r.onReady()})),r}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xu(e,t)}(t,e),n=t,(r=[{key:"onReady",value:function(){if(this.options.resources.length){var e=this.player.getChild("collapserator");e.addChild("ResourcesButton",{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl},e.children_.length-4)}}}])&&bu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(q.Z.getPlugin("plugin"));q.Z.registerPlugin("resourcesPlugin",Ou);var Cu=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 ju(e){var t=e.className,n=void 0===t?"":t,r=e.playerApi,o=e.onReady,a=e.onDispose,c=Cu(e,["className","playerApi","onReady","onDispose"]),s=i().useRef();return i().useEffect((function(){if(s){var e=new ha.J(s.current,Object.assign(Object.assign({},c),{playerApi:r}));return o&&e.ready((function(){o(zo(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),i().createElement("div",{ref:s,className:n})}var Nu={placeholder:"JemW5"};function Pu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Iu(){return i().createElement("div",{className:"".concat(Nu.placeholder," partial-loading-background")})}function Tu(e){var t,n,r=(t=i().useState(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pu(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1];return i().useEffect((function(){e.createViewKey(null,(function(e){a(e.get("viewKey"))}))}),[e.video.id]),o?i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement(ju,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):i().createElement(Iu,null)}var Lu="libraryRequests.info";function Au(e){var t=c.M.isVideo(e.libraryRequest.object),n=c.M.isInteractive(e.libraryRequest.object),r=c.M.isClip(e.libraryRequest.object);return i().createElement("div",{className:"bg-white rounded p-3"},i().createElement(ra,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:Lu,phrase:"videoDetails"})),t&&i().createElement(i().Fragment,null,i().createElement(v,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),i().createElement(fa,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===a.b.US,config:e.config})),n&&i().createElement(i().Fragment,null,i().createElement($o,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),i().createElement(U,{libraryRequest:e.libraryRequest})),r&&i().createElement(i().Fragment,null,i().createElement(Tu,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),i().createElement(w,{libraryRequest:e.libraryRequest})))}},49824:function(e,t,n){"use strict";n.d(t,{j:function(){return o}});var r=n(1024),i=n.n(r);function o(){return i().createElement("div",{className:"bg-white rounded p-3"},i().createElement("div",{className:"partial-loading-background mb-2",style:{height:"1.25rem",width:"9rem"}}),i().createElement("div",{className:"col-12 mb-3 p-0"},i().createElement("div",{className:"responsive-img partial-loading-background rounded"})),i().createElement("div",{className:"row"},i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"3.4rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"9rem"}})),i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"5rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"2rem"}})),i().createElement("div",{className:"col-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"7rem"}})),i().createElement("div",{className:"col-9 mb-3"},i().createElement("div",{className:"partial-loading-background",style:{height:"1.25rem",width:"16rem"}}))))}},18843:function(e,t,n){"use strict";n.d(t,{q:function(){return ft}});var r=n(1024),i=n.n(r),o=n(42648),a=n(82602),c=n(70868),s=n(70065),l=n(49642),u=n(99910),f=n(64038),d=n(39396),p=n(63791),h={container:"VwD1b",spinner:"eJ85e"};function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t,n,i=(t=(0,f.useInView)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];return r.useEffect((function(){var t;e.fetchOnScroll&&a&&!e.isFetching&&(null===(t=e.fetchNext)||void 0===t||t.call(e,e.nextCursor))}),[a,e.isFetching]),r.createElement("div",{className:"p-3 text-center ".concat(h.container),ref:o},e.isFetching?r.createElement(u.Spinner,{as:"span",animation:"border",role:"status",className:h.spinner}):r.createElement(d.x,{svgName:p.vn.ChevronDown,className:"svg-container cursor-pointer",size:d.S.Large,onClick:function(){var t;return null===(t=e.fetchNext)||void 0===t?void 0:t.call(e,e.nextCursor)}}))}m.defaultProps={fetchOnScroll:!1};var y=n(66703),g=n(85887),b=n(41087),w=n(7121);function E(e){var t="d-flex align-items-center badge-list ".concat(w.Z.minHeight);return e.className&&(t+=" ".concat(e.className)),r.createElement("div",{className:t},e.children)}var S=n(57857),k=n(53808),x=n(58424),O=n(2491),C=n(37360),j=n(40221),N=n(12927),P={isFavouritedByCurrentUser:function(e){var t;return!(1!==(null===(t=null==e?void 0:e.favouritedBy)||void 0===t?void 0:t.data.length))},isFavouritedByUser:function(e,t){var n;return!!j.m.findWhere(null===(n=null==e?void 0:e.favouritedBy)||void 0===n?void 0:n.data,{id:null==t?void 0:t.id})},updateVideoState:function(e,t,n){return{id:e.id,favouritedBy:{data:n?[{id:t.id}]:[],pagination:{limit:25,cursors:{next:"",previous:""}}}}},showFavouriteButton:function(e,t){var n;return!(!(null===(n=N.M.getCanBeConsumed(e))||void 0===n?void 0:n.canConsume)||!t&&!C.V.isTabletOrMobile()&&!P.isFavouritedByCurrentUser(e))}},I={favourited:"t0svX",favouriteButton:"CFRo3",heart:"ZMMQu",heartOutline:"truFo"};function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=S.T.encloseNamespace("shared.favouriteButton");function A(e){var t,n,i=(0,O.Z)(),o=P.isFavouritedByCurrentUser(e.video),a=(t=r.useState(o),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],s=a[1];r.useEffect((function(){s(o)}),[o]);var l="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(I.favouriteButton," ").concat(c?I.favourited:"");return e.className&&(l+=" ".concat(e.className)),k.q.isFunction(e.setFavourite)&&k.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(x.L,{className:l,onClick:function(){var t=!c;s(t),e.setFavourite(e.video,t,null,(function(){i.error(L(N.M.isClip(e.video)?t?"favouriteClipError":"unfavouriteClipError":N.M.isInteractive(e.video)?t?"favouriteInteractiveError":"unfavouriteInteractiveError":t?"favouriteVideoError":"unfavouriteVideoError")),s(!t)}),e.analyticsData,e.analyticsOptions)}},r.createElement(d.x,{svgName:p.vn.Heart,className:"svg-container ".concat(I.heart)}),r.createElement(d.x,{svgName:p.vn.HeartOutline,className:"svg-container ".concat(I.heartOutline)})):r.createElement(r.Fragment,null)}var _,F,D,R=n(49619),M=n(24828),U=n(22231),V={baseFallbackContainer:"ZvbeV",svgFallbackContainer:"atIHN",subjectFallbackContainer:"m20L7",subjectFallbackContainerSmall:"QIbxu",subjectFallbackContainerLarge:"z_sHT",seriesItemFallback:"epoLB",playlistItemFallback:"h1S5T",playlistFallback:"ZbKBN",posterFallback:"I1mTo",subjectFallback:"kNG8Z",fallbackThumbnailImage:"nKsWZ",videoFallback:"LolCW",folderFallback:"mdrT5"};function B(e){var t,n=e.type,i=e.mediaType,o=e.extraClasses,a=e.containerClassSize;if(n===_.Video)return r.createElement("div",{className:"".concat(V.videoFallback," ").concat(e.extraClasses," bg-light-blue")});if(n===_.Folder)return r.createElement("div",{className:"".concat(V.folderFallback," ").concat(e.extraClasses," ").concat((0,U.x)(e.name,M.o))});var c=function(e){return e===_.SeriesThumbnail?V.seriesItemFallback:e===_.PlaylistThumbnail?V.playlistItemFallback:e===_.Playlist?V.playlistFallback:e===_.Series||e===_.TallSubject?V.posterFallback:e===_.Subject?"".concat(V.subjectFallback," svg-container d-inline-block"):""}(n),s=function(e){return e===_.SeriesThumbnail||e===_.PlaylistThumbnail?p.vn.Play:e===_.Playlist?p.vn.Image:e===_.Series?p.vn.Series:e===_.Subject||e===_.TallSubject?p.vn.Subject:""}(n),l=function(e){return e===_.Subject?d.S.ExtraLarge:d.S.Standard}(n),u="".concat(function(e,t,n){if(t===_.Subject){var r=n===D.Large?V.subjectFallbackContainerLarge:V.subjectFallbackContainerSmall;return"".concat(V.subjectFallbackContainer," ").concat(r)}return e===F.Svg?t===_.SeriesThumbnail||t===_.PlaylistThumbnail?"".concat(V.svgFallbackContainer," rounded-3"):V.svgFallbackContainer:V.baseFallbackContainer}(i,n,a));return o&&(u+=" ".concat(e.extraClasses)),r.createElement("div",{className:u},i===F.Svg?r.createElement(d.x,{svgName:s,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:l}):r.createElement("div",{className:V.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(s,"')")}}))}function q(e){var t=N.M.getVideoProgress(e.video),n=t&&e.video.duration&&t/e.video.duration*1e5;return n?r.createElement("div",{className:"bg-primary h-100",style:{width:"".concat(n,"%")}}):r.createElement(r.Fragment,null)}!function(e){e[e.Playlist=0]="Playlist",e[e.PlaylistThumbnail=1]="PlaylistThumbnail",e[e.Series=2]="Series",e[e.SeriesThumbnail=3]="SeriesThumbnail",e[e.Subject=4]="Subject",e[e.TallSubject=5]="TallSubject",e[e.Video=6]="Video",e[e.Folder=7]="Folder"}(_||(_={})),function(e){e[e.Svg=0]="Svg",e[e.Image=1]="Image"}(F||(F={})),function(e){e[e.Large=0]="Large",e[e.Small=1]="Small"}(D||(D={})),B.defaultProps={mediaType:F.Svg,containerClassSize:D.Large};var G={bottomBar:"YnXtZ"};function Z(e){return N.M.isVideo(e.video)?i().createElement("div",{className:G.bottomBar},i().createElement(q,{video:e.video})):i().createElement(i().Fragment,null)}var z={pluginHover:"h4RQa"},H="shared.pluginHover";function W(e){return e.isPlugin?i().createElement(l.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,onClick:e.onClick,className:"\n position-absolute top-0 start-0 end-0 bottom-0 opacity-0 cursor-pointer\n ".concat(z.pluginHover,"\n ").concat(e.className?e.className:"","\n ")},i().createElement("span",{className:"position-absolute top-50 start-50 translate-middle text-nowrap h4 text-white"},i().createElement(y.x,{namespace:H,phrase:"embed"}))):i().createElement(i().Fragment,null)}var K={padlock:"w4cg8",sm:"JpIYd"};function Q(e){var t="sm"===e.size?d.S.Small:d.S.Standard;return i().createElement("div",{className:"".concat(K.padlock," ").concat("sm"===e.size?K.sm:""," bg-white cursor-default d-flex align-items-center justify-content-center")},i().createElement(d.x,{svgName:p.vn.Lock,size:t}))}var Y=n(63946),$={logo:"OA9ft",sm:"fyo2J"};function X(e){var t,n,r,o;if(!N.M.isVideo(e.video)||!e.companyLogoFallbackUrl)return i().createElement(i().Fragment,null);var a=null===(n=null===(t=e.video.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0],c=null!==(o=null===(r=null==a?void 0:a.logo)||void 0===r?void 0:r.url)&&void 0!==o?o:e.companyLogoFallbackUrl;return c?i().createElement("div",null,i().createElement(Y.u,{title:null==a?void 0:a.name,spanHack:!0},i().createElement("div",{className:"".concat($.logo," ").concat("sm"===e.size?$.sm:""),style:{backgroundImage:"url(".concat(c,")")}}))):i().createElement(i().Fragment,null)}X.defaultProps={size:"md"};var J=n(98496),ee=n(74421),te=n(43803);function ne(e){return N.M.isClip(e.video)?i().createElement(te.y,{typeId:ee.E.Clip,size:e.size,inContainer:!0}):N.M.isInteractive(e.video)?i().createElement(te.y,{typeId:ee.E.Interactive,status:e.video.status,size:e.size,inContainer:!0}):i().createElement(i().Fragment,null)}ne.default={size:"md"};var re=n(17082);n(91656);var ie=i().createContext({hasProvider:!1}),oe={hoverContainer:"TzWQw",hovering:"gdTcW"};function ae(e){var t,n=i().useContext(ie);if(null===(t=n.useInitialize)||void 0===t||t.call(n,e),!n.hasProvider)return i().createElement(i().Fragment,null);if("picture-in-picture"===n.mode)return i().createElement(i().Fragment,null);if("hover"===e.mode&&n.isOnPlayPage)return i().createElement(i().Fragment,null);if("default"===n.mode||"play-page"===e.location)return i().createElement(re.t0,{node:n.portalNode});var r=n.started,o="rounded-3";"popout-video"===e.location&&(o="rounded-top-3");var a="".concat(oe.hoverContainer," ").concat(r?oe.hovering:""," ").concat(o," overflow-hidden");return i().createElement("div",{className:a},i().createElement(re.t0,{node:n.portalNode}))}var ce=n(88483),se=n(32557),le={overlayContainer:"qu3A3",topLeftContainer:"gjhMe",topRightContainer:"XAfZW",overlay:"NTrtm",downScale:"puKcM",title:"_6FukN",gradient:"rXzR8",playIcon:"dndOA",videoProgress:"yhWf4",badgeContainer:"AtgmC",clipProgress:"E2egN",interactiveProgress:"WycwR"};function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fe(e){var t="mb-1";return e&&(t+=le.downScale),t}function de(e){var t,n,r,o=e.video,a=e.appLink,c=e.imageOptions,l=e.setFavourite,u=e.canFavourite,f=e.preload,h=e.hovering,v=e.hoverToPlay,m=e.companyLogoFallbackUrl,y=N.M.getCanBeConsumed(e.video),w=y.canNavigate,S=y.canConsume,k=g.t.isObject(null==a?void 0:a.params)?null==a?void 0:a.params:{},x=Object.assign(Object.assign({},e.analyticsOptions),{entity:N.M.getAnalyticsEntity(o)}),O=P.showFavouriteButton(e.video,h),C=N.M.isVideo(o),j=N.M.getRating(e.video),I=(n=(0,se.L)({delay:100}),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return ue(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ue(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),T=I[0],L=I[1]&&S&&v,F=Object.assign(Object.assign({},e.analyticsData),{id:o.id,name:o.name}),D=Object.assign(Object.assign({},x),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement(Y.u,{title:N.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement("div",{className:"position-relative rounded-3 overflow-hidden",ref:T},i().createElement(W,{isPlugin:e.isPlugin,className:"rounded-3",appLink:w?a:null,analyticsData:F,analyticsOptions:D}),O&&i().createElement("div",{className:le.topRightContainer},i().createElement(A,{setFavourite:l,canFavourite:u,video:o,analyticsData:e.analyticsData,analyticsOptions:x})),!w&&i().createElement("div",{className:le.topRightContainer},i().createElement(Q,null)),i().createElement("div",{className:"".concat(le.topLeftContainer," d-flex flex-no-wrap")},i().createElement(ne,{video:o}),i().createElement(X,{video:o,companyLogoFallbackUrl:m})),i().createElement(R.Z,{data:N.M.getThumbnail(o),appLink:w?a:null,imageType:ce.__.Thumbnails,imageOptions:c,preload:f,className:le.gradient,alt:("series"in o&&(null===(t=o.series)||void 0===t?void 0:t.name)?"".concat(o.series.name,": "):"")+o.name,analyticsData:F,analyticsOptions:D},!(!h||!w)&&i().createElement(d.x,{className:le.playIcon,svgName:p.vn.PlayCircle}),i().createElement(B,{type:_.Video}),i().createElement("div",{className:le.overlayContainer},i().createElement("div",{className:le.overlay},i().createElement("div",{className:"".concat(fe(h)," ").concat(le.title)},C&&i().createElement(J.$,{type:e.subTextType,className:"text-shadow clamp-1",video:o,appLink:null,analyticsOptions:null}),i().createElement("span",{className:"h6 text-reset text-shadow clamp-1"},N.M.getTitle(o))),i().createElement(Z,{video:o}),h&&i().createElement(E,{className:"mt-1"},N.M.isVideo(o)&&i().createElement(i().Fragment,null,i().createElement(b.C,{type:b.g.Rating,data:j}),o.hasSubtitle&&i().createElement("span",{className:"badge p-0"},i().createElement(d.x,{svgName:p.vn.CloseCaptionBadge})),i().createElement(b.C,{type:b.g.Interactive,data:o.hasInteractives}),i().createElement(b.C,{type:b.g.DurationExact,data:N.M.getDuration(e.video)})))))),L&&i().createElement(ae,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:k.context,contextId:k.contextId,moviesAndTv:k.mtv})))}var pe,he=n(11306),ve=n(31647),me=i().createContext({}),ye=n(52076);function ge(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e.Left="8px",e.Right="calc(100% - 8px)",e.Center="center"}(pe||(pe={}));var be=function(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2,o=e.x,a=e.y,c=e.width,s=e.height,l=document.getElementById("content-width-reference");if(!l)return{};var u=t||c*i,f=t?t*(s/c):s*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=s*(d=(u=n)/c));var p=a-(f-s)/2+window.scrollY,h=r,v=pe.Center;return r-l.offsetLeft<8&&(h=o-4,v=pe.Left),l.offsetWidth+l.offsetLeft-(r+u)<8&&(h=t?o+c-t:o-c*(d-1)+8,v=pe.Right),{left:h,top:p,height:f,width:u,transformOrigin:v,position:"absolute",originalWidth:c,originalHeight:s}},we={positionWrapper:"jO7pW",animationWrapper:"xXfXO",zoom:"BrrtL"};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ke(e){var t,n,r=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,c=e.fixedHoverWidth,l=e.hoverScale,u=i().useContext(me).setPreviewContentNode;void 0===u&&ve.Q.Ry.throw(new he.H("Please use VideoPreviewContext inside a VideoPreviewContextProvider"));var f=i().useMemo((function(){return(0,re.oD)()}),[]),d=Ee((0,se.L)({delay:100}),2),p=d[0],h=d[1],v=Ee((0,se.X)(),2),m=v[0],y=v[1],g=Ee(i().useState(!1),2),b=g[0],w=(g[1],i().useRef(null)),E=i().useRef(!1),S=h||y;!function(e,t,n){var r,o,a=(r=i().useState(e),o=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(r,o)||function(e,t){if(e){if("string"==typeof e)return ge(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ge(e,t):void 0}}(r,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1],u=i().useRef(e?new Date:null);i().useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)c||l(!0),u.current=new Date,ye.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:s.Vw.Hover}));else{if(!c)return;var r=(new Date).getTime()-u.current.getTime();u.current=null,ye.k.logUserAction(Object.assign(Object.assign({},t),{timeHoveredInMilliseconds:r,timeHoveredInSeconds:r/1e3}),Object.assign(Object.assign({},n),{actionType:s.Vw.Unhover}))}}),[e])}(S,e.analyticsData,e.analyticsOptions),i().useEffect((function(){E.current!==S&&(u(S||b?f:null),E.current=S)}),[S]);var k=(null===(n=null===(t=w.current)||void 0===t?void 0:t.getBoundingClientRect)||void 0===n?void 0:n.call(t))||{},x=k.x,O=k.y,C=k.width,j=k.height,N=i().useMemo((function(){return be({x:x,y:O,width:C,height:j},c,a,l)}),[x,O,C,j,l]),P=N?N.originalWidth/N.width:1,I=r;return i().createElement("div",{ref:w},i().createElement("div",{ref:p},i().createElement(I,Object.assign({isHovering:!1},o))),(S||b)&&i().createElement(re.Nq,{node:f},i().createElement("div",{className:"".concat(we.positionWrapper," ").concat(we.animationWrapper),style:Object.assign({"--scale":P},N),ref:m},i().createElement(I,Object.assign({isHovering:!0,hoverPositionConfig:N,cleanPortalNode:function(){return u(null)}},o)))))}function xe(e){return e.audience?r.createElement("div",{className:"audience-label border rounded-pill d-inline-block px-2 text-nowrap \n ".concat("border-"+e.border," ").concat(e.className?e.className:"")},e.audience.name):r.createElement(r.Fragment,null)}ke.ReferenceContainer=function(e){return i().createElement("div",{id:"content-width-reference",className:"flex-grow-1"},e.children)};var Oe={badgeContainer:"fy9Un",sm:"Rb0TL"};function Ce(e){var t=N.M.getRating(e.video),n=!!e.audience&&"sm"!==e.size,r=!n&&!e.hideRating&&!!t&&"sm"!==e.size;return!e.hideDuration||n||r?i().createElement(E,{className:"".concat(Oe.badgeContainer," ").concat("sm"===e.size?Oe.sm:"")},n&&i().createElement(xe,{audience:e.audience,className:"bg-white text-dark",border:"dark"}),r&&i().createElement(b.C,{type:b.g.Rating,data:t}),!e.hideDuration&&i().createElement(b.C,{type:e.newDurationStyle?b.g.DurationApproximate:b.g.DurationExact,data:e.duration||N.M.getDuration(e.video)})):i().createElement(i().Fragment,null)}Ce.defaultProps={newDurationStyle:!0,size:"md"};var je=n(45428);function Ne(e){if(!e.yearGroups)return i().createElement(i().Fragment,null);var t=je.l.mapRestrictionToText(e.video._restrictions,e.yearGroups);return N.M.getCanBeConsumed(e.video).canConsume&&t?i().createElement(Y.u,{spanHack:!0,spanHackClassName:e.className||"d-inline-block ps-1",title:t,placement:e.tooltipPlacement||"top"},i().createElement(d.x,{svgName:p.vn.Lock,size:"sm"===e.size?d.S.Small:d.S.Standard})):i().createElement(i().Fragment,null)}function Pe(e){var t=e.video,n=e.appLink,r=e.subTextAppLink,o=N.M.getCanBeConsumed(t).canNavigate;return i().createElement("div",{className:"mt-2 ".concat("r70GR")},i().createElement("div",{className:"d-flex flex-column ".concat("rULXI")},N.M.isVideo(t)&&i().createElement(J.$,{type:e.subTextType,className:"text-truncate ".concat("h9k1p"),video:t,appLink:r,analyticsOptions:{location:s.LZ.VideoThumbnail}}),i().createElement(l.F,{className:"h6 text-reset clamp-2 align-middle",appLink:o?n:null},t.name,i().createElement(Ne,{video:e.video,yearGroups:e.yearGroups,size:"sm"}))))}var Ie={tag:"OjHQZ",icon:"SS2zL",active:"kD1xM"};function Te(e){var t,n;return e.appLink?i().createElement(l.F,{appLink:e.appLink,analyticsData:e.appLinkAnalyticsData,analyticsOptions:e.appLinkAnalyticsOptions,className:"\n p-1 pe-2 rounded-pill d-inline-flex align-items-center cursor-pointer\n text-decoration-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.container," ").concat(Ie.tag," ").concat(e.active?Ie.active:"","\n ")},i().createElement(Le,Object.assign({},e))):i().createElement("div",{className:null===(n=e.theme)||void 0===n?void 0:n.container},i().createElement(Le,Object.assign({},e)))}function Le(e){var t;return i().createElement(i().Fragment,null,i().createElement(d.x,{className:"".concat(Ie.icon," rounded-circle bg-").concat(e.iconVariant," text-white"),svgName:e.svgName}),i().createElement("span",{className:"ps-1 text-nowrap user-select-none ".concat(null===(t=e.theme)||void 0===t?void 0:t.tabLabel)},e.text))}var Ae="shared.classroomGuideTag";function _e(e){var t,n,r;return!e.video||N.M.isInteractive(e.video)?i().createElement(i().Fragment,null):e.video.glance?i().createElement(Te,{theme:{container:"classroom-guide-tag",tabLabel:"classroom-guide-tag-label"},svgName:p.vn.GraduationCap,iconVariant:"navy",text:S.T.getPhrase(Ae,"classroomGuide"),appLink:e.appLink,appLinkAnalyticsData:Object.assign({glanceId:null===(t=e.video.glance)||void 0===t?void 0:t.id,totalPointsOfInterest:null===(r=null===(n=e.video.pointsOfInterest)||void 0===n?void 0:n.data)||void 0===r?void 0:r.length,videoGuidanceType:"classroom-guide"},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)}):i().createElement(i().Fragment,null)}var Fe="shared.interactivesTag";function De(e){var t;if(!N.M.showInteractivesGuidance(e.video))return i().createElement(i().Fragment,null);var n=!N.M.isInteractive(e.video)&&((null===(t=e.video.interactives)||void 0===t?void 0:t.data.length)||0);return i().createElement(Te,{svgName:p.vn.Interactive,iconVariant:"green",text:S.T.getPhrase(Fe,"interactives",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}var Re="shared.resourcesTag";function Me(e){var t;if(!N.M.showResourcesGuidance(e.video))return i().createElement(i().Fragment,null);var n=!N.M.isInteractive(e.video)&&(null===(t=e.video.resources)||void 0===t?void 0:t.data.length)||0;return i().createElement(Te,{svgName:p.vn.Resources,iconVariant:"indigo",text:S.T.getPhrase(Re,"resources",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:n},e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:s.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function Ue(e){var t,n,r,o=N.M.showInteractivesGuidance(e.video)&&N.M.showResourcesGuidance(e.video);return i().createElement("div",{className:"".concat(e.containerClassName," ").concat(o?e.responsiveClassName:"")},i().createElement(_e,{appLink:null===(t=e.getClassroomGuideAppLink)||void 0===t?void 0:t.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),i().createElement(Me,{appLink:null===(n=e.getResourceGuidanceAppLink)||void 0===n?void 0:n.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),i().createElement(De,{appLink:null===(r=e.getInteractiveGuidanceAppLink)||void 0===r?void 0:r.call(e,e.video.id,e.video.typeId),video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}))}var Ve={preview:"whbhf",topLeftContainer:"wHY80",details:"vMaXP",isHovering:"tR1jA",videoGuidanceTags:"KJrT1",responsiveGuidance:"OixHb",dropdown:"oZXV7",show:"EiQ04",topRightContainer:"FAuzc"},Be=function(e){var t,n=e.video,r=e.appLink,o=e.imageOptions,a=e.preload,c=e.setFavourite,l=e.canFavourite,u=e.isHovering,f=e.hoverToPlay,d=e.companyLogoFallbackUrl,p=g.t.isObject(null==r?void 0:r.params)?null==r?void 0:r.params:{},h=N.M.getCanBeConsumed(n),v=h.canNavigate,m=h.canConsume;i().useEffect((function(){return function(){var t;null===(t=e.cleanPortalNode)||void 0===t||t.call(e)}}),[]);var y="position-relative bg-white";e.extraClasses&&(y+=" ".concat(e.extraClasses)),u&&(y+=" rounded-3 shadow-lg");var b=Object.assign(Object.assign({},e.analyticsOptions),{entity:N.M.getAnalyticsEntity(n)}),w=e.isHovering&&m&&f,E=P.showFavouriteButton(e.video,u),S=Object.assign(Object.assign({},e.analyticsData),{id:n.id,name:n.name}),k=Object.assign(Object.assign({},b),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement("div",{className:y},E&&i().createElement("div",{className:Ve.topRightContainer},i().createElement(A,{setFavourite:c,canFavourite:l,video:n,analyticsData:e.analyticsData,analyticsOptions:b})),!v&&i().createElement("div",{className:Ve.topRightContainer},i().createElement(Y.u,{title:N.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement(Q,null))),i().createElement("div",{className:"position-relative"},i().createElement(W,{isPlugin:e.isPlugin,className:u?"rounded-top-3":"rounded-3",onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},appLink:v?r:null,analyticsData:S,analyticsOptions:k}),i().createElement(R.Z,{onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},data:N.M.getThumbnail(n),appLink:v?r:null,imageType:ce.__.Thumbnails,imageOptions:o,preload:a,className:"overflow-hidden ".concat(u?Ve.preview:"rounded-3 ".concat(Ve.original)),alt:("series"in n&&(null===(t=n.series)||void 0===t?void 0:t.name)?"".concat(n.series.name,": "):"")+n.name,analyticsData:S,analyticsOptions:k},i().createElement(B,{type:_.Video}),i().createElement("div",{className:"p-absolute w-100 h-100 text-white"},i().createElement("div",{className:"".concat(Ve.topLeftContainer," d-flex flex-no-wrap")},i().createElement(ne,{video:n}),i().createElement(X,{video:n,companyLogoFallbackUrl:d})),i().createElement(Ce,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration}),i().createElement(Z,{video:n}))),w&&i().createElement(ae,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:p.context,contextId:p.contextId,moviesAndTv:p.mtv,location:"popout-video"})),!u&&!e.hideTitle&&i().createElement(Pe,Object.assign({},e)),i().createElement("div",{className:"".concat(Ve.details," ").concat(u?"".concat(Ve.isHovering," box-shadow"):"")},u&&i().createElement(i().Fragment,null,i().createElement("div",{className:"".concat(u?Ve.videoGuidanceTags:"")},i().createElement(Pe,Object.assign({},e)),e.showVideoGuidance&&u&&i().createElement(Ue,{getClassroomGuideAppLink:e.getClassroomGuideAppLink,getResourceGuidanceAppLink:e.getResourceGuidanceAppLink,getInteractiveGuidanceAppLink:e.getInteractiveGuidanceAppLink,video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,responsiveClassName:Ve.responsiveGuidance,containerClassName:"d-flex justify-content-start align-items-center pt-2"})))))};function qe(e){return i().createElement(i().Fragment,null,i().createElement(ke,{hoverableComponent:Be,componentProps:e,fixedHoverWidth:400,minHoverWidth:400,analyticsData:Object.assign(Object.assign({},e.analyticsData),{id:e.video.id,name:e.video.name}),analyticsOptions:Object.assign(Object.assign({},e.analyticsOptions),{entity:N.M.getAnalyticsEntity(e.video)})}))}var Ge,Ze={mask:"qpc7L",small:"L8Oxs",video:"b8kJW",playlist:"eo2p2",maskContainer:"lpwag"};function ze(e){var t=e.type,n=e.size,i=function(e){return e===Ge.Video?Ze.video:e===Ge.Playlist?Ze.playlist:""}(t),o=function(e){return e===Ge.Video?p.vn.PlayCircle:""}(t);return r.createElement("div",{className:"".concat(Ze.maskContainer," ").concat("sm"===n?Ze.small:"")},r.createElement("div",{className:Ze.mask}),r.createElement(d.x,{svgName:o,className:i}))}!function(e){e[e.Video=0]="Video",e[e.Playlist=1]="Playlist",e[e.Series=2]="Series"}(Ge||(Ge={})),ze.defaults={size:"md"};var He,We={unchecked:"bup9I",outline:"ealw_",checked:"A1Ov0",checkMark:"c14lI"};function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qe(e){var t,n,r=(t=i().useState(e.status===He.Complete),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ke(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ke(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1];i().useEffect((function(){a(e.status===He.Complete)}),[e.status]);var c="cursor-pointer rounded-circle ".concat(o?We.checked:We.unchecked);return e.className&&(c+=" ".concat(e.className)),"outline"===e.style&&(c+=" ".concat(We.outline)),e.status&&e.status!==He.None&&k.q.isFunction(e.setStatus)?i().createElement(x.L,{className:c,onClick:function(){var t=!o;a(t);var n=t?He.Complete:He.Incomplete;e.setStatus(n).catch((function(){a(!t)}))},disabled:e.disabled},i().createElement(d.x,{svgName:p.vn.Check,className:"svg-container ".concat(We.checkMark)})):i().createElement(i().Fragment,null)}!function(e){e.None="None",e.Complete="Complete",e.Incomplete="Incomplete"}(He||(He={})),Qe.defaultProps={style:"filled"};var Ye,$e={container:"efxnE",cvIcon:"OJ_ZQ",action:"vWvGn"};function Xe(e){return N.M.getCanBeConsumed(e.video).canNavigate?function(e){var t;return!(null===(t=N.M.getCanBeConsumed(e.video))||void 0===t?void 0:t.canConsume)||!(!k.q.isFunction(e.setFavourite)||!k.q.isFunction(e.canFavourite))||!!k.q.isFunction(e.setCheckMarkStatus)}(e)?i().createElement("div",{className:"".concat($e.container," d-flex align-items-center")},i().createElement(A,{setFavourite:e.setFavourite,canFavourite:e.canFavourite,video:e.video,className:$e.action,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions}),i().createElement(Qe,{status:e.checkMarkStatus,setStatus:e.setCheckMarkStatus,className:$e.action})):i().createElement(i().Fragment,null):i().createElement("div",{className:$e.container},i().createElement(Q,{size:e.size}))}!function(e){e[e.Below=1]="Below",e[e.Overlay=2]="Overlay",e[e.Independent=3]="Independent"}(Ye||(Ye={}));var Je={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nt="shared.staticVideoThumbnail";function rt(e){var t,n=e.video,r=e.subTextAppLink,o=e.textPosition,a=e.appLink,c=o===Ye.Overlay,u=N.M.getCanBeConsumed(e.video).canNavigate,f="";return c?(f=Je.titleOverlay,u&&(N.M.isClip(n)&&(f+=" "+Je.clip),N.M.isInteractive(n)&&(f+=" "+Je.interactive))):f=Je.titleBelow,i().createElement("div",{className:f},N.M.isVideo(n)&&i().createElement(J.$,{type:e.subTextType,className:c?"text-shadow clamp-1":"clamp-2",video:n,appLink:c?null:r,analyticsOptions:{location:s.LZ.VideoThumbnail}}),c||!u?i().createElement("span",{className:"h6 text-reset clamp-1"},null!==(t=n.name)&&void 0!==t?t:S.T.getPhrase(nt,"videoUnavailable")):i().createElement(l.F,{className:"h6 text-reset clamp-2",appLink:a},n.name))}function it(e){var t,n,r=e.video,o=e.appLink,a=e.textPosition,c=e.imageOptions,l=e.setFavourite,u=e.preload,f=e.hoverToPlay,d=g.t.isObject(null==o?void 0:o.params)?null==o?void 0:o.params:{},p=et((0,se.X)(),2),h=p[0],v=p[1],m=et((0,se.L)({delay:100}),2),y=m[0],b=m[1],w=N.M.getCanBeConsumed(r),E=w.canNavigate,S=w.canConsume,k=b&&S&&f,x=Object.assign(Object.assign({},e.analyticsOptions),{entity:N.M.getAnalyticsEntity(r)}),O=!!o&&!e.hideMask&&E,C=N.M.getPrivacyReasoning(e.video,e.showSignIn),j=Object.assign(Object.assign({},e.analyticsData),{id:r.id,name:r.name}),I=Object.assign(Object.assign({},x),{actionType:s.Vw.Click,descriptor:s._S.Thumbnail});return i().createElement(Y.u,{title:C,spanHack:!0,spanHackClassName:""},i().createElement("div",{className:(n="position-relative",n+=o&&E?" cursor-pointer":"",e.extraClasses&&(n+=" ".concat(e.extraClasses)),a===Ye.Overlay&&(n+=" rounded overflow-hidden"),n),ref:function(e){h.current=e,y.current=e}},i().createElement(W,{isPlugin:e.isPlugin,className:"sm"===e.size?"rounded":"rounded-3",appLink:E?o:null,analyticsData:j,analyticsOptions:I}),i().createElement(Xe,{video:r,checkMarkStatus:e.checkMarkStatus,setCheckMarkStatus:e.setCheckMarkStatus,setFavourite:l,canFavourite:function(){var t;return(null===(t=e.canFavourite)||void 0===t?void 0:t.call(e,e.video))&&P.showFavouriteButton(r,v)},analyticsData:e.analyticsData,analyticsOptions:x,size:e.size}),i().createElement(R.Z,{data:N.M.getThumbnail(r),appLink:E?o:null,onClick:E?e.onClick:void 0,imageType:ce.__.Thumbnails,imageOptions:c,preload:u,className:function(){var t="overflow-hidden ".concat("sm"===e.size?"rounded":"rounded-3");return e.imageClassName&&(t+=" ".concat(e.imageClassName)),a===Ye.Overlay&&(t+=" ".concat(Je.gradient)),t}(),alt:("series"in r&&(null===(t=r.series)||void 0===t?void 0:t.name)?"".concat(r.series.name,": "):"")+r.name,analyticsData:j,analyticsOptions:I},O&&i().createElement(ze,{type:Ge.Video,size:e.size}),i().createElement(B,{type:_.Video}),i().createElement("div",{className:Je.overlayContainer},a===Ye.Overlay&&i().createElement(rt,Object.assign({},e)),i().createElement("div",{className:"".concat(Je.topLeftContainer," d-flex flex-no-wrap")},i().createElement(ne,{video:r,size:e.size}),i().createElement(X,{video:r,companyLogoFallbackUrl:e.companyLogoFallbackUrl,size:e.size})),i().createElement(Z,{video:r}),i().createElement(Ce,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration,newDurationStyle:e.newDurationStyle,size:e.size}))),k&&i().createElement(ae,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:d.context,contextId:d.contextId,moviesAndTv:d.mtv}),a===Ye.Below&&i().createElement(rt,Object.assign({},e))))}function ot(e){switch(e.type){case"static":return r.createElement(it,Object.assign({},e));case"cosmetic":return r.createElement(it,Object.assign({},e,{hoverToPlay:!1}));case"expandable":return r.createElement(de,Object.assign({},e));case"popout":return r.createElement(qe,Object.assign({},e));default:return}}ot.defaultProps={hideRating:!0,size:"md",hoverToPlay:!0};var at=n(50072),ct=n(65402),st={navItem:"GyyRT",active:"aVNhj",navContainer:"uQ6as",navItemHeading:"NjJLh"},lt="libraryRequests.leftNav";function ut(e){var t,n,r=e.libraryRequest,o=r.sender&&"".concat(r.sender.name," ").concat(r.sender.surname),u=(null===(t=r.object)||void 0===t?void 0:t.name)||r.name;return i().createElement(l.F,{className:"d-flex py-3 px-3 text-decoration-none ".concat(st.navItem," ").concat(e.active?st.active:""),appLink:Object.assign(Object.assign({},e.appLink),{args:[r.id],params:e.queryParams}),onClick:function(){return c.t.preventScrollTop()}},i().createElement("div",{className:"col-5 px-0"},i().createElement(ot,{video:null!==(n=r.object)&&void 0!==n?n:{},type:"cosmetic",imageOptions:{size:ce.h2.Small},textPosition:Ye.Independent,hideMask:!0})),i().createElement("div",{className:"col-7 ps-2"},i().createElement("div",{className:"d-flex justify-content-between w-100"},i().createElement("div",{className:"overflow-hidden"},i().createElement(J.$,{type:"series",video:r.object,analyticsOptions:{location:s.LZ.LibraryRequestDetails}}),!!u&&i().createElement("h5",{className:"m-0 mb-0 h6",title:u},i().createElement("span",{className:"text-truncate pb-1 d-block ".concat(st.navItemHeading)},u))),r.status!==at.l.Pending&&i().createElement("div",{className:"flex-shrink-0 ms-1"},i().createElement(ct.h,{status:r.status}))),!!o&&i().createElement("div",null,i().createElement(y.x,{namespace:lt,phrase:r.status===at.l.AutoApproved?"addedBy":"requestedBy",options:{fullName:o}})),i().createElement("div",null,(0,a.WU)(r.dateCreated))))}function ft(e){return i().createElement("div",{className:"".concat(st.navContainer," bg-white rounded overflow-hidden")},i().createElement(o.$B,{hideTracksWhenNotNeeded:!0},e.libraryRequests.map((function(t,n){return i().createElement(ut,{libraryRequest:t,key:n,active:e.selectedId===t.id,appLink:e.appLink,queryParams:e.queryParams})})),(e.nextCursor||e.isFetching)&&i().createElement(m,{isFetching:e.isFetching,fetchNext:e.fetchNext,nextCursor:e.nextCursor,fetchOnScroll:!0})))}},7044:function(e,t,n){"use strict";n.d(t,{p:function(){return a}});var r=n(1024),i=n.n(r);function o(){return i().createElement("div",{className:"d-flex p-3"},i().createElement("div",{className:"col-5 px-0"},i().createElement("div",{className:"responsive-img partial-loading-background rounded"})),i().createElement("div",{className:"col-7 ps-2"},i().createElement("div",{className:"partial-loading-background mb-1",style:{height:"1.25rem",width:"9rem"}}),i().createElement("div",{className:"partial-loading-background",style:{height:"1rem",width:"4rem"}})))}function a(){return i().createElement("div",{className:"bg-white rounded"},Array(5).fill(null).map((function(e,t){return i().createElement(o,{key:t})})))}},17950:function(e,t,n){"use strict";n.d(t,{F:function(){return b}});var r=n(1024),i=n.n(r),o=n(57857),a=n(70065),c=n(53808),s=n(49642),l=n(90335);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},u(e)}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d="shared.videoSortSelect",p=c.q.memoize((function(){return f(f(f(f(f(f({},l.D.RecentlyAdded,{name:o.T.getPhrase(d,"recentlyAdded")}),l.D.AtoZ,{name:o.T.getPhrase(d,"atoz")}),l.D.ZtoA,{name:o.T.getPhrase(d,"ztoa")}),l.D.Newest,{name:o.T.getPhrase(d,"newest")}),l.D.Oldest,{name:o.T.getPhrase(d,"oldest")}),l.D.Series,{name:o.T.getPhrase(d,"series")})}));function h(e){var t=e.sortTypes||p();return r.createElement("div",{className:"dropdown"},r.createElement("a",{className:"btn btn-".concat(e.variant," ms-2 dropdown-toggle"),type:"button",id:"sort-select","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},t[e.type].name),r.createElement("div",{className:"dropdown-menu dropdown-menu-end","aria-labelledby":"sort-select"},Object.keys(t).map((function(n){var i="dropdown-item";return n===e.type&&(i+=" active"),r.createElement(s.F,{key:n,className:i,appLink:e.getSortAppLink(n),analyticsData:{sort:t[n].name},analyticsOptions:e.analyticsOptions},t[n].name)}))))}function v(e){return v="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},v(e)}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=v(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}h.defaultProps={variant:"light"};var y=o.T.encloseNamespace("libraryRequests.sort"),g=function(){return m(m({},l.D.Newest,{name:y("newest")}),l.D.Oldest,{name:y("oldest")})};function b(e){var t=g();return i().createElement(h,{variant:"outline-dark",type:e.queryParams.sort||l.D.Newest,getSortAppLink:function(t){return Object.assign(Object.assign({},e.appLink),{params:Object.assign(Object.assign({},e.queryParams),{sort:t})})},sortTypes:t,analyticsOptions:{location:a.LZ.LibraryRequestDetails,entity:a.py.LibraryRequest,actionType:a.Vw.Sort,workflowPhase:a.eu.Complete}})}},65402:function(e,t,n){"use strict";n.d(t,{h:function(){return d},$:function(){return f}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(63791),s=n(50072),l={svgContainer:"O2Czg"},u=o.T.encloseNamespace("libraryRequests.statusIcon");function f(e){switch(e){case s.l.AutoApproved:return u("autoApproved");case s.l.Approved:return u("approved");case s.l.Closed:return u("closed");case s.l.Rejected:return u("rejected")}return""}function d(e){var t="",n="".concat(l.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case s.l.AutoApproved:t=c.vn.Check,n+="bg-secondary";break;case s.l.Approved:t=c.vn.Check,n+="bg-success";break;case s.l.Closed:t=c.vn.Minus,n+="bg-secondary";break;case s.l.Rejected:t=c.vn.Close,n+="bg-danger"}return i().createElement(a.x,{svgName:t,className:n,size:a.S.Small,title:f(e.status),tooltipSpanHack:!0,tooltipPlacement:"top"})}},9416:function(e,t,n){"use strict";n.d(t,{A:function(){return m}});var r=n(1024),i=n.n(r),o=n(57857),a=n(52076),c=n(49642),s=n(41087),l=n(58424),u=n(39396),f={pillTabSelector:"Hdi6o",tab:"RvNxr",minWidth:"GHSz9",radiusSmall:"VhJJa",tabLink:"WFyvo"};function d(e){return i().createElement(i().Fragment,null,!!e.tab.svgName&&i().createElement("div",{className:e.tab.name?"pe-1":""},i().createElement(u.x,{svgName:e.tab.svgName})),e.tab.name,"number"==typeof e.tab.count&&i().createElement("div",{className:"ps-2"},i().createElement(s.C,{type:s.g.Count,data:e.tab.count})))}function p(e){var t;return i().createElement("nav",{className:null!==(t=e.className)&&void 0!==t?t:""},i().createElement("ul",{className:"\n list-unstyled d-inline-block m-0 ".concat(f.pillTabSelector,"\n ").concat(e.borderRadius?f.radiusSmall:"","\n ").concat(e.listClassName,"\n ")},e.tabs.map((function(e,t){return i().createElement("li",{className:"\n p-0 ".concat(f.tab," ").concat(e.active?"btn btn-dark":"btn btn-outline-dark","\n ").concat(e.name?f.minWidth:""," ").concat(e.className,"\n "),key:t},e.appLink?i().createElement(c.F,{appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset px-2 text-nowrap ".concat(f.tabLink,"\n ")},i().createElement(d,{tab:e})):i().createElement(l.L,{className:"\n cursor-pointer d-flex align-items-center justify-content-center\n text-decoration-none text-reset p-2 text-nowrap ".concat(f.tabLink,"\n "),onClick:function(){return function(e){!e.active&&e.onSelect&&(e.onSelect(),e.analyticsData&&e.analyticsOptions&&a.k.logUserAction(e.analyticsData,e.analyticsOptions))}(e)}},i().createElement(d,{tab:e})))}))))}p.defaultProps={borderRadius:"lg"};var h=n(50997),v=o.T.encloseNamespace("libraryRequests.tabs");function m(e){var t=[{name:v("pending"),appLink:{application:h.OV.LIBRARY_REQUESTS,action:h.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:v("past"),appLink:{application:h.OV.LIBRARY_REQUESTS,action:h.eX.LibraryRequests.PAST_REQUESTS,args:[""]},active:"past"===e.active}];return i().createElement("div",{className:"mb-3"},i().createElement(p,{tabs:t}))}},50072:function(e,t,n){"use strict";var r;n.d(t,{l:function(){return r}}),function(e){e.Pending="Pending",e.Approved="Approved",e.Rejected="Rejected",e.Closed="Closed",e.AutoApproved="AutoApproved"}(r||(r={}))},41026:function(e,t,n){"use strict";n.d(t,{K:function(){return s}});var r=n(1024),i=n.n(r),o=n(57857),a=n(89375),c=o.T.encloseNamespace("libraryRequests.libraryRequestTitle");function s(e){var t,n=(null===(t=null==e?void 0:e.object)||void 0===t?void 0:t.name)||(null==e?void 0:e.name),r=c("title")+(n?" - ".concat(n):"");i().useEffect((function(){return a.j.setPageTitle(r)}),[r])}},59198:function(e,t,n){"use strict";n.d(t,{s:function(){return a}});var r=n(86120),i=n(82378),o=n(25796);function a(e){var t=r.a.useGetFetch(),n=function(t){return o.y.comments(e,t)};return(0,i.i)(!!e&&n,(function(e){return t(n(e))}))}},85739:function(e,t,n){"use strict";n.d(t,{p:function(){return s}});var r=n(1024),i=n.n(r),o=n(86120),a=n(94223),c=n(25796);function s(e,t){var n=o.a.useGetFetch(),r=function(n){return c.y.libraryRequests(e,t,n)},s=function(e){return n(r(e))},l=(0,a.P)(r&&function(e){return r(e).key});return i().useEffect((function(){l&&l.shouldInitialFetch&&s()}),[e,t]),Object.assign(Object.assign({},l),{fetchNext:s})}},30328:function(e,t,n){"use strict";n.d(t,{A:function(){return a}});var r=n(1024),i=n.n(r),o=n(31647);function a(e){var t=e.id,n=e.appLink,r=e.requests;i().useEffect((function(){!t&&(null==r?void 0:r.length)&&o.Q.C$.trigger(Object.assign(Object.assign({},n),{args:[r[0].id]}),{replace:!0})}),[t,null==r?void 0:r.length])}},64429:function(e,t,n){"use strict";n.d(t,{m:function(){return s}});var r=n(1024),i=n.n(r),o=n(31647),a=n(50997),c=n(50072);function s(e,t,n){i().useEffect((function(){e&&(e.status===c.l.Pending&&"pending"!==t&&o.Q.C$.trigger({application:a.OV.LIBRARY_REQUESTS,action:a.eX.LibraryRequests.PENDING_REQUESTS,args:[e.id],params:n},{replace:!0}),e.status!==c.l.Pending&&"pending"===t&&o.Q.C$.trigger({application:a.OV.LIBRARY_REQUESTS,action:a.eX.LibraryRequests.PAST_REQUESTS,args:[e.id],params:n},{replace:!0}))}),[e,t])}},39123:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var r=n(1024),i=n.n(r),o=n(48088),a=n(54096),c=n(50997);function s(e){var t=(0,a.G)(c.Or.Library);function n(n){t.getLibraries((function(t){return e(t.toJSON(),n.toJSON())}))}i().useEffect((function(){return o.Radio.channel(c.Vk.LIBRARY).on("folder:created",n),function(){o.Radio.channel(c.Vk.LIBRARY).off("folder:created",n)}}),[e])}},61356:function(e,t,n){"use strict";n.d(t,{c:function(){return O}});var r=n(48088),i=n(39479),o=n(31647),a=n(52076),c=n(70065),s=n(88483),l=n(2772),u=n(10101),f=n(89167),d=n(57098),p=n(93569),h=n(264),v=n(57e3),m=n(37339),y=n.n(m);function g(e){return g="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},g(e)}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,w(r.key),r)}}function w(e){var t=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function E(e,t,n){return t=k(t),function(e,t){if(t&&("object"==g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,S()?Reflect.construct(t,n||[],k(e).constructor):t.apply(e,n))}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(S=function(){return!!e})()}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}var O=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=E(this,t,[e]))._viewKeyRequested=!1,n}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.bindListeners()}},{key:"name",get:function(){return"VideoPreviewComponent"}},{key:"template",get:function(){return y()}},{key:"instanceChannelName",get:function(){return p.N0.generateUniqueChannelName(this)}},{key:"defaults",get:function(){return{captureAnalytics:!0}}},{key:"behaviors",get:function(){var e=this;return[{behaviorClass:u.Im,selector:".lazy-img",callback:function(){r.Radio.channel(e.instanceChannelName).trigger("show:play:icon")},minBrowserSupportVersion:d.v9}]}},{key:"regions",value:function(){return{player:{el:".video-player-region",replaceElement:!1},thumbnail:{el:".thumbnail-region",replaceElement:!0}}}},{key:"events",value:function(){return{click:"onClick"}}},{key:"bindListeners",value:function(){this.options.channelName&&this.listenTo(this.options.channelName,"update:chapter:time",this.onUpdateWebplayer)}},{key:"onUpdateWebplayer",value:function(e){return h.g.hasLite?this.playerViewKey?this.player?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview()):(this.listenToOnce(this.options.channelName,"player:loaded",i.bind(this.seekToChapter,this,e)),void this.requestViewKey()):this.webPlayer?void this.seekToChapter(e):(this.listenToOnce(this.options.channelName,"webplayer:loaded",i.bind(this.seekToChapter,this,e)),void this.renderVideoPreview())}},{key:"seekToChapter",value:function(e){this.player?this.player.currentTime(e):this.webPlayer.seekTo(e)}},{key:"requestViewKey",value:function(){var e=this;this.playerViewKey||this._viewKeyRequested||(this._viewKeyRequested=!0,this.options.createViewKey(this.model.get("id"),(function(t){e.playerViewKey=t,e.renderVideoPreview()})))}},{key:"onClick",value:function(){this.model.get("id")&&(h.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new l.Z({model:this.model,thumbnailOptions:{size:s.h2.Medium},playIcon:!0,lazyload:!0,channelName:this.instanceChannelName,thumbnail:p.M2.getThumbnail(this.model),duration:p.M2.getDuration(this.model),durationNewStyle:!0}))}},{key:"renderVideoPreview",value:function(){if(this.playerViewKey)return this.player=new v.l({model:this.playerViewKey,playerApiUrl:this.options.playerApiUrl,channelName:this.options.channelName}),void this.showChildView("player",this.player);this.webPlayer=new f.Q({model:this.model,webPlayerUrl:this.options.webPlayerUrl,parentChannelName:this.options.channelName,autoplay:!0,analyticsOptions:a.k.mergeOptions(this.options.analyticsOptions,{entity:c.py.Video}),captureAnalytics:this.options.captureAnalytics,currentUser:this.options.currentUser}),this.showChildView("player",this.webPlayer)}},{key:"onRender",value:function(){this.playerViewKey?this.renderVideoPreview():this.renderThumbnail()}}])&&b(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o}(o.Q.wA)},37339:function(e,t,n){var r=n(32227);e.exports=(r.default||r).template({1:function(e,t,n,r,i){return"cursor-pointer "},compiler:[8,">= 4.3.0"],main:function(e,t,n,r,i){var o;return e.propertyIsEnumerable,'<div class="video-player-region '+(null!=(o=n.if.call(null!=t?t:e.nullContext||{},null!=t?t.id:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))?o:"")+'">\r\n <div class="thumbnail-region"></div>\r\n</div>'},useData:!0})}}]);
|