@clickview/library-editor 1.55.0 → 1.56.0-rc.0

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.
Files changed (71) hide show
  1. package/dist/bundles.json +2 -2
  2. package/dist/css/{4001-library-editor-f6d2f9fb58.chunk.css → 4001-library-editor-da87291909.chunk.css} +1 -1
  3. package/dist/css/{535-library-editor-e2b19f99ee.chunk.css → 535-library-editor-fa24102d7f.chunk.css} +1 -1
  4. package/dist/css/{61-library-editor-f25bac2db6.chunk.css → 61-library-editor-b5c939f10f.chunk.css} +2 -1
  5. package/dist/css/{library-editor-app-bcca987662.css → library-editor-app-6b401b236c.css} +3 -3
  6. package/dist/languages/en.json +1 -1
  7. package/dist/scripts/{112-4f413f94c0.chunk.js → 112-5209a9a2d0.chunk.js} +1 -1
  8. package/dist/scripts/{2601-d46e5810eb.chunk.js → 2601-0bbd055a92.chunk.js} +1 -1
  9. package/dist/scripts/2644-17c596a0c9.chunk.js +1 -0
  10. package/dist/scripts/{343-41502b5d24.chunk.js → 343-a3dabdd615.chunk.js} +1 -1
  11. package/dist/scripts/{3551-ad62e3a403.chunk.js → 3551-d2ea1832c5.chunk.js} +1 -1
  12. package/dist/scripts/376-d76b864238.chunk.js +1 -0
  13. package/dist/scripts/4001-319ffe95a1.chunk.js +2 -0
  14. package/dist/scripts/{4024-5bc8aa8dcd.chunk.js → 4024-218556677c.chunk.js} +1 -1
  15. package/dist/scripts/471-7ede525821.chunk.js +2 -0
  16. package/dist/scripts/5173-f2d72d7c3e.chunk.js +1 -0
  17. package/dist/scripts/{61-ca10628c31.chunk.js → 61-de99ab5568.chunk.js} +2 -2
  18. package/dist/scripts/{6352-6452f77c89.chunk.js → 6352-50c10c1bc6.chunk.js} +1 -1
  19. package/dist/scripts/{7002-eef9319d36.chunk.js → 7002-6d9f52d6d3.chunk.js} +1 -1
  20. package/dist/scripts/708-f7536cb7a4.chunk.js +1 -0
  21. package/dist/scripts/8130-f0c1977041.chunk.js +1 -0
  22. package/dist/scripts/{8727-9077c2b877.chunk.js → 8727-188101f028.chunk.js} +1 -1
  23. package/dist/scripts/{8952-a9a7742f72.chunk.js → 8952-4201ae6599.chunk.js} +1 -1
  24. package/dist/scripts/{9369-1e706eb521.chunk.js → 9369-d078677c28.chunk.js} +1 -1
  25. package/dist/scripts/bundle-b38a9aa50e.min.js +2 -0
  26. package/package.json +1 -1
  27. package/dist/scripts/2644-98304e9394.chunk.js +0 -1
  28. package/dist/scripts/376-83584040a3.chunk.js +0 -1
  29. package/dist/scripts/4001-9194fbe77b.chunk.js +0 -2
  30. package/dist/scripts/5173-d333602893.chunk.js +0 -1
  31. package/dist/scripts/6532-48f3f080f5.chunk.js +0 -2
  32. package/dist/scripts/708-c74c75f82a.chunk.js +0 -1
  33. package/dist/scripts/8130-753cb2b6bb.chunk.js +0 -1
  34. package/dist/scripts/bundle-9fb3396566.min.js +0 -2
  35. package/typings/libs/CVEvents.d.ts +0 -13
  36. package/typings/libs/lodash.d.ts +0 -11
  37. /package/dist/scripts/{101-8f41923234.chunk.js → 101-c2af2cc10c.chunk.js} +0 -0
  38. /package/dist/scripts/{1010-4a381a84d4.chunk.js → 1010-f1c8bca022.chunk.js} +0 -0
  39. /package/dist/scripts/{1409-58db6bd9f7.chunk.js → 1409-ae672618b1.chunk.js} +0 -0
  40. /package/dist/scripts/{1703-45ced13ccd.chunk.js → 1703-0f9e8a489f.chunk.js} +0 -0
  41. /package/dist/scripts/{1832-6a54b38248.chunk.js → 1832-52444b0088.chunk.js} +0 -0
  42. /package/dist/scripts/{1876-e0567188b8.chunk.js → 1876-0a931d62d9.chunk.js} +0 -0
  43. /package/dist/scripts/{2417-7628573bf3.chunk.js → 2417-9731b9da6b.chunk.js} +0 -0
  44. /package/dist/scripts/{243-25fcce188c.chunk.js → 243-c4bb9e995e.chunk.js} +0 -0
  45. /package/dist/scripts/{259-e24fcf8f12.chunk.js → 259-ef5133c0fd.chunk.js} +0 -0
  46. /package/dist/scripts/{299-1a0d6a88dc.chunk.js → 299-5585deab1d.chunk.js} +0 -0
  47. /package/dist/scripts/{35-68aa98885c.chunk.js → 35-dde0c25008.chunk.js} +0 -0
  48. /package/dist/scripts/{3746-9c62c31099.chunk.js → 3746-588ea9d62d.chunk.js} +0 -0
  49. /package/dist/scripts/{4001-9194fbe77b.chunk.js.LICENSE.txt → 4001-319ffe95a1.chunk.js.LICENSE.txt} +0 -0
  50. /package/dist/scripts/{4245-59b4242cad.chunk.js → 4245-db2d86c59d.chunk.js} +0 -0
  51. /package/dist/scripts/{4523-55c4df85c8.chunk.js → 4523-fec10bbbcb.chunk.js} +0 -0
  52. /package/dist/scripts/{6532-48f3f080f5.chunk.js.LICENSE.txt → 471-7ede525821.chunk.js.LICENSE.txt} +0 -0
  53. /package/dist/scripts/{5046-cb525612c6.chunk.js → 5046-b65e8db7c0.chunk.js} +0 -0
  54. /package/dist/scripts/{5286-7aac82c4d1.chunk.js → 5286-c574f5b574.chunk.js} +0 -0
  55. /package/dist/scripts/{535-27d0457532.chunk.js → 535-794be8eab5.chunk.js} +0 -0
  56. /package/dist/scripts/{546-f770211173.chunk.js → 546-2ee5c90feb.chunk.js} +0 -0
  57. /package/dist/scripts/{5707-fcb653aa7a.chunk.js → 5707-b2b239ff4e.chunk.js} +0 -0
  58. /package/dist/scripts/{5747-674f00efcd.chunk.js → 5747-7ca7ad6c1d.chunk.js} +0 -0
  59. /package/dist/scripts/{5891-0864c38750.chunk.js → 5891-ac4d3f803a.chunk.js} +0 -0
  60. /package/dist/scripts/{61-ca10628c31.chunk.js.LICENSE.txt → 61-de99ab5568.chunk.js.LICENSE.txt} +0 -0
  61. /package/dist/scripts/{6963-0e2bf1bde7.chunk.js → 6963-254d82f6c2.chunk.js} +0 -0
  62. /package/dist/scripts/{7053-35b82818eb.chunk.js → 7053-91a52f57d7.chunk.js} +0 -0
  63. /package/dist/scripts/{7071-6f7e375aaa.chunk.js → 7071-6d98c3dcfa.chunk.js} +0 -0
  64. /package/dist/scripts/{7153-57796cd98e.chunk.js → 7153-fc080e3d53.chunk.js} +0 -0
  65. /package/dist/scripts/{7295-474c754cb6.chunk.js → 7295-49780496e2.chunk.js} +0 -0
  66. /package/dist/scripts/{7408-15b5cc4a39.chunk.js → 7408-c1551d3e0d.chunk.js} +0 -0
  67. /package/dist/scripts/{7827-ce63697325.chunk.js → 7827-c1f1b4f608.chunk.js} +0 -0
  68. /package/dist/scripts/{8952-a9a7742f72.chunk.js.LICENSE.txt → 8952-4201ae6599.chunk.js.LICENSE.txt} +0 -0
  69. /package/dist/scripts/{9369-1e706eb521.chunk.js.LICENSE.txt → 9369-d078677c28.chunk.js.LICENSE.txt} +0 -0
  70. /package/dist/scripts/{9383-d58506608c.chunk.js → 9383-4ed13f5993.chunk.js} +0 -0
  71. /package/dist/scripts/{bundle-9fb3396566.min.js.LICENSE.txt → bundle-b38a9aa50e.min.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 4001-319ffe95a1.chunk.js.LICENSE.txt */
2
+ (self.webpackChunk_clickview_library_editor=self.webpackChunk_clickview_library_editor||[]).push([[4001],{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),l=n(53808),s={fetch:function(e,t){var n=e.dataServiceName,r=e.eventPrefix,s=e.fetchData,u=e.setData,f=e.onError,d=e.deleteEventPrefix;if(l.q.isFunction(s)){if(l.q.isFunction(u)){var p=f&&l.q.isFunction(f),m=c.u.getInstance(n),h=i.Radio.channel(m.channelName),v="".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 h.off(b,k)};h.once(v,E),h.once(y,S),h.once(b,k),p&&h.once(g,f),w&&h.once(w,x);var O=s(m);return O&&(t(!0),e.setData(O)),function(){c.u.releaseInstance(n),h.off(v,E),h.off(y,S),h.off(b,k),p&&h.off(g,f),w&&h.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)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],l=a[1];r.useEffect((function(){l(!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 s.fetch(e,l)}),[c,o])}},42120:function(e,t,n){"use strict";n.d(t,{e:function(){return s}});var r=n(1024),i=n(53808),o=n(17439),a=n(63946),c=n(31709),l=n(12704);function s(e){var t=r.useMemo((function(){return e.actions.sort((function(e,t){return e.order-t.order}))}),[e.actions]),n=[],s=[];t.forEach((function(e){e.button?n.push(e):s.push(e)}));var u="d-flex";return e.className&&(u+=" ".concat(e.className)),n.length||s.length?r.createElement("div",{className:u},n.length?n.map((function(t,n){return r.createElement(r.Fragment,{key:n},function(){if(t.label){var n=i.q.isFunction(t.label)?t.label:function(){return r.createElement(r.Fragment,null,t.label)};return r.createElement(c.K,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,svgSize:e.dropdownToggleSvgSize,className:t.className,tooltip:t.tooltip,showSpinner:t.showSpinner,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled},n())}var l=r.createElement(o.h,{appLink:t.appLink,href:t.href,onClick:t.onClick,svgName:t.svgName,className:t.className,analyticsData:t.analyticsData,analyticsOptions:t.analyticsOptions,openInNewTab:t.openInNewTab,disabled:t.disabled,showBorder:t.showBorder,customSize:e.customSize,ariaLabel:t.tooltip});return t.tooltip?r.createElement(a.u,{title:t.tooltip,spanHack:!0},l):l}())})):r.createElement(r.Fragment,null),e.sortComponent&&e.sortComponent,s.length?r.createElement(l.m,{actions:s,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 v}});var r=n(1024),i=n(53808),o=n(31647),a=n(97874),c=n(52076),l=n(49642),s=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 m(e){var t="dropdown-item";return e&&(t+=" ".concat(e)),t}function h(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(l.F,{appLink:e.action.appLink,onClick:e.action.onClick,className:m(e.action.className),analyticsData:e.action.analyticsData,analyticsOptions:e.action.analyticsOptions,openInNewTab:e.action.openInNewTab,disabled:e.action.disabled},e.action.svgName&&r.createElement(s.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:m(e.action.className),onClick:n,href:e.action.href},e.action.svgName&&r.createElement(s.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(m(e.action.className)),onClick:n,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&n(e)}},e.action.svgName&&r.createElement(s.x,{svgName:e.action.svgName,className:"d-inline-block svg-container me-2"}),t())}function v(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","aria-label":"More actions dropdown",onClick:t?e.fetchMore:null},r.createElement(s.x,{svgName:f.vn.More,size:e.dropdownToggleSvgSize})),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end dropdown-menu-right font-size-normal","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("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(u.u,{title:e.tooltip,spanHack:!0},r.createElement(h,{action:e}))):r.createElement("li",{key:t},n&&r.createElement("hr",{className:"dropdown-divider",role:"separator"}),r.createElement(h,{action:e}))}))))}v.defaultProps={dropdownToggleClassName:"btn btn-light",dropdownToggleSvgSize:s.S.Small}},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),l=n(49642),s=n(17439);function u(e){var t=e.className||"btn btn-dark";return e.disabled&&(t+=" disabled"),e.icon?i().createElement(s.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(l.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",{role:"status",className:e.className||"h3"},e.children)},d.Info=function(e){return e.injectHtml?i().createElement("p",{role:"status",className:e.className||"mb-3 w-50",dangerouslySetInnerHTML:{__html:e.children}}):i().createElement("p",{role:"status",className:e.className||"mb-3 w-50"},e.children)}},49619:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(1024),i=n(85887),o=n(49642),a=n(29267),c="fVSzb";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 s=r.memo((function(e){var t,n,i=e.forceLoad,o=e.extraClasses,s=void 0===o?"":o,u=e.errorFallbackImageSrc,f=e.preventLoad,d=void 0!==f&&f,p=e.errorFallbackImageClassName,m=e.src,h=e.alt,v=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||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}}(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=m,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(s," ").concat(E&&p||""),alt:h,src:k()},v));var x=Object.assign(Object.assign({alt:h},v),!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(s," ").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 m(e){var t=e.data,n=e.imageOptions,a=e.appLink,c=e.preload,l=e.preventLoad,u=e.analyticsOptions,d=e.analyticsData,m=e.imageClassName,h=e.alt,v="";"string"==typeof t?v=t:i.t.isObject(t)&&(v=t.url);var y=v&&n?f.j.createUrl(v,n):v;return r.createElement("div",{className:p(e),style:e.imageStyle},r.createElement(o.F,{appLink:a,analyticsData:d,analyticsOptions:u,onClick:e.onClick,preventFocus:e.preventFocus,className:e.appLinkClassName},e.children,y&&r.createElement(s,{src:y,alt:h,forceLoad:c,preventLoad:l,extraClasses:m,errorFallbackImageSrc:e.errorFallbackImageSrc,errorFallbackImageClassName:e.errorFallbackImageClassName,onLoad:e.onLoad})))}},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(e.className);return e.appLink?i().createElement(o.F,{className:t,appLink:e.appLink,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,title:e.title,ariaLabel:e.ariaLabel},e.children):i().createElement("div",{className:t,title:e.title,"aria-label":e.ariaLabel},e.children)}},43803:function(e,t,n){"use strict";n.d(t,{y:function(){return m}});var r=n(1024),i=n.n(r),o=n(57857),a=n(39396),c=n(50028),l=n(74421),s=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 l.E.Clip:return s.vn.Clip;case l.E.Interactive:return s.vn.Interactive;case l.E.Resource:return s.vn.Resources;default:return""}}function p(e,t){switch(e){case l.E.Clip:return"bg-ultramarine";case l.E.Interactive:return t===c.X.Draft?u.draft:"bg-green";case l.E.Resource:return"bg-indigo";default:return""}}function m(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 l.E.Clip:return f("clip");case l.E.Interactive:return f("interactive");case l.E.Resource:return f("resource");default:return""}}(e.typeId))))}m.default={size:"md"}},98496:function(e,t,n){"use strict";n.d(t,{Q:function(){return m},$:function(){return g}});var r=n(1024),i=n(57857),o=n(63151),a=n(22218),c={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}},l=n(74421),s={isSeries:function(e){return(null==e?void 0:e.typeId)===l.E.Series},buildSeriesSeasonEpisodeText:function(e,t,n){if(!e)return"";if(!t||!n)return e.toUpperCase();var r=c.padNumber(t,2),i=c.padNumber(n,2);return"".concat(e.toUpperCase()," S").concat(r," • E").concat(i)}},u=n(12927),f=n(96461),d={appLink:"yI6tx",hoverUnderline:"ehDUT"},p=i.T.encloseNamespace("shared.videoSubText");function m(e){var t=e.video,n=t.season;if(!t.episodeNumber||!n)return r.createElement(r.Fragment,null);var i=c.padNumber(n.number,2),o=c.padNumber(t.episodeNumber,2);return r.createElement("span",{className:"d-inline-block ".concat(e.appLink?d.hoverUnderline:"")},e.withSeriesTitle&&r.createElement(r.Fragment,null," "),!!i&&"S".concat(i," • "),"E",o)}function h(e){var t=u.M.getReleaseDate(e.video);return t?u.M.hasSeries(e.video)?r.createElement(r.Fragment,null," • ".concat(t)):r.createElement(r.Fragment,null,t):r.createElement(r.Fragment,null)}function v(e){var t,n=e.appLink,i=e.video,c=e.className,l=void 0===c?"":c,v=null==i?void 0:i.series,y=u.M.getReleaseDate(e.video);if(!(null==v?void 0:v.id)&&!y)return r.createElement(r.Fragment,null);var g=(null==v?void 0:v.id)&&n&&Object.assign(Object.assign({},n),{args:[v.id,o.m.slugify(v.name)]}),b=Object.assign(Object.assign({},e.analyticsData),{id:null==v?void 0:v.id,name:null==v?void 0:v.name,videoId:null==i?void 0:i.id,videoName:null==i?void 0:i.name}),w=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Series,actionType:a.Vw.Click,descriptor:a._S.Title}),E=s.buildSeriesSeasonEpisodeText(null==v?void 0:v.name,null===(t=i.season)||void 0===t?void 0:t.number,i.episodeNumber);return r.createElement(f.m,{appLink:g,className:"d-block ".concat(d.appLink," ").concat(l),analyticsData:b,analyticsOptions:w,title:E,ariaLabel:"".concat(p("ariaSeries")," ").concat(E)},(null==v?void 0:v.name)&&v.name,r.createElement(m,Object.assign({},e,{withSeriesTitle:!0})),r.createElement(h,Object.assign({},e)))}function y(e){var t,n,i=e.appLink,c=e.video,l=e.className,s=void 0===l?"":l,u=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==u?void 0:u.id))return r.createElement(r.Fragment,null);var m=(null==u?void 0:u.id)&&i&&Object.assign(Object.assign({},i),{args:[u.id,o.m.slugify(u.name)]}),h=Object.assign(Object.assign({},e.analyticsData),{id:null==u?void 0:u.id,name:null==u?void 0:u.name,videoId:null==c?void 0:c.id,videoName:null==c?void 0:c.name}),v=Object.assign(Object.assign({},e.analyticsOptions),{entity:a.py.Company,actionType:a.Vw.Click,descriptor:a._S.Title});return r.createElement(f.m,{appLink:m,className:"d-block ".concat(d.appLink," ").concat(s),analyticsData:h,analyticsOptions:v,title:u.name,ariaLabel:"".concat(p("ariaCompany")," ").concat(u.name)},u.name)}function g(e){var t=e.type,n=void 0===t?"series":t;return"none"===n?r.createElement(r.Fragment,null):"series"===n?r.createElement(v,Object.assign({},e)):r.createElement(y,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){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;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={}))},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 v},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 l(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||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}}(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 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 u=275,f=5,d={className:"",delay:0,style:null},p={screenX:0,screenY:0};function m(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 h(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 v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=c(),n=l(r.useState(e),2),i=n[0],s=n[1],u=l(r.useState(!1),2),f=u[0],p=u[1],v=r.useRef(null);r.useEffect((function(){a.t.isEqual(e,i)||s(e)}),[e]);var y=o.q.throttle((function(){m(v,i),t.current&&p(!0)}),i.delay,{leading:!1}),g=function(){o.q.isFunction(y.cancel)&&y.cancel(),h(v,i),t.current&&p(!1)};return r.useLayoutEffect((function(){var e=v.current;if(e)return e.addEventListener("mouseenter",y),e.addEventListener("mouseleave",g),function(){e.removeEventListener("mouseenter",y),e.removeEventListener("mouseleave",g)}}),[v.current,i]),[v,f]}function y(e){var t=l(r.useState(e),2),n=t[0],i=t[1],c=r.useRef(Object.assign({},p)),s=r.useRef(!1),d=r.useRef(0),v=r.useRef(null),y=l(r.useState(!1),2),g=y[0],b=y[1];function w(){d.current&&(window.clearTimeout(d.current),d.current=0)}function E(){s.current=!0}function S(e){if(s.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(){m(v,n),b(!0)},r=n.delay||u,d.current||(d.current=window.setTimeout(t,r))}}function k(){w(),h(v,n),s.current=!1,b(!1)}return r.useEffect((function(){a.t.isEqual(e,n)||i(e)}),[e]),r.useLayoutEffect((function(){if(v.current){var e=o.q.throttle(S,25,{leading:!1});return v.current.addEventListener("mouseenter",E),v.current.addEventListener("mousemove",e),v.current.addEventListener("mouseleave",k),function(){v.current&&(v.current.removeEventListener("mouseenter",E),v.current.removeEventListener("mousemove",e),v.current.removeEventListener("mouseleave",k))}}}),[v.current,n]),[v,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,l=void 0===c||c,s=(e=(0,r.useInView)({triggerOnce:l,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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)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=s[0],f=s[1],d=s[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 l(e){return function(e){if(Array.isArray(e))return s(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 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}}(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 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}function u(e,t,n){function o(e){if(e)return a.q.isFunction(t)?l(t(e)):l(e.data)}function s(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,m=i&&i.shouldFetch,h=o(i&&i.data),v=s(i&&i.data),y=function(e){if(e)return null==e?void 0:e.count}(i&&i.data);v&&(i=c.a.getResponse(t,n(v)),u=u||i.isFetching,f=i.statusCode,d=i.hasCompleted,!i.shouldFetch);){var g=o(i.data);g&&h.push.apply(h,l(g));var b=s(i.data);v=b===v?null:b}var w={shouldInitialFetch:m,items:h,nextCursor:v,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),l=n(57857),s=n(4231),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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)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 m=l.T.encloseNamespace("shared.imageCropper"),h=/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/;function v(e){var t=d(i().useState(!1),2),n=t[0],r=t[1],o=d(i().useState(!1),2),a=o[0],l=o[1],p=i().useRef(),v=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),v.current=new(c())(p.current,o),function(){v.current.destroy()}}),[]),i().createElement(s.G,{title:m("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=v.current.getCroppedCanvas().toDataURL(function(e){var t=e.match(h);if(t)return t[1]}(e.src));l(!0),e.onClickCrop(t,e.closePopup)}},text:m("crop"),variant:"dark",showSpinner:a})))}v.defaultProps={popupSize:"lg"};var y={renderCropper:function(e){var t=(0,o.s)(document.getElementById("dialog-region"));t.render(i().createElement(v,Object.assign({},e,{closePopup:function(){return t.unmount()}})))}}},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}})},45855:function(e,t,n){"use strict";n.d(t,{x:function(){return hu}});var r=n(1024),i=n.n(r),o=n(66703),a=n(8371),c=n(12927);n(30582),n(85887);var l=i().createContext({setPageMetadata:function(e){return e},revertPageMetadata:function(){},hasPageMetadataChanged:function(){return!1},hasProvider:!1}),s=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,m=void 0===p?[]:p,h=r.useMemo((function(){return new o(c)}),m);t=h.title,n=i().useContext(l),r.useEffect((function(){"boolean"!=typeof t&&n.setPageMetadata({title:t})}),[t]);var v=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(){s.q.isFunction(e.close)?e.close():s.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}(h,[h]);return o?r.createElement("div",{ref:v,className:d}):r.createElement(r.Fragment,null)}var d=n(70065),p=n(61356),m=n(85847);function h(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 m.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 v=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 v.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,v.T.ToDisplayDurationNewStyle(1e3*Math.floor(r))),i().createElement("div",{className:"overflow-hidden rounded-3 border 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(71551),C=n(63791),N=n(49642),j=n(58542);function P(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e&&t.length?t.reduce((function(e,t){return function(e,t,n){return e.replace(new RegExp("<".concat(t,".*?>"),"gi"),"").replace(new RegExp("</".concat(t,">"),"gi"),n?"<br>":"")}(e,t,n)}),e):e}function I(e){var t,n;if(e)return e=P(e,["ul","ol","b","i","u","old","em","strong","sup","sub","a","span"]),(null===(n=null===(t=(e=P(e,["li","p","div"],!0)).split("<br>"))||void 0===t?void 0:t.filter((function(e){return!!e}))[0])||void 0===n?void 0:n.trim())||"Annotation"}function L(e){var t=j.w.getTypeInfo(e.interaction.typeId),n=t.name,r=t.bgClassName,o=t.Svg,a=e.questionNumber?"".concat(e.questionNumber,". "):"",c="interaction-type-icon flex-shrink-0 ".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("span",{className:e.containerClassName},!!e.showIcon&&i().createElement("span",{className:c},i().createElement(o,null)),i().createElement(N.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===O.Z9.Annotation?i().createElement("span",{dangerouslySetInnerHTML:{__html:I(e.interaction.data.annotation)}}):e.interaction.name)))}L.defaultProps={showIcon:!0,showQuestion:!0};var T={timeTag:"ShZvf",hide:"FHzDr",time:"JDp5N",type:"AzIWg",question:"UhEYq",deleteContainer:"wBqoo",delete:"OAQQu",correctness:"W5sR9",selected:"tfrDf",row:"sGk59"},A="shared.interactiveQuestions";function _(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:C.vn.Check}));case E.Incorrect:return i().createElement("span",{className:"text-danger"},i().createElement(x.x,{size:x.S.Medium,svgName:C.vn.Close}));case E.AwaitingMarking:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:A,phrase:"pending"})));case E.UnAnswered:return i().createElement("button",{className:"btn btn-outline-dark"},i().createElement(o.x,{namespace:A,phrase:"answer"}));case E.Answered:return i().createElement("span",{className:"text-secondary italic"},i().createElement("i",null,i().createElement(o.x,{namespace:A,phrase:"answered"})));case E.NotApplicable:return i().createElement(i().Fragment,null)}}function F(e){var t=e.interaction,n=e.visibleAt,r=e.selectedInteractionId,o=e.goToTimepoint,a=e.scrollTo,c=e.isFirstInteraction,l=t.id.toString()===(null==r?void 0:r.toString()),s=i().useRef();i().useEffect((function(){if(l&&s.current){var e=s.current,t=e.getBoundingClientRect(),n=t.top-e.offsetParent.getBoundingClientRect().top;a(n,t.height)}}),[l]);var u=o?"cursor-pointer":"cursor-default";return i().createElement("div",{ref:s},i().createElement(k.L,{className:"py-2 ".concat(u," ").concat(T.row," ").concat(l?T.selected:""),onClick:l?function(){}:function(){o&&o(t.id)}},i().createElement("div",{className:"me-3 d-inline-flex rounded-pill justify-content-center align-items-center text-info fw-semibold bg-light-blue ".concat(T.timeTag," ").concat(c?"":T.hide)},c?v.T.ToDisplayDuration(n):""),i().createElement(L,{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:C.vn.Delete}))),e.getCorrectness&&i().createElement("span",{className:"text-end ".concat(T.correctness)},i().createElement(_,{interaction:t,getCorrectness:e.getCorrectness}))))}function D(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,t.visibleAt)}return t.interactions?i().createElement(i().Fragment,null,t.interactions.map((function(l,s){return!e.experimentalInteractiveQuestions&&O.IL[l.typeId]?i().createElement(i().Fragment,{key:s}):i().createElement(F,{interaction:l,visibleAt:t.visibleAt,goToTimepoint:e.goToTimepoint&&c,onClickDelete:r,scrollTo:n,selectedInteractionId:o,isFirstInteraction:0===s,getCorrectness:a,key:s})}))):i().createElement(i().Fragment,null)}function R(e){var t=e.interactive,n=e.goToTimepoint,r=e.selectedInteractionId,o=e.maxHeight,a=e.onClickDelete,c=e.getCorrectness,l=i().useRef();function s(e,t){if(l.current){var n=l.current.getClientHeight(),r=l.current.getScrollTop(),i=e+r;(i<r||i+t>r+n)&&l.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:l},i().createElement("div",{className:"px-3 py-2"},t.timepoints.map((function(t,o){return i().createElement(D,{key:o,timepoint:t,goToTimepoint:n,selectedInteractionId:r,scrollTo:s,onClickDelete:a,getCorrectness:c,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})}))))}var M,U="libraryRequests.interactiveDetails";function V(e){var t=e.interactive;return i().createElement(i().Fragment,null,i().createElement("p",{className:"fw-semibold mb-2"},i().createElement(o.x,{namespace:U,phrase:"questionList",options:{length:t._timepoints.value.length}})),t._timepoints.value.map((function(e,t){return i().createElement(D,{key:t,timepoint:e})})))}function B(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(V,{interactive:t}))}!function(e){e[e.View=0]="View",e[e.Create=1]="Create"}(M||(M={}));var q=n(31647);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){if("object"!=G(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==G(t)?t:t+""}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(H=function(){return!!e})()}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function Q(e,t){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Q(e,t)}var Y=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=W(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,H()?Reflect.construct(t,n||[],W(e).constructor):t.apply(e,n))}(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&&Q(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()}}])&&Z(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(n(85835).S),K=n(61380);function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function X(){X=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==$(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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($(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function J(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,ee(r.key),r)}}function ee(e){var t=function(e){if("object"!=$(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$(t)?t:t+""}var te=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},ne=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 te(this,void 0,void 0,X().mark((function e(){var t,n,r,i,o,a,c,l,s,u,f;return X().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,l=t.publicName,s=t.profileId,u={interactiveId:n,metadataId:r,userId:i,customerId:o,shareId:a,publicName:l,profileId:s,anonymous:!i},e.prev=4,e.next=7,K.e.post(c+"interactive/start-session",JSON.stringify(u));case 7:f=e.sent,this.resultId=f.resultId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),q.Q.Ry.throw(new Y);case 14:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"save",value:function(e,t){return te(this,void 0,void 0,X().mark((function n(){var r;return X().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,K.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),q.Q.Ry.throw(new Y);case 13:case"end":return n.stop()}}),n,this,[[4,9]])})))}}])&&J(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),re=n(11306),ie=n(6950),oe=(n(96263),n(24910),n(94445));function ae(e){return ae="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},ae(e)}function ce(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,le(r.key),r)}}function le(e){var t=function(e){if("object"!=ae(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ae(t)?t:t+""}function se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(se=function(){return!!e})()}function ue(e,t,n,r){var i=fe(de(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function fe(){return fe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=de(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}},fe.apply(null,arguments)}function de(e){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},de(e)}function pe(e,t){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pe(e,t)}var me=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=function(e,t,n){return t=de(t),function(e,t){if(t&&("object"==ae(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,se()?Reflect.construct(t,n||[],de(e).constructor):t.apply(e,n))}(this,t,[e,n])).timepoint_=n.timepoint,r.time_=n.timepoint.visibleAt/1e3;var i=n.timepoint.interactions[0];i||r.hide();var o=j.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&&pe(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-item ".concat(ue(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return ue(t,"createEl",this,3)([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&&ce(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("Button"));function he(e){return he="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},he(e)}function ve(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 ye(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,ge(r.key),r)}}function ge(e){var t=function(e){if("object"!=he(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=he(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==he(t)?t:t+""}function be(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(be=function(){return!!e})()}function we(e,t,n,r){var i=Ee(Se(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Ee(){return Ee="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Se(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}},Ee.apply(null,arguments)}function Se(e){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Se(e)}function ke(e,t){return ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ke(e,t)}var xe=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=function(e,t,n){return t=Se(t),function(e,t){if(t&&("object"==he(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,be()?Reflect.construct(t,n||[],Se(e).constructor):t.apply(e,n))}(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&&ke(e,t)}(t,e),n=t,r=[{key:"buildCSSClass",value:function(){return"cv-interactive-bar-items ".concat(we(t,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(e,n,r){return we(t,"createEl",this,3)([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 ve(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 ve(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)?ve(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 me(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&&ye(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("Component")),Oe=n(94878);function Ce(e){var t=e.className,n=e.svgName,r=e.children,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}(e,["className","svgName","children"]),a="".concat(t," ").concat("Mr0S0");a+=" ".concat(r?"vHTVo":"vIGn0");var c=i().createElement(x.x,{svgName:n,className:"cDUaE"});return i().createElement(k.L,Object.assign({className:a},o),c,r)}function Ne(e){var t=e.isCreate,n=e.open,r=e.showTypeSelector;return!t||n?i().createElement(i().Fragment,null):i().createElement(Ce,{className:"btn btn-outline-dark cv-add-question",onClick:r,svgName:C.vn.Plus},"Add question")}var je,Pe=n(99910),Ie=n(17082),Le=n(17439),Te=n(49619),Ae=n(88483),_e=n(38182);function Fe(e){return Fe="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},Fe(e)}function De(e,t,n){return(t=function(e){var t=function(e){if("object"!=Fe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(){return E.NotApplicable}function Me(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 Ue(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){var n,r=t(e.id);return(null==r?void 0:r.toString())===(null===(n=e.id)||void 0===n?void 0:n.toString())||r===e.name}))?E.Correct:E.Incorrect}function Ve(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 Be(e,t){var n=Ve(e,t);return Ue(e,(function(e){var t=n(e);return null==t?void 0:t.text}))}function qe(e,t){return function(e,t){var n;return e.actionableItems.forEach((function(e){var r=t(e.id);n=r?r.status!==je.Correct?r.status!==je.Incorrect?E.AwaitingMarking:E.Incorrect:E.Correct:E.UnAnswered})),n}(e,Ve(e,t))}!function(e){e[e.Incorrect=0]="Incorrect",e[e.Correct=1]="Correct",e[e.PendingReview=2]="PendingReview"}(je||(je={}));var Ge=De(De(De(De(De(De(De({},O.Z9.Annotation,Re),O.Z9.Image,Re),O.Z9.MissingWord,(function(e,t){var n=Ve(e,t);return Me(e,(function(e){var t=n(e);return null==t?void 0:t.text}))})),O.Z9.MultipleChoice,Be),O.Z9.ShortAnswer,qe),O.Z9.TrueOrFalse,Be),O.Z9.Illustration,qe),Ze={notApplicable:Re,awaitingMarking:function(){return E.AwaitingMarking},isMissingWordCorrect:Me,isMultipleChoiceCorrect:Ue,isInteractionCorrect:function(e,t){return(0,Ge[e.typeId])(e,t)}},ze=n(40221);function He(e){return ze.m.last(e.results)}function We(e,t){return ze.m.findWhere(null==t?void 0:t.attempts,{id:e})}var Qe=n(76044),Ye=n(57857),Ke=Ye.T.encloseNamespace("interactives.responseTypes");function $e(){return i().createElement("p",{className:"p-2"},i().createElement("em",null,Ke("noResponse")))}var Xe="cv-missing-word-",Je=n(4234),et="KpbWq";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=["A","B","C","D"];function rt(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||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}}(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=!!e.interaction.actionableItems.find((function(e){var t;return!!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),l=i().useRef(),s="sm"===e.size||c&&e.interaction.actionableItems.length>2;return i().createElement("ul",{className:"".concat(c?"row ".concat(s&&!e.isDisplayOnly?"px-lg-5 p-0":""):""," list-unstyled")},e.interaction.actionableItems.map((function(t,n){var r,u,f=null===(r=e.getSelectedAnswer)||void 0===r?void 0:r.call(e,t.id),d=null===(u=t.data)||void 0===u?void 0:u.imageUrl,p=!!t.name;function m(){e.submitted||(e.onSelectAnswer&&e.onSelectAnswer(t,!f),a(f?null:t.id))}if(e.onlyShowSelectedAnswer&&!f)return i().createElement(i().Fragment,{key:n});var h=f?"bg-blue text-white":e.unCheckedBackground,v=function(){return i().createElement(i().Fragment,null,nt[n])};e.showFeedback&&(e.showCorrectnessIcons||(h=t.isCorrect?"bg-success text-white":"bg-danger text-white ".concat("yodaE")),e.hideFeedbackIcons||(v=function(){return i().createElement(i().Fragment,null,t.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Close}))}));var y=e.showFeedback?{}:{role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&m()}},g="";c&&(g="col-6");var b=t.id.toString()===(null==o?void 0:o.toString())&&e.leftHandSidePortalNode&&d&&!e.submitted;return i().createElement(i().Fragment,{key:n},b&&i().createElement(Ie.Nq,{node:e.leftHandSidePortalNode},i().createElement(Je.Z,{className:"h-100",ref:l},i().createElement("div",{className:"p-3 d-flex flex-column h-100"},i().createElement("div",{className:"flex-grow-1"},i().createElement("div",{className:"cv-image-container text-center"},i().createElement("img",{className:"img-fluid rounded",src:d,alt:t.name||nt[n]})),i().createElement("div",{className:"".concat(et," h6 text-center text-dark p-3")},i().createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},i().createElement(v,null)),p&&i().createElement("span",{className:"flex-grow-1 pe-4"},t.name))),i().createElement("div",{className:"text-end"},i().createElement(k.L,{className:"btn btn-link",onClick:function(){return a(null)}},"Close"))))),i().createElement("li",{className:"".concat(g," mb-3")},i().createElement("label",Object.assign({className:"\n d-block\n rounded-3\n shadow-sm\n position-relative\n ".concat(e.showFeedback?"":"cursor-pointer","\n ").concat(et,"\n ").concat(h,"\n ").concat(c?"mb-0 h-100":"","\n "),key:n,onClick:m},y),c&&i().createElement("div",null,e.showCorrectnessIcons&&i().createElement("div",{className:"".concat("xnG9h"," position-absolute top-0 start-0 p-2 z-1")},t.isCorrect?i().createElement(x.x,{svgName:C.vn.CheckCircle,size:x.S.ExtraLarge,className:"svg-container text-success"}):i().createElement(x.x,{svgName:C.vn.CrossCircleFilled,size:x.S.Large,className:"svg-container text-red"})),i().createElement("span",{className:"d-block position-relative ".concat("TeByp")},i().createElement("span",{className:"\n ".concat("zWcu2","\n position-absolute\n start-0\n end-0\n top-0\n bottom-0\n rounded-top\n "),style:{backgroundImage:d?"url(".concat(d,")"):void 0},title:t.name||nt[n]}))),i().createElement("span",{className:"d-flex ".concat(p||e.isDisplayOnly?"justify-content-between":"justify-content-center"," ").concat(s?"p-2":"p-3")},i().createElement("span",{className:"d-inline-block ".concat(p?"me-3":""," cv-multiple-choice-bullet")},i().createElement(v,null)),p&&i().createElement("span",{className:"flex-grow-1 pe-4"},t.name),e.userAvatar&&!e.onlyShowSelectedAnswer&&i().createElement("span",{className:"".concat("uKRg2"," ").concat(c?"_LpCq":"")},f&&i().createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white"}))))))})))}rt.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var it="Y7ls8";function ot(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("ZCkyL"),e.hideFeedbackIcons||(c=function(){return i().createElement(i().Fragment,null,n.isCorrect?i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Check}):i().createElement(x.x,{size:x.S.Small,svgName:C.vn.Close}))}));var l=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("_2qC40"," mx-1 h5"):"".concat("TKjXy"," mx-2 h4"),"\n ").concat(e.showFeedback?"":"cursor-pointer","\n ").concat(a)},l),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("CBgCv")},i().createElement(c,null)),i().createElement("span",{className:"".concat("CVTEm").concat("sm"===e.size?" ".concat("tbPTs"):"")},o&&i().createElement(_e.q,{imageCdnUrl:e.imageApi,initials:e.userInitials,imageUrl:e.userAvatar,extraClasses:"border border-white ".concat("sm"===e.size?"GUAUz":"")})))})))}function at(e){return at="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},at(e)}function ct(e,t,n){return(t=function(e){var t=function(e){if("object"!=at(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==at(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}ot.defaultProps={size:"lg",unCheckedBackground:"bg-white"};var lt=function(){return i().createElement(i().Fragment,null)},st=ct(ct(ct(ct(ct(ct(ct({},O.Z9.Annotation,lt),O.Z9.Image,lt),O.Z9.MissingWord,(function(e){var t=e.interaction.data.sentence.replace(/{([^{}]*)}/g,(function(e,t){return"{".concat(Xe).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(Xe))return t;var r=t.replace(Xe,""),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===je.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))}}})))})),O.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(rt,{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.id},imageApi:e.imageCdnUrl,userInitials:e.anonymisedUserName?Qe.l.getInitialsFromFullName(e.anonymisedUserName):Qe.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(it," text-white"),isDisplayOnly:!0}))})),O.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(ot,{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?Qe.l.getInitialsFromFullName(e.anonymisedUserName):Qe.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(it," text-white")}))})),O.Z9.ShortAnswer,(function(e){var t=ze.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)})),O.Z9.Illustration,(function(e){var t=ze.m.first(e.answers);if(!t)return i().createElement(i().Fragment,null);var n="rounded p-2 mb-2 w-50";return e.reportsStyling||(n+=" text-white"),i().createElement("div",{className:n},i().createElement("img",{className:"img-fluid border rounded",src:t.text,alt:"Illustrated answer to the question: ".concat(e.interaction.name)}))}));function ut(e){return i().createElement(i().Fragment,null,e.correctness===E.Correct&&i().createElement("div",{className:"ms-2 text-success"},i().createElement(x.x,{svgName:C.vn.Tick})),e.correctness===E.Incorrect&&i().createElement("div",{className:"ms-2 text-danger"},i().createElement(x.x,{svgName:C.vn.Close})))}function ft(e){return i().createElement("div",{className:"d-flex align-items-center justify-content-between mb-2"},i().createElement("p",{className:"fw-semibold mb-0"},e.anonymisedUserName||Qe.l.getFullName(e.studentResults.user)),i().createElement(ut,{correctness:e.correctness}))}function dt(e){return e.correctness!==E.AwaitingMarking?i().createElement(i().Fragment,null):i().createElement("div",{className:"d-flex justify-content-end gap-2 mt-2"},i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===je.Correct?"text-success":"")},i().createElement(x.x,{svgName:e.markedStatus===je.Correct?C.vn.CheckCircle:C.vn.CheckCircleOutline,onClick:function(){return e.markInteraction(e.studentAttempt.answers,je.Correct)}})),i().createElement("div",{className:"d-flex flex-column justify-content-end cursor-pointer\n ".concat(e.markedStatus===je.Incorrect?" text-danger":"")},i().createElement(x.x,{svgName:e.markedStatus===je.Incorrect?C.vn.CrossCircleFilled:C.vn.CrossCircle,onClick:function(){return e.markInteraction(e.studentAttempt.answers,je.Incorrect)}})))}function pt(e){var t,n,r,o,a,c=st[e.interaction.typeId];if(!c)return i().createElement(i().Fragment,null);var l=He(e.studentResults),s=We(e.interaction.id,l),u=Ze.isInteractionCorrect(e.interaction,l);return i().createElement("div",{className:"position-relative mt-2"},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:"FEdgT"},i().createElement(_e.q,{imageCdnUrl:e.imageCdnUrl,initials:e.anonymisedUserName?Qe.l.getInitialsFromFullName(e.anonymisedUserName):Qe.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(ft,{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:"")},s?i().createElement(c,{interaction:e.interaction,answers:s.answers,imageCdnUrl:e.imageCdnUrl,user:e.studentResults.user,showFeedback:e.showFeedback,showAvatar:e.showAvatar,reportsStyling:e.reportsStyling}):i().createElement($e,null)),!e.showStudentDetails&&i().createElement(ut,{correctness:u})))),i().createElement(dt,{studentAttempt:s,correctness:u,markInteraction:e.markInteraction,markedStatus:e.markedStatus})))}var mt,ht,vt=n(44645),yt=n(4231),gt=n(83996),bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.getElementById("dialog-region");n||((n=document.createElement("div")).id="dialog-region",document.appendChild(n));var r=(0,vt.s)(n);function o(){var e;s.q.isFunction(null===(e=t.cancelButtonProps)||void 0===e?void 0:e.onClick)&&t.cancelButtonProps.onClick(),r.unmount()}var a=Object.assign(Object.assign({},t.submitButtonProps?t.submitButtonProps:{}),{onClick:function(){!function(){var e;if(s.q.isFunction(null===(e=t.submitButtonProps)||void 0===e?void 0:e.onClick)){var n=t.submitButtonProps.onClick();if(n instanceof Promise)return void n.then((function(){r.unmount()}))}r.unmount()}()}}),c=Object.assign(Object.assign({},t.cancelButtonProps?t.cancelButtonProps:{}),{onClick:function(){o()}});r.render(i().createElement(yt.G,{title:t.title,closePopup:o,size:t.size,centered:t.centered,bodyClassName:"overflow-hidden",dialogClassName:t.dialogClassName},e,!t.hideButtons&&i().createElement(gt.u,{className:t.buttonContainerClassName},t.cancelButtonProps&&i().createElement(gt.u.Cancel,Object.assign({},c)),t.submitButtonProps&&i().createElement(gt.u.Submit,Object.assign({},a)))))},wt=n(99785),Et={colourButton:"y6pnq",colourButtonSelected:"PAPVX",canvasDrawContainer:"__tFu",strokeButtonContainer:"D1zMW",strokeButton:"J7C_3",selectedButton:"aJKor"};function St(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kt(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)?kt(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 kt(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[e.Small=2]="Small",e[e.Medium=4]="Medium",e[e.Large=8]="Large"}(mt||(mt={})),function(e){e.Black="#000000",e.Red="#D9584F",e.Orange="#F8981D",e.Yellow="#FFCD52",e.Green="#5DC786",e.Blue="#38A2E8",e.Purple="#7A76E8",e.Grey="#979797",e.White="#FFFFFF"}(ht||(ht={}));var xt=i().forwardRef((function(e,t){var n=i().useRef(null);i().useImperativeHandle(t,(function(){return n.current}),[n.current]);var r=i().useRef(null),o=St(i().useState([0,0]),2),a=St(o[0],2),c=a[0],l=a[1],s=o[1],u=St(i().useState(ht.Black),2),f=u[0],d=u[1],p=St(i().useState(mt.Small),2),m=p[0],h=p[1],v=St(i().useState(!1),2),y=v[0],g=v[1],b=St(i().useState(ht.Black),2),w=b[0],E=b[1];function S(){if(r.current){var e=r.current.getBoundingClientRect();s([e.width,.5625*e.width])}}function x(e){d(e),E(f),g(!1)}return i().useLayoutEffect((function(){if(r.current){var e=new ResizeObserver(S);return e.observe(r.current),function(){return e.disconnect()}}}),[r.current]),i().createElement("section",null,i().createElement("div",{className:"d-flex align-items-start"},i().createElement("div",{className:"d-flex flex-lg-column"},i().createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(ht).slice(0,4).map((function(e,t){var n=St(e,2),r=n[0],o=n[1];return i().createElement("li",{key:t},i().createElement(k.L,{className:"".concat(Et.colourButton," ").concat(f===o?Et.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(r)}," "))}))),i().createElement("ul",{className:"me-3-lg me-2 list-unstyled"},Object.entries(ht).slice(4).map((function(e,t){var n=St(e,2),r=n[0],o=n[1];return i().createElement("li",{key:t},i().createElement(k.L,{className:"".concat(Et.colourButton," ").concat(f===o?Et.colourButtonSelected:""," rounded-circle"),style:{backgroundColor:o},onClick:function(){return x(o)},"aria-label":"Select the colour: ".concat(r)}," "))})))),i().createElement("div",{className:"flex-grow-1 position-relative",ref:r},i().createElement("div",{className:Et.canvasDrawContainer},c&&i().createElement(wt.Z,{canvasHeight:l,canvasWidth:c,brushRadius:m,lazyRadius:10,hideGrid:!0,brushColor:f,className:"position-absolute top-0 left-0 border",ref:n}))),i().createElement("div",{className:"d-flex flex-column align-self-stretch ms-2"},i().createElement("div",{className:"d-flex flex-column gap-2 flex-grow-1"},i().createElement("ul",{className:"d-lg-flex flex-column gap-2 list-unstyled d-none"},i().createElement(Ce,{svgName:C.vn.Edit,className:"btn btn-outline-dark ".concat(y?"":Et.selectedButton),onClick:function(){y&&(d(w),g(!1))},"aria-label":"Pen"}),i().createElement(Ce,{svgName:C.vn.Erase,className:"btn btn-outline-dark mb-2 ".concat(y?Et.selectedButton:""),onClick:function(){if(y)return d(w),void g(!1);E(f),d(ht.White),g(!0)},"aria-label":"Eraser"})),i().createElement("ul",{className:"d-flex flex-column mb-2 list-unstyled"},i().createElement("li",{className:Et.strokeButtonContainer},i().createElement(Ce,{svgName:C.vn.SmallStroke,className:"btn btn-outline-dark ".concat(m===mt.Small?Et.selectedButton:""," ").concat(Et.strokeButton),onClick:function(){return h(mt.Small)},style:{color:f!==ht.White?f:ht.Black},"aria-label":"Small stroke"})),i().createElement("li",{className:Et.strokeButtonContainer},i().createElement(Ce,{svgName:C.vn.MediumStroke,className:"btn btn-outline-dark ".concat(m===mt.Medium?Et.selectedButton:""," ").concat(Et.strokeButton),onClick:function(){return h(mt.Medium)},style:{color:f!==ht.White?f:ht.Black},"aria-label":"Medium stroke"})),i().createElement("li",{className:Et.strokeButtonContainer},i().createElement(Ce,{svgName:C.vn.LargeStroke,className:"btn btn-outline-dark ".concat(m===mt.Large?Et.selectedButton:""," ").concat(Et.strokeButton),onClick:function(){return h(mt.Large)},style:{color:f!==ht.White?f:ht.Black},"aria-label":"Large stroke"})))),i().createElement("ul",{className:"d-flex flex-column gap-lg-2 list-unstyled"},i().createElement("li",null,i().createElement(Ce,{svgName:C.vn.Undo,className:"btn btn-outline-dark",onClick:function(){return n.current.undo()},"aria-label":"Undo"})),i().createElement("li",null,i().createElement(Ce,{svgName:C.vn.Delete,onClick:function(){bt(i().createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:function(){return n.current.clear()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})},className:"btn btn-outline-danger d-lg-block d-none ".concat(Et.myRight),"aria-label":"Clear canvas"}))))))}));function Ot(e){var t=i().useRef(null),n=j.w.getTypeInfo(e.interaction.typeId),r=n.bgClassName,o=n.Svg;return i().createElement(Je.Z,{className:"h-100"},i().createElement("section",{className:"d-flex flex-column h-100"},i().createElement("div",{className:"text-center text-body d-flex justify-content-between align-items-center p-2"},i().createElement("div",{className:"d-flex align-items-center"},i().createElement("span",{className:"".concat("sTvDl"," me-3 rounded my-1 text-white align-middle d-inline-block ").concat(r)},i().createElement(o,null)),i().createElement("span",{className:"text-start flex-grow-1"},i().createElement("h2",{className:"h6 mb-0"},i().createElement("strong",null,e.interaction.name)))),i().createElement("div",null,i().createElement(k.L,{className:"btn btn-link",onClick:function(){bt(i().createElement("p",null,"Are you sure you want to discard your drawing?"),{title:"Discard your drawing?",submitButtonProps:{onClick:e.onCancel,variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}})}},"Cancel"),i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){t.current&&e.onSave(t.current.getDataURL("image/png"))}},"Save"))),i().createElement("div",{className:"cv-timepoint bg-gray-100 flex-grow-1 rounded-bottom"},i().createElement("div",{className:"cv-timepoint-padding h-100"},i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mx-auto ".concat("kFxi6")},i().createElement(xt,{ref:t})))))))}function Ct(e){var t=e.error;return e.error?i().createElement("p",{className:"mt-2 small text-danger"},t):i().createElement(i().Fragment,null)}function Nt(e){return Nt="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},Nt(e)}function jt(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 Pt(){Pt=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Nt(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Nt(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function It(e,t,n){return(t=function(e){var t=function(e){if("object"!=Nt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lt="data:image/png;base64,";function Tt(e){return Tt="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},Tt(e)}var At="cv-missing-word-";function _t(e){return _t="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},_t(e)}function Ft(e,t,n){return(t=function(e){var t=function(e){if("object"!=_t(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_t(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dt=n(41347);function Rt(e){return Rt="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},Rt(e)}function Mt(e){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mt(e)}function Ut(e){return Ut="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},Ut(e)}function Vt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ut(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ut(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bt=function(){return!0},qt=function(){return!1},Gt=Vt(Vt(Vt(Vt(Vt(Vt(Vt({},O.Z9.Annotation,qt),O.Z9.Image,qt),O.Z9.MissingWord,Bt),O.Z9.MultipleChoice,Bt),O.Z9.ShortAnswer,(function(e){return!!e.data.suggestedResponse})),O.Z9.TrueOrFalse,Bt),O.Z9.Illustration,qt);function Zt(e){return Gt[e]}var zt=Vt(Vt(Vt(Vt(Vt(Vt(Vt({},O.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 h4",dangerouslySetInnerHTML:{__html:t}}))})),O.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 rounded",src:t.data.url,ref:r}),t.data.caption&&i().createElement(i().Fragment,null,i().createElement("p",{className:"mt-3 h4"},t.data.caption))))})),O.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(At).concat(t,"}")})).split(/{([^{}]*)}/g);return i().createElement("div",{className:"cv-interactive-question"},i().createElement("div",{className:"mb-2 h4"},a.map((function(e,a){var c;if(!e.startsWith(At))return e;var l=e.replace(At,""),s=r.actionableItems.find((function(e){return e.order.toString()===l}));if(s){var u,f,d=t[s.id]||"",p=(u=s.name,(f=document.createElement("canvas").getContext("2d")).font="20pt arial",f.measureText(u).width);if(o){var m=s.name.toLowerCase().toString()===(null===(c=t[s.id])||void 0===c?void 0:c.toLowerCase().toString());return i().createElement(i().Fragment,{key:a},!m&&i().createElement(i().Fragment,null,i().createElement("del",{className:"text-danger"},d)," "),i().createElement("span",{className:"text-success"},s.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){if("object"!=Tt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Tt(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"===Tt(o)?o:o+""]));n(a,!0)}}(s,e)},value:d,maxLength:45,disabled:!!t.submitted,className:"cv-missing-word-input",autoComplete:"off"}))}}))),i().createElement(Ct,{error:t.error}))})),O.Z9.MultipleChoice,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=1===r.actionableItems.filter((function(e){return e.isCorrect})).length;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},r.name),!l&&i().createElement("div",{className:"rounded bg-light-blue p-2 mb-2 text-small"},i().createElement(x.x,{svgName:C.vn.Resources,className:"d-inline-block svg-container sm align-text-bottom me-1"}),i().createElement("small",null,i().createElement("strong",null,"Multi-select: "),"This question has multiple correct answers")),i().createElement(rt,{interaction:r,showFeedback:o,onSelectAnswer:function(e,r){if(!t.submitted)if(l)n(r?Ft({},e.id,e.id):{},!0);else if(r)n(Ft({},e.id,e.id));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"===_t(o)?o:o+""]));n(a,!0)}},getSelectedAnswer:function(e){return t[e]},imageApi:a.toString(),userInitials:Qe.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar,leftHandSidePortalNode:e.leftHandSidePortalNode,submitted:!!t.submitted}),i().createElement(Ct,{error:t.error}))})),O.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",{className:"h4"},t.name),i().createElement("label",{className:"h4 fw-bold"},"My answer"),i().createElement("p",{className:"h4"},n[t.actionableItems[0].id]),t.data.suggestedResponse&&i().createElement(i().Fragment,null,i().createElement("label",{className:"h4 fw-bold"},"Teacher's suggested answer"),i().createElement("p",{className:"h4"},t.data.suggestedResponse))):i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},t.name),i().createElement(Dt.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){if("object"!=Rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(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(Ct,{error:n.error}))})),O.Z9.TrueOrFalse,(function(e){var t=e.state,n=e.setState,r=e.interaction,o=e.showFeedback,a=e.imageApi,c=e.currentUser,l=r.actionableItems.find((function(e){return e.isCorrect}));return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4"},r.name),i().createElement(ot,{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){if("object"!=Mt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mt(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:Qe.l.getInitials(c.givenName,c.familyName),userAvatar:c.avatar}),o&&i().createElement("div",{className:"text-center px-5 mt-3"},i().createElement("p",{className:"h4"},"The answer is ",i().createElement("strong",null,l.name)),r.data.feedback&&i().createElement("p",{className:"h4"},r.data.feedback)),i().createElement(Ct,{error:t.error}))})),O.Z9.Illustration,(function(e){var t,n,r=e.interaction,o=e.state,a=e.fullWidthPortalNode,c=e.setState,l=(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return jt(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)?jt(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.")}()),s=l[0],u=l[1],f=o[r.actionableItems[0].id];return i().createElement("div",{className:"cv-interactive-question"},i().createElement("p",{className:"h4 mb-3"},r.name),f?i().createElement(i().Fragment,null,i().createElement("img",{className:"img-fluid border rounded mb-2 w-75",src:f,alt:"Illustration"}),!o.submitted&&i().createElement(k.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Re-draw my answer")):i().createElement(k.L,{className:"btn btn-outline-dark",onClick:function(){return u(!0)}},"Draw my answer"),i().createElement(Ct,{error:o.error}),s&&i().createElement(Ie.Nq,{node:a},i().createElement(Ot,{interaction:r,onSave:function(t){c(Object.assign(Object.assign({},o),It({},r.actionableItems[0].id,t))),u(!1),e.recalculateScroll()},onCancel:function(){return u(!1)}})))}));function Ht(){return""}var Wt=Vt(Vt(Vt(Vt(Vt(Vt(Vt({},O.Z9.Annotation,Ht),O.Z9.Image,Ht),O.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"})),O.Z9.MultipleChoice,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),O.Z9.ShortAnswer,(function(e,t){var n;return Object.keys(e).filter((function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.trim())})).length?(null===(n=e[t.actionableItems[0].id])||void 0===n?void 0:n.length)>4e3?"Max answer length is ".concat(4e3," characters"):null:"Please provide an answer to the question"})),O.Z9.TrueOrFalse,(function(e){return Object.keys(e).length?null:"Please choose an answer"})),O.Z9.Illustration,(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 submit an illustration"})),Qt=Vt(Vt(Vt(Vt(Vt(Vt(Vt({},O.Z9.Annotation,null),O.Z9.Image,null),O.Z9.MissingWord,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),O.Z9.MultipleChoice,(function(e,t,n){return n(t.id,Object.keys(e).map((function(e){var n=t.actionableItems.find((function(t){var n;return(null===(n=t.id)||void 0===n?void 0:n.toString())===(null==e?void 0:e.toString())}));return{actionableItemId:e,value:null==n?void 0:n.name}})))})),O.Z9.ShortAnswer,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t].toString()}})))})),O.Z9.TrueOrFalse,(function(e,t,n){return n(t.id,Object.keys(e).map((function(t){return{actionableItemId:t,value:e[t]}})))})),O.Z9.Illustration,(function(e,t,n,r){return i=this,o=void 0,a=void 0,c=Pt().mark((function i(){var o,a,c,l;return Pt().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!(o=e[t.actionableItems[0].id]||"").startsWith(Lt)){i.next=7;break}return a=o.replace(Lt,""),i.next=5,K.e.post("".concat(r.imageApi,"v2/thumbnails/base64"),'"'.concat(a,'"'),{tokenName:"gateway"});case 5:c=i.sent,o=c.location;case 7:return l=Object.keys(e).map((function(e){return{actionableItemId:e,value:o}})),i.next=10,n(t.id,l);case 10:return i.abrupt("return",It({},t.actionableItems[0].id,o));case 11:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}));var i,o,a,c}));function Yt(e){return Qt[e]}var Kt=Vt(Vt(Vt(Vt(Vt(Vt(Vt({},O.Z9.Annotation,Ze.notApplicable),O.Z9.Image,Ze.notApplicable),O.Z9.MissingWord,(function(e,t){return Ze.isMissingWordCorrect(t,(function(t){return e[t]}))})),O.Z9.MultipleChoice,(function(e,t){return Ze.isMultipleChoiceCorrect(t,(function(t){return e[t]}))})),O.Z9.ShortAnswer,Ze.awaitingMarking),O.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})),O.Z9.Illustration,Ze.awaitingMarking);function $t(e){return Kt[e]}function Xt(e){var t=e.studentResults,n=e.interaction,r=e.timepoint,o=e.interactive,a=e.state,c=e.goToTimepoint,l=e.interactionNumber,s=e.imageCdnUrl,u=He(t),f=We(n.id,u),d=a.interactions[n.id],p=$t(n.typeId)(d||{},n),m=n.typeId!==O.Z9.Annotation&&n.typeId!==O.Z9.Image,h=m;n.typeId===O.Z9.MissingWord&&f&&(h=!1);var v=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:"O6oD6"},!!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:C.vn.Check})):p===E.Incorrect&&i().createElement("span",{className:"text-danger"},"Incorrect ",i().createElement(x.x,{className:"svg-container align-middle",svgName:C.vn.Close})))),i().createElement(L,{interaction:n,iconClassName:"flex-shrink-0",showQuestion:h,showTypeName:!0,questionClassName:"d-block w-100 mt-2",questionNumber:l})),m&&!f&&i().createElement("button",{className:"btn btn-dark",onClick:function(){return c(r.id,n.id)}},"Answer question"),f&&m&&i().createElement(pt,{interaction:n,studentResults:t,markedStatus:je.PendingReview,markInteraction:function(){},imageCdnUrl:s,showFeedback:o.immediateFeedback,showAvatar:!0}),o.immediateFeedback&&f&&v&&i().createElement("div",{className:"bg-light rounded p-2"},i().createElement("div",null,i().createElement("strong",null,n.typeId===O.Z9.TrueOrFalse?"Teacher's feedback":"Teacher's suggested response")),v))}function Jt(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=j.w.getTypeInfo(t.interactions[0].typeId).bgClassName,a=t.visibleAt/1e3/n*100;return i().createElement("span",{key:r,className:"".concat("pUo8u"," ").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)}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.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(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}}(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],l=[];if(o.length){var s=o[0];l.push(s),o.forEach((function(e,t){0!==t&&(s.end.time+1>e.start.time&&s.start.time<e.start.time?s.end=e.end:(s=e,l.push(s)))}))}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,l.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:"BnKli",style:{left:"".concat(n,"%"),right:"".concat(o,"%")}})})))}function nn(e){return!!(null==e?void 0:e.toString().startsWith("new_"))}function rn(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"])}function on(e){return function(e){if(Array.isArray(e))return cn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||an(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 an(e,t){if(e){if("string"==typeof e)return cn(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)?cn(e,t):void 0}}function cn(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 ln(e){var t,n,r=e.showSummary,o=e.setShowSummary,a=e.state,c=e.interactive,l=e.player,s=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||an(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],m=d[1];function h(){o(!1),l.show(),l.play()}function v(t,n){h(),e.goToTimepoint(t,n)}if(!u||!r)return i().createElement(i().Fragment,null);var y=function(e){var t=e.state,n=0,r=0,i=0,o=!1,a=[];return e.interactive.timepoints.forEach((function(e){e.interactions.forEach((function(e){var c=t.interactions[e.id],l=$t(e.typeId)(c||{},e);l===E.Correct&&n++,l!==E.NotApplicable&&r++,l!==E.NotApplicable&&(null==c?void 0:c.submitted)&&i++,l===E.AwaitingMarking&&(o=!0);var s=rn(c||{}),u=Object.keys(s).map((function(e){var t;return{id:e,text:null===(t=s[e])||void 0===t?void 0:t.toString()}}));u.length&&a.push({id:e.id,answeredAt:1,answers:u})}))})),{correctCount:n,total:r,answered:i,studentAttempts:a,awaitingMarking:o}}({interactive:c,state:a}),g=y.correctCount,b=y.total,w=y.answered,S=y.studentAttempts,x=y.awaitingMarking,O={user:{name:e.currentUser.givenName,surname:e.currentUser.familyName,avatar:{url:e.currentUser.avatar}},results:[{id:c.id,attempts:S}]},N=0,j=l.ended(),P=l.duration();return i().createElement(Ie.Nq,{node:u},i().createElement("div",{className:"row pb-3"},i().createElement("div",{className:"col-4 col-xs-12"},i().createElement(Te.Z,{data:l.poster(),imageType:Ae.__.Thumbnails,imageOptions:{size:Ae.h2.Medium}})),i().createElement("div",{className:"col-8 col-xs-12"},i().createElement("span",{className:"float-end"},i().createElement(Le.h,{svgName:C.vn.Play,className:"btn btn-outline-dark",onClick:function(){h(),l.ended()&&l.currentTime(0)}},j?"Play again":"Continue watching"),l.gradePassbackPlugin().enabled&&(p?i().createElement(k.L,{className:"btn btn-dark ms-2",onClick:function(){}},i().createElement(Pe.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(Le.h,{svgName:C.vn.Check,className:"btn btn-dark ms-2",onClick:function(){m(!0),l.gradePassbackPlugin().submit(g/b,!x)}},"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("gxTA_"),onClick:function(e){if(f.current){var t=f.current.getBoundingClientRect(),n=(e.pageX-t.left)/t.width*P;h(),l.currentTime(n)}},ref:f},i().createElement(tn,{duration:P,progress:s,interactive:c,player:l}),i().createElement(Jt,{duration:P,interactive:c,goToTimepoint:v}))),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(on(t),on(n.interactions.map((function(t){return N++,i().createElement(Xt,{key:t.id,studentResults:O,interaction:t,timepoint:n,interactive:c,state:a,goToTimepoint:v,interactionNumber:N,imageCdnUrl:e.imageCdnUrl})}))))}),[])))))}function sn(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return un(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)?un(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 un(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 fn(e){var t=e.player,n=e.resultsService,r=e.interactive,o=e.setShowSummary,a=e.mobile,c=sn(i().useState(!1),2),l=c[0],s=c[1],u=sn(i().useState(!1),2),f=u[0],d=u[1],p=e.player.activePlugins_.activityStatusPlugin,m=e.player.activePlugins_.favouritePlugin;function h(){var e=t.currentTime(),n=r.timepoints[r.timepoints.length-1];f||e>n.visibleAt/1e3+1?s(!0):s(!1)}function v(){d(!0)}if(i().useEffect((function(){return t.on("ended",v),function(){return t.off("ended",v)}}),[]),i().useEffect((function(){if(n&&!a)return t.on("timeupdate",h),function(){return t.off("timeupdate",h)}}),[f]),!l)return null;var y="btn btn-outline-dark cv-show-summary";return m&&(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 dn(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 pn(e){var t,n,r=e.resultsService,o=e.player,a=e.onShowSummary,c=e.mobile,l=(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return dn(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)?dn(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.")}()),s=l[0],u=l[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(){s&&o.isFullscreen()&&o.exitFullscreen()}),[s]),i().createElement(i().Fragment,null,i().createElement(fn,Object.assign({setShowSummary:f},e)),i().createElement(ln,Object.assign({showSummary:s,setShowSummary:f},e)))}var mn=n(25692),hn=n(98985);function vn(){var e=hn.o.getLiteArticle(mn.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 yn(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 l=n.timepoints.reduce((function(e,t){return e+t.interactions.length}),0);return i().createElement(Ie.Nq,{node:o},l?i().createElement(i().Fragment,null,i().createElement("h2",{className:"h4 mt-3"},"Question List (",l,")"),i().createElement(R,{interactive:n,maxHeight:300,goToTimepoint:a,selectedInteractionId:null==r?void 0:r.id,onClickDelete:t?c:void 0,experimentalInteractiveQuestions:e.experimentalInteractiveQuestions})):t?i().createElement(vn,null):i().createElement(i().Fragment,null))}var gn=n(90547),bn=n(5256),wn=n(30708);function En(e,t){if(e){if("string"==typeof e)return Sn(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)?Sn(e,t):void 0}}function Sn(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 kn=[O.Z9.MissingWord,O.Z9.MultipleChoice,O.Z9.TrueOrFalse,O.Z9.ShortAnswer,O.Z9.Image,O.Z9.Annotation];function xn(e){var t,n,r=e.addInteraction,o=e.cancelTypeSelector,a=e.player,c=e.timepoint,l=e.open,s=e.isCreate,u=e.interaction,f=e.experimentalInteractiveQuestions,d=(t=i().useState((0,wn.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||En(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],m=d[1],h=[].concat(kn);return f&&h.push.apply(h,function(e){return function(e){if(Array.isArray(e))return Sn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||En(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.")}()}(Object.keys(O.IL))),i().useEffect((function(){var e=function(){m((0,wn.m)(a.currentTime()))};return a.on("timeupdate",e),function(){return a.off("timeupdate",e)}}),[]),!u&&s&&l?i().createElement("div",{className:"d-flex align-items-center justify-content-center h-100\n ".concat(f?"cv-experimental-types":"","\n ")},i().createElement("div",{className:"cv-interactive-type-selector justify-content-center align-items-center"},i().createElement("h2",{className:"text-center fw-bold w-100 text-body mb-3 cv-add-question-copy"},c?"Add another question at:":"Add a question at:"," ",p),i().createElement("ul",{className:"list-unstyled row g-2\n ".concat(f?"row-cols-2":"row-cols-3")},h.map((function(e,t){var n=j.w.getTypeInfo(e),o=n.name,a=n.bgClassName,c=n.Svg;return i().createElement("li",{className:"col",key:t},i().createElement(k.L,{className:"cv-type-selector rounded\n ".concat(f?" p-2 w-100 d-flex border justify-content-start align-items-center":"py-2 w-100 ".concat(a),"\n "),onClick:function(){return r(e)}},i().createElement("span",{className:"cv-create-type-icon\n ".concat(f?"text-shadow rounded ".concat(a," me-2"):"mb-1","\n ")},i().createElement(c,null)),i().createElement("div",{className:"d-flex align-items-center justify-content-center cv-interaction-type-name\n ".concat(f?"text-dark":"px-1 text-shadow","\n ")},o)))}))),(c||l)&&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")))):i().createElement(i().Fragment,null)}var On=n(12704);function Cn(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 l=nn(n.id);c.push({label:"Re-order questions",onClick:function(){return a("reorder")},className:l?"disabled":""})}return c.push({label:"Delete",onClick:function(){return r(n.id)},className:"text-danger"}),i().createElement(Ie.Nq,{node:o},!!n&&i().createElement(On.m,{actions:c,className:"p-0 mt-n2",dropdownToggleClassName:"p-0"}))}function Nn(e){var t=e.interaction,n=e.interactionState,i=e.onClickContinue,o=e.onClickSave,a=e.onClickCancel,c=e.onClickAddAnother,l=e.onClickDiscard,s=nn(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"},s?r.createElement(k.L,{className:"btn btn-link",onClick:a},"Cancel"):u?r.createElement(k.L,{className:"btn btn-link",onClick:l},"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(Pe.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):s?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(Ce,{className:"btn btn-dark ms-2",onClick:i,svgName:C.vn.Play},"Continue"))}function jn(e){var t=e.typeId,n=e.interactionState,i=e.onClickSkip,o=e.numberOfInteractions,a=e.currentIndex,c=e.changeIndex,l=!!(null==n?void 0:n.submitted),s=!!(null==n?void 0:n.hasChanges),u=!!(null==n?void 0:n.spinner),f=!!Yt(t),d=a<o-1;var p=a>0;return r.createElement("div",{className:"cv-timpoint-button-container flex-wrap"},!l&&f&&r.createElement(k.L,{className:"btn btn-link",onClick:i},"Come back later"),o>1&&a>0&&r.createElement(Ce,{className:"btn btn-dark ms-2 ".concat(p?"":"disabled"),onClick:function(){p&&c(a-1)},svgName:C.vn.ChevronUp}),u?r.createElement(k.L,{className:"btn btn-dark ms-2 cv-interactive-spinner",onClick:function(){}},r.createElement(Pe.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):l||!f?1===o||a===o-1?r.createElement(Ce,{className:"btn btn-dark ms-2",onClick:i,svgName:C.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(s?"":"disabled"),onClick:function(){s&&e.onClickSubmit()}},"Save"))}function Pn(e){var t=e.isCreate,n=e.interaction,r=e.interactionState,o=e.continueInteractive,a=e.saveInteraction,c=e.cancel,l=e.addAnotherQuestion,s=e.discardChanges,u=e.submitInteractionAnswer,f=e.onClickSkip,d=e.changeIndex,p=e.timepoint,m=e.currentIndex;return i().createElement(i().Fragment,null,t?i().createElement(Nn,{interaction:n,interactionState:r,onClickContinue:o,onClickSave:a,onClickCancel:c,onClickAddAnother:l,onClickDiscard:function(){return s()}}):i().createElement(jn,{typeId:n.typeId,interactionState:r,onClickSubmit:u,onClickSkip:f,changeIndex:d,currentIndex:m,numberOfInteractions:p.interactions.length}))}function In(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 Ln(e){var t,n,r=e.typeId,o=e.currentIndex,a=e.numberOfInteractions,c=e.changeIndex,l=e.player,s=(t=i().useState((0,wn.m)(l.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return In(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)?In(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=s[0],f=s[1];i().useEffect((function(){var e=function(){f((0,wn.m)(l.currentTime()))};return l.on("timeupdate",e),function(){return l.off("timeupdate",e)}}),[]);var d=j.w.getTypeInfo(r),p=d.name,m=d.bgClassName,h=o<a-1,v=o>0;return i().createElement("div",{className:"text-center d-flex justify-content-between align-items-center p-1 ".concat(m)},i().createElement(k.L,{onClick:function(){v&&c(o-1)},className:v?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:C.vn.ChevronLeft})),i().createElement("div",null,i().createElement("h2",{className:"h6 mb-0"},p),a>1&&i().createElement("div",null,o+1," of ",a," at ",u)),i().createElement(k.L,{onClick:function(){h&&c(o+1)},className:h?"":"invisible"},i().createElement(x.x,{size:x.S.Medium,svgName:C.vn.ChevronRight})))}var Tn=n(29014),An=n(2248),_n=n(3026),Fn=n(52076);function Dn(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 Rn=null,Mn=!1;function Un(e){var t,n,i=(t=r.useState(Rn),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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Dn(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)?Dn(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 Rn||Mn||(Mn=!0,(0,_n.ajaxRequest)({resource:"/api/integrations/token/immersive-reader",type:An.k.GET,success:function(e){Rn=e,a(e),window.setTimeout((function(){Rn=null,Mn=!1}),9e5)},error:function(){}})),o?(e.title||(e.title=Ye.T.getPhrase("shared.immersiveReader","titleFallback")),r.createElement("span",{className:"".concat("nckQw"," ").concat(e.className||""),onClick:function(){s.q.isFunction(e.onLaunch)&&e.onLaunch(),Fn.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(){s.q.isFunction(e.onExit)&&e.onExit()}};Tn.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 Vn=["A","B","C","D"];function Bn(e){if(!e.enableImmersiveReader)return i().createElement(i().Fragment,null);var t=e.interaction,n=e.className,r=j.w.getTypeInfo(t.typeId),o=r.name,a=r.typeName,c="";switch(t.typeId){case O.Z9.Annotation:c=t.data.annotation;break;case O.Z9.Image:c=t.data.caption;break;case O.Z9.MissingWord:c=t.data.sentence.replace(/{([^{}]*)}/g,(function(){return"<u>&nbsp;&nbsp;&nbsp;&nbsp;</u>"}));break;case O.Z9.MultipleChoice:c=t.name,t.actionableItems.map((function(e,t){return c+="<br />".concat(Vn[t],": ").concat(e.name)}));break;case O.Z9.ShortAnswer:c=t.name;break;case O.Z9.TrueOrFalse:c="True or false: ".concat(t.name)}var l=t.typeId===O.Z9.Annotation||t.typeId===O.Z9.MissingWord||t.typeId===O.Z9.MultipleChoice;return i().createElement(Un,{title:o,text:c,html:l,className:"".concat("Erirh"," ").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 qn(e){var t=j.w.getTypeInfo(e.interaction.typeId),n=t.name,r=t.prompt,o=t.bgClassName,a=t.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(o)},i().createElement(a,null)),i().createElement("span",{className:"text-start flex-grow-1"},i().createElement("div",{className:"h5 ".concat(r?"":"mb-0")},i().createElement("strong",null,n)),r&&i().createElement("div",{className:"h6 mb-0"},r))),i().createElement(Bn,{interaction:e.interaction,className:"ms-2",enableImmersiveReader:e.enableImmersiveReader}))}function Gn(e){var t=e.isCreate,n=e.interaction,r=e.player,o=e.changeIndex,a=e.timepointState,c=e.timepoint;return t?i().createElement(Ln,{typeId:n.typeId,changeIndex:o,player:r,currentIndex:a.interactionIndex,numberOfInteractions:c.interactions.length}):i().createElement(qn,{interaction:n,enableImmersiveReader:e.enableImmersiveReader})}var Zn=n(10671),zn=n(98886),Hn=n(6880);function Wn(e){var t=e.error;return e.error?i().createElement("p",{id:e.id,className:"mt-2 small text-danger",role:"status"},t):i().createElement(i().Fragment,null)}function Qn(e){return Qn="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},Qn(e)}function Yn(){Yn=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Qn(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Qn(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Kn(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,$n(r.key),r)}}function $n(e){var t=function(e){if("object"!=Qn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qn(t)?t:t+""}var Xn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Jn=function(e){return"/api/domain/v1/interactions/".concat(e)},er=function(e){return"/api/domain/v1/timepoints/".concat(e)},tr={},nr=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 Xn(this,void 0,void 0,Yn().mark((function t(){var n,r,i,o,a;return Yn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=nn(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?K.e.post(r,JSON.stringify(i),tr):K.e.put(r,JSON.stringify(i),tr),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 Xn(this,void 0,void 0,Yn().mark((function t(){return Yn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,K.e.delete(Jn(e),tr);case 2:case"end":return t.stop()}}),t)})))}},{key:"saveTimepoint",value:function(e){return Xn(this,void 0,void 0,Yn().mark((function t(){var n,r;return Yn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={interactiveId:e.interactiveId,shouldPause:1,visibleAt:e.visibleAt},t.next=3,K.e.post("/api/domain/v1/timepoints",JSON.stringify(n),tr);case 3:r=t.sent,e.id=r.id;case 5:case"end":return t.stop()}}),t)})))}},{key:"updateTimepoint",value:function(e){return Xn(this,void 0,void 0,Yn().mark((function t(){return Yn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,K.e.put((n=e.id,"/api/domain/v1/timepoints/".concat(n)),JSON.stringify(e),tr);case 2:case"end":return t.stop()}var n}),t)})))}},{key:"deleteTimepoint",value:function(e){return Xn(this,void 0,void 0,Yn().mark((function t(){return Yn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,K.e.delete(er(e),tr);case 2:case"end":return t.stop()}}),t)})))}}])&&Kn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()),rr={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 ir(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return or(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)?or(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 or(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 ar(e){var t=ir(i().useState(""),2),n=t[0],r=t[1],o=ir(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 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 lr(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sr(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)?sr(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 sr(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 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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function fr(e){return fr="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},fr(e)}function dr(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(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)?pr(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 pr(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 mr(){mr=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==fr(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(fr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var hr=n(48088);function vr(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 yr=!0;function gr(){var e=function(){var e,t,n=(e=i().useState(yr),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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vr(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)?vr(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.")}()),r=n[0],o=n[1],a=hr.Radio.channel("video:drag:drop:lock");function c(){o(yr)}return i().useEffect((function(){if(yr)return a.on("update",c),function(){a.off("update",c)}}),[]),{enabled:r,disable:function(){yr=!1,a.trigger("update")},enable:function(){yr=!0,a.trigger("update")}}}(),t=e.enable,n=e.disable;i().useEffect((function(){return n(),function(){return t()}}),[])}var br=n(24365),wr=n(99828),Er={onFileSelect:function(e,t,n,r){if(t&&t.length)if(t.length>1)alert("Please only select one file");else{var i=t[0];if(i.type.startsWith("image/")){var o=new FileReader;o.addEventListener("load",(function(){return Er.onReaderLoad(o,e,n,r)})),o.readAsDataURL(i)}else alert("Please select an image file")}},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:wr.y[t].width,l=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:wr.y[t].height;a.addEventListener("load",(function(){Er.isImageValid(t,a,r)&&s.q.isFunction(n)?n(a):alert("Image too small: minimum dimensions are ".concat(c," x ").concat(l))}))},isImageValid:function(e,t,n){var r,i,o=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:wr.y[e].width,a=null!==(i=null==n?void 0:n.height)&&void 0!==i?i:wr.y[e].height;return!(o&&t.width<o||a&&t.height<a)},mapImageTypeToString:function(e){switch(e){case Ae.__.Avatars:return"avatars";case Ae.__.Thumbnails:return"thumbnails";case Ae.__.Logos:return"logos";case Ae.__.Covers:return"covers";case Ae.__.Posters:return"posters";case Ae.__.TallPosters:return"tallposters";case Ae.__.HeroBanners:return"herobanners";case Ae.__.None:default:return""}}};function Sr(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kr(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)?kr(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 kr(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 xr(e){var t=Sr(i().useState(!1),2),n=t[0],r=t[1],o=Sr(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?e.dragClassName:""},e.children)}function Or(e){return Or="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},Or(e)}function Cr(){Cr=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Or(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Or(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Nr(e){return Nr="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},Nr(e)}function jr(){jr=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Nr(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Nr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Pr=/[.\?!,;:\-''\(\)]/g;function Ir(e){for(var t=e.split("");t.length&&t[0].match(Pr);)t.shift();for(;t.length&&t[t.length-1].match(Pr);)t.pop();return t.join("")}function Lr(e,t){for(var n=e.split(""),r=[],i=[];n.length&&n[0].match(Pr);)r.push(n.shift());for(;n.length&&n[n.length-1].match(Pr);)i.unshift(n.pop());return r.join("")+t+i.join("")}function Tr(e){return e.map((function(e){if(!e.selected)return e.text;var t=Ir(e.text).length,n=new Array(t).fill("_").join("");return Lr(e.text,n)})).join(" ")}function Ar(e){return e.map((function(e){var t;return e.selected?null===(t=Lr(e.text,"{".concat(e.order,"}")))||void 0===t?void 0:t.trim():e.text})).join(" ")}var _r=n(63946);function Fr(e){return i().createElement(_r.u,{title:e.tooltipText,spanHack:!0,spanHackClassName:"d-inline-block"},i().createElement(x.x,{svgName:C.vn.Info}))}function Dr(){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 Rr(e){var t,n,r=i().useRef(null),o=i().useRef(null);function a(){e.onChange(Object.assign(Object.assign({},e.answer),{isCorrect:!e.answer.isCorrect}))}function c(t){e.isTrueOrFalse||t&&t[0]&&Er.onFileSelect(Ae.__.None,t,(function(e){br.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:l})}))}function l(t,n){var r=t.split(",")[1];K.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(r,'"'),{tokenName:"gateway"}).then((function(t){e.onChange(Object.assign(Object.assign({},e.answer),{data:{imageUrl:t.location}})),n()})).catch((function(){return alert("Something went wrong while trying to upload image. Please try again.")}))}return i().createElement(xr,{onDropImage:c,dragClassName:"cv-multiple-choice-upload-mask"},i().createElement("div",{className:"p-2 my-1 w-100 bg-white d-flex align-items-center rounded cv-multiple-choice-answer"},i().createElement("div",{className:"form-check",onKeyDown:function(e){return"Enter"===e.key&&a()}},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:a,disabled:!e.answer.name&&!(null===(t=e.answer.data)||void 0===t?void 0:t.imageUrl),"aria-label":"Correct answer ".concat(e.answer.order)}),i().createElement("label",{ref:r,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 me-2",autoComplete:"off"}),!e.isTrueOrFalse&&i().createElement(i().Fragment,null,i().createElement("input",{type:"file",className:"file-select d-none",multiple:!1,accept:"image/jpg,image/jpeg,image/png",ref:o,onChange:function(e){return c(e.target.files)}}),(null===(n=e.answer.data)||void 0===n?void 0:n.imageUrl)?i().createElement(_r.u,{key:"1",title:"Remove image",spanHack:!0,spanHackClassName:"mt-n2 mb-n2 me-n2"},i().createElement(k.L,{type:"button",className:"cv-multiple-choice-create-image rounded-end bg-gray-400",style:{backgroundImage:"url(".concat(e.answer.data.imageUrl,")")},onClick:function(){e.onChange(Object.assign(Object.assign({},e.answer),{data:void 0}))}},i().createElement("span",{className:"cv-multiple-choice-remove-image"},i().createElement(x.x,{svgName:C.vn.Delete})))):i().createElement(_r.u,{key:"2",title:"Upload an image",spanHack:!0},i().createElement(k.L,{type:"button",className:"svg-container",onClick:function(){o.current.value=null,o.current.click(null)}},i().createElement(Dr,null))))))}function Mr(e){return Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mr(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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Mr(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Mr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Vr(e){var t,n;if(!(null===(t=e.question)||void 0===t?void 0:t.trim()))return"Please provide a question";if((null===(n=e.question)||void 0===n?void 0:n.trim().length)>500)return"Max question length is ".concat(500," characters");if(!e.answers.find((function(e){return e.isCorrect})))return"Please select the correct answer";if(e.answers.find((function(e){var t;return(null===(t=e.name)||void 0===t?void 0:t.length)>255})))return"Max answer length is ".concat(255," characters");var r=e.answers.filter((function(e){var t,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)}));if(r.length<2)return"Please provide at least two answers";var i=e.answers.filter((function(e){var t;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())}));if(i.length&&i.length!==r.length)return"Please add text to every question or none of the questions.";var o=!1,a={};if(i.forEach((function(e){o||(a[e.name]?o=!0:a[e.name]=!0)})),o)return"There are duplicates in your answers";var c=r.filter((function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.imageUrl})).length;return c&&c<r.length?"Please add an image to all answers":null}function Br(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=Ur().mark((function r(){return Ur().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,n;return!!(null===(t=e.name)||void 0===t?void 0:t.trim())||!!(null===(n=e.data)||void 0===n?void 0:n.imageUrl)})),e.feedback&&(t.data.feedback=e.feedback),r.next=5,nr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}function qr(e){var t=e.state,n=void 0===t?function(e){var t,n=e.typeId===O.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,data:e.data?{imageUrl:e.data.imageUrl}:null}}));return(null==r?void 0:r.length)?!n&&(null==r?void 0:r.length)<4&&r.push({order:r.length,name:"",isCorrect:!1,data:null}):r=[{order:0,name:n?"True":"",isCorrect:!1,data:null},{order:1,name:n?"False":"",isCorrect:!1,data:null}],{question:e.name||"",answers:r,feedback:e.data.feedback||""}}(e.interaction):t,r=e.setState,o=e.interaction,a=e.optionsPortalNode,c=e.showFeedback,l=o.typeId===O.Z9.TrueOrFalse;function s(e){var t,i,o=n.answers.map((function(t){return t.order!==e.order?Object.assign(Object.assign({},t),{isCorrect:!l&&t.isCorrect}):e}));if(o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))&&(i=(t=o).find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)})),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})}))),!l&&o.length<4&&!o.find((function(e){var t;return!e.name&&!(null===(t=e.data)||void 0===t?void 0:t.imageUrl)}))){var a=ze.m.last(o);o.push({name:"",order:a.order+1,isCorrect:!1,data:void 0})}r(Object.assign(Object.assign({},n),{answers:o}))}return gr(),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"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-question"},"Question"),i().createElement(Ie.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(Wn,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"multiple-choice-answer"},l?i().createElement(i().Fragment,null,"Answer"):i().createElement(i().Fragment,null,"Answers")),i().createElement("ul",{className:"list-unstyled"},n.answers.map((function(t){return i().createElement("li",{key:t.order},i().createElement(Rr,{answer:t,onChange:s,isTrueOrFalse:l,imageApi:e.imageApi}))}))),n.question&&i().createElement(Wn,{error:n.error})),c&&l&&i().createElement("div",{className:"form-group mb-0"},i().createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"true-or-false-feedback"},i().createElement("span",null,"Feedback  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement(Fr,{tooltipText:"Provide answer feedback for your students"})),i().createElement(Dt.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 Gr(e){return Gr="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},Gr(e)}function Zr(){Zr=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Gr(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Gr(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var zr,Hr="Please provide a question",Wr="Max question length is ".concat(255," characters"),Qr="Max answer length is ".concat(4e3," characters");function Yr(e){return Yr="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},Yr(e)}function Kr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Yr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e[e.QUESTION=0]="QUESTION",e[e.ANSWER=1]="ANSWER"}(zr||(zr={}));var $r=Kr(Kr(Kr(Kr(Kr(Kr(Kr({},O.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=lr(i().useState(function(){var e=o.data.annotation;if(e){var t=(0,zn.h4)(rr)(e);return Hn.EditorState.createWithContent(t)}return Hn.EditorState.createEmpty()}()),2),l=c[0],s=c[1],u=lr(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"},i().createElement("label",{className:"cv-interaction-field-label",onClick:function(){return null==f?void 0:f.focusEditor()}},"Annotation"),i().createElement(Ie.t0,{node:a})),i().createElement("div",{className:"cv-annotation ".concat(function(){if(!l)return!1;var e=l.getCurrentContent();return e.hasText()||"unstyled"!==e.getBlockMap().first().getType()}()?"Editor--hide-placeholder":"")},l&&i().createElement(Zn.Editor,{editorState:l,onEditorStateChange:function(e){s(e);var t=e.getCurrentContent();if(t.hasText()){var i=(0,zn.cn)(rr)(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:ar,options:["link"]}}}),i().createElement(Wn,{error:n.error}))))})),O.Z9.Image,(function(e){var t=e.state,n=void 0===t?function(e){var t;return{url:(null===(t=e.data)||void 0===t?void 0:t.url)||"",caption:e.data.caption}}(e.interaction):t,r=e.setState,o=e.interaction,a=e.optionsPortalNode;gr();var c=i().useRef(null);function l(e){e&&e[0]&&Er.onFileSelect(Ae.__.None,e,(function(e){br.CropperHelper.renderCropper({src:e.src,alt:"",onClickCrop:s})}))}function s(t,i){var o=t.split(",")[1];K.e.post("".concat(e.imageApi,"v2/thumbnails/base64"),'"'.concat(o,'"'),{tokenName:"gateway"}).then((function(e){r(Object.assign(Object.assign({},n),{url:e.location})),i()})).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-2"},i().createElement("label",{className:"cv-interaction-field-label"},"Image"),i().createElement(Ie.t0,{node:a})),n.url?i().createElement("div",{className:"text-center"},i().createElement("div",{className:"cv-uploaded-image-container"},i().createElement("img",{className:"img img-fluid rounded",src:n.url,alt:n.caption}),i().createElement(k.L,{className:"cv-remove-uploaded-image d-flex justify-content-center align-items-center",onClick:function(){r(Object.assign(Object.assign({},n),{url:""}))}},i().createElement("div",{className:"btn btn-link text-light"},"Remove")))):i().createElement(xr,{onDropImage:l,dragClassName:"cv-image-upload-mask"},i().createElement("div",{className:"cv-image-interaction-upload-container bg-white rounded py-3 text-center"},i().createElement("div",{className:"cv-upload-scenery-image mx-auto"}),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(){c.current.value=null,c.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:c,onChange:function(e){return l(e.target.files)}}))),i().createElement(Wn,{error:n.error})),i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"image-caption"},"Caption  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement("textarea",{id:"image-caption",className:"form-control",placeholder:"Caption your image",value:n.caption||o.data.caption||"",onChange:function(e){r(Object.assign(Object.assign({},n),{caption:e.target.value}))},rows:2})))})),O.Z9.MissingWord,(function(e){var t,n,r,o,a,c,l=e.state,s=void 0===l?(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=Lr(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}):l,u=e.setState,f=e.optionsPortalNode,d=!!s.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"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"missing-word-sentence"},"Sentence"),i().createElement(Ie.t0,{node:f})),i().createElement("input",{id:"missing-word-sentence",className:"form-control",placeholder:"Enter your sentence here",value:s.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({},s),{fullSentence:t,sentence:Ar(n),preview:Tr(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"},s.words.map((function(e,t){var n;return(null===(n=Ir(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-dark text-white":"bg-white"),onClick:function(){return e=t,n=s.words.map((function(t){return t.order!==e?t:Object.assign(Object.assign({},t),{selected:!t.selected})})),void u(Object.assign(Object.assign({},s),{words:n,preview:Tr(n),sentence:Ar(n)}));var e,n}},Ir(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,s.preview))),i().createElement(Wn,{error:s.error}))})),O.Z9.MultipleChoice,qr),O.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;function l(){switch(n.error){case Hr:case Wr:return zr.QUESTION;case Qr:return zr.ANSWER}}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"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"short-answer-question"},"Question"),i().createElement(Ie.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","aria-errormessage":"question-error"}),l()===zr.QUESTION&&i().createElement(Wn,{id:"question-error",error:n.error})),c&&i().createElement("div",{className:"form-group"},i().createElement("label",{className:"cv-interaction-field-label d-flex justify-content-between align-items-end",htmlFor:"short-answer-suggested-response"},i().createElement("span",null,"Suggested Response  ",i().createElement("small",{className:"text-secondary"},"(optional)")),i().createElement(Fr,{tooltipText:"Provide a suggested response for your students"})),i().createElement(Dt.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","aria-errormessage":"answer-error"}),l()===zr.ANSWER&&i().createElement(Wn,{id:"answer-error",error:n.error})))})),O.Z9.TrueOrFalse,qr),O.Z9.Illustration,(function(e){var t=dr(i().useState(),2),n=t[0],r=t[1],o=dr(i().useState(!1),2),a=o[0],c=o[1],l=e.state,s=void 0===l?{question:e.interaction.name}:l,u=e.setState,f=e.optionsPortalNode;return i().createElement("div",{className:"cv-interactive-question"},i().createElement("fieldset",{className:"form-group"},i().createElement("div",{className:"d-flex justify-content-between align-items-center"},i().createElement("label",{className:"cv-interaction-field-label",htmlFor:"illustration-question"},"Prompt"),i().createElement(Ie.t0,{node:f})),i().createElement("input",{id:"illustration-question",className:"form-control",onChange:function(e){u(Object.assign(Object.assign({},s),{question:e.target.value}))},value:s.question||"",placeholder:"Enter your prompt here",autoComplete:"off","aria-invalid":!!s.error,"aria-errormessage":"illustrationQuestionError"}),i().createElement(Wn,{id:"illustrationQuestionError",error:s.error})),i().createElement("div",{className:"alert text-dark bg-light-blue px-2 rounded-3"},"Students attempting this question will be prompted to draw their answer. ",i().createElement(k.L,{onClick:function(){return c(!0)},className:"btn-link text-underline d-inline"},"Preview how students will answer.")),a&&i().createElement(Ie.Nq,{node:e.fullWidthPortalNode},i().createElement(Ot,{interaction:Object.assign(Object.assign({},e.interaction),{name:s.question}),onSave:function(e){r(e),c(!1)},onCancel:function(){return c(!1)}})),n&&i().createElement("img",{className:"img-fluid border rounded mt-2 w-50 d-block",src:n,alt:"Illustration you just created."}))})),Xr=Kr(Kr(Kr(Kr(Kr(Kr(Kr({},O.Z9.Annotation,(function(e){var t,n;return(null===(t=e.annotation)||void 0===t?void 0:t.trim())?(null===(n=e.annotation)||void 0===n?void 0:n.trim()).replace(/<[^>]*>/g,"").length>3500?"Max length is ".concat(3500," characters"):null:"Please provide an annotation"})),O.Z9.Image,(function(e){return e.url?null:"Please upload an image"})),O.Z9.MissingWord,(function(e){var t,n;return(null===(t=e.sentence)||void 0===t?void 0:t.trim())?(null===(n=e.sentence)||void 0===n?void 0:n.trim().length)>255?"Max length is ".concat(255," characters"):e.words.find((function(e){return e.selected}))?null:"Please select a missing word":"Please provide a sentence"})),O.Z9.MultipleChoice,Vr),O.Z9.ShortAnswer,(function(e){var t,n,r;return(null===(t=e.question)||void 0===t?void 0:t.trim())?(null===(n=e.question)||void 0===n?void 0:n.trim().length)>255?Wr:(null===(r=e.suggestedResponse)||void 0===r?void 0:r.trim().length)>4e3?Qr:null:Hr})),O.Z9.TrueOrFalse,Vr),O.Z9.Illustration,(function(e){var t;return(null===(t=e.question)||void 0===t?void 0:t.trim())?null:"Please provide a question"})),Jr=Kr(Kr(Kr(Kr(Kr(Kr(Kr({},O.Z9.Annotation,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=ur().mark((function r(){return ur().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,nr.saveInteraction(t);case 5:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))})),O.Z9.Image,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Cr().mark((function i(){return Cr().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,nr.saveInteraction(t);case 6:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),O.Z9.MissingWord,(function(e,t){return n=this,r=void 0,i=void 0,o=jr().mark((function n(){var r;return jr().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.data.sentence=Ar(e.words),t.name=e.preview,r=e.words.filter((function(e){return e.selected})),t.actionableItems=r.map((function(e){return{name:Ir(e.text),order:e.order,isCorrect:!0}})),n.next=6,nr.saveInteraction(t);case 6:case"end":return n.stop()}}),n)})),new(i||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}));var n,r,i,o})),O.Z9.MultipleChoice,Br),O.Z9.ShortAnswer,(function(e,t){var n,r,i,o,a,c;return i=this,o=void 0,a=void 0,c=Zr().mark((function i(){return Zr().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,nr.saveInteraction(t);case 5:case"end":return i.stop()}}),i)})),new(a||(a=Promise))((function(e,t){function n(e){try{l(c.next(e))}catch(e){t(e)}}function r(e){try{l(c.throw(e))}catch(e){t(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}l((c=c.apply(i,o||[])).next())}))})),O.Z9.TrueOrFalse,Br),O.Z9.Illustration,(function(e,t){var n,r,i,o,a;return r=this,i=void 0,o=void 0,a=mr().mark((function r(){return mr().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=[{name:"Answer"}],r.next=4,nr.saveInteraction(t);case 4:case"end":return r.stop()}}),r)})),new(o||(o=Promise))((function(e,t){function n(e){try{l(a.next(e))}catch(e){t(e)}}function c(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(n,c)}l((a=a.apply(r,i||[])).next())}))}));function ei(e){return Jr[e]}function ti(e){return ti="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},ti(e)}function ni(){ni=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==ti(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(ti(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ri(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ii(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)?ii(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 ii(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 oi=null,ai=0,ci=1;function li(e){var t=e.timepoint,n=e.updateTimepointTime,r=e.saveTimepoint,o=e.back,a=e.clearTimepointTimeState,c=ri(i().useState((0,wn.m)(t.visibleAt/1e3)),2),l=c[0],s=c[1],u=ri(i().useState(!1),2),f=u[0],d=u[1];function p(e){n(e*ci),s((0,wn.m)(t.visibleAt/1e3)),2==++ai?ci=5:4===ai?ci=20:6===ai?ci=60:8===ai&&(ci=120),oi||(oi=window.setInterval((function(){return p(e)}),200),window.addEventListener("mouseup",m))}function m(){window.removeEventListener("mouseup",m),window.clearInterval(oi),oi=null,ai=0,ci=1}return i().useEffect((function(){return m}),[]),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",{htmlFor:"move-time-point",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(),13===e.keyCode&&0===ai&&p(-1)},onKeyUp:m}),i().createElement("input",{id:"move-time-point",className:"form-control text-center d-inline-block cv-move-timepoint-input",value:l,onChange:function(){},onKeyDown:function(e){e.stopPropagation(),37===e.keyCode&&0===ai&&p(-1),39===e.keyCode&&0===ai&&p(1)},onKeyUp:m}),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(),13===e.keyCode&&0===ai&&p(1)},onKeyUp:m}))))),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(Pe.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark",onClick:function(){return e=this,t=void 0,n=void 0,i=ni().mark((function e(){return ni().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)})),new(n||(n=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function c(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((i=i.apply(e,t||[])).next())}));var e,t,n,i}},"Save")))}var si=n(20455),ui=n(95339),fi=n(67445);function di(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 pi(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return di(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)?di(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,si.Dy)((0,si.VT)(si.we,{activationConstraint:{distance:10}}),(0,si.VT)(si.Lg,{coordinateGetter:fi.is}));return e.disabled?i().createElement(i().Fragment,null,e.children):i().createElement(si.LB,{sensors:c,collisionDetection:si.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?[ui.DL]:[]},i().createElement(fi.Fo,{items:e.ids,strategy:e.vertical?fi.qw:fi.U2},e.children),i().createElement(si.y9,{dropAnimation:e.dropAnimation},o?e.getDragOverlay(o):null))}pi.defaultProps={dropAnimation:{duration:250,easing:"ease"},vertical:!0};var mi=n(17592);function hi(e){var t=(0,fi.nB)({id:e.id}),n=t.setNodeRef,r=t.transform,o=t.transition,a=t.isSorting,c=t.listeners,l=t.attributes,s=t.activeIndex,u=t.overIndex,f=t.index,d={transform:mi.ux.Transform.toString(r),transition:o,touchAction:"none",position:"relative"};a&&f===s&&(d.visibility="hidden");var p=e.childComponent,m=function(e,t,n){return t!==e?null:n>t?"down":n<t?"up":null}(f,s,u);return i().createElement(p,Object.assign({},e.childProps,{ref:n,style:d,dragListeners:c,dragAttributes:l,dragDirection:m}))}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 yi(){yi=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==vi(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(vi(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function gi(e){return function(e){if(Array.isArray(e))return Ei(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wi(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 bi(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||wi(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 wi(e,t){if(e){if("string"==typeof e)return Ei(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)?Ei(e,t):void 0}}function Ei(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 Si=function(e){var t=e.interaction,n=j.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:C.vn.Handle})),i().createElement(L,{interaction:t,iconClassName:"".concat("GSE1a"," ").concat(n),questionClassName:"".concat("qKMzc"," clamp-1")}))}));return i().createElement(hi,{id:t.id,childComponent:r,childProps:{}})},ki=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(pi,{ids:t.map((function(e){return e.id})),getDragOverlay:function(e){return i().createElement(Si,{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(Si,{key:e.id,interaction:e})}))))};function xi(e){var t=bi(i().useState(!1),2),n=t[0],r=t[1],o=bi(i().useState(gi(e.interactions)),2),a=o[0],c=o[1],l=bi(i().useState(!1),2),s=l[0],u=l[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(ki,{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(gi(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(gi(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(Pe.Spinner,{as:"span",animation:"border",role:"status",size:"sm"})):i().createElement(k.L,{className:"btn btn-dark ".concat(s?"":"disabled"),onClick:function(){return t=this,n=void 0,i=void 0,o=yi().mark((function t(){return yi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){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)})),new(i||(i=Promise))((function(e,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function c(e){try{l(o.throw(e))}catch(e){r(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o}},"Save")))}function Oi(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ci(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)?Ci(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 Ci(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 Ni(e){var t=e.isCreate,n=e.interaction,r=e.mode,o=e.immediateFeedback,a=e.interactionState,c=e.shouldFocus,l=e.delayFocus,s=e.open,u=e.timepoint,f=e.userUpdateInteractionState,d=e.submitInteractionAnswer,p=e.saveInteraction,m=e.skip,h=i().useRef(),v=i().useRef(),y=i().useRef(0),g=(0,bn.a)(gn.r.XLDown),b=!t||g;function w(){return!!h.current&&!!c&&!!s}function E(){h.current&&(h.current.focus(),x(!0))}var S=Oi(i().useState(!1),2),k=S[0],x=S[1];i().useEffect((function(){w()&&(k||(l&&b?y.current=window.setTimeout((function(){y.current=0,w()&&E()}),400):E()))}),[h.current,k]);var O=Oi(i().useState("question"),2),C=O[0],N=O[1],j=i().useMemo((function(){return(0,Ie.oD)()}),[]),P=n?function(e,t){if(t===M.Create)return function(e){return $r[e]}(e);if(t===M.View)return function(e){return zt[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(Cn,Object.assign({optionsPortalNode:j,setView:N},e)),i().createElement(Je.Z,{className:"h-100",ref:v},i().createElement(xn,Object.assign({},e)),!!n&&i().createElement("div",{className:"d-flex flex-column h-100"},i().createElement(Gn,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 h-100"},i().createElement("div",{ref:h,tabIndex:0}),i().createElement(P,Object.assign({state:a,setState:f,recalculateScroll:function(){v.current.recalculate()},showFeedback:I,optionsPortalNode:j},e)))),i().createElement(Pn,Object.assign({onClickSkip:function(){y.current&&window.clearTimeout(y.current),m()}},e))),"move"===C&&i().createElement(li,Object.assign({back:function(){return N("question")}},e)),"reorder"===C&&i().createElement(xi,Object.assign({back:function(){return N("question")},interactions:u.interactions},e)))))}function ji(e){var t=e.open,n=e.nextInteraction,r=e.nextInteractionState,o=e.timepointState,a=e.interaction,c=e.delayFocus,l=e.experimentalInteractiveQuestions,s=i().useMemo((function(){return(0,Ie.oD)({attributes:{class:"cv-interactive-lhs"}})}),[]),u=i().useMemo((function(){return(0,Ie.oD)({attributes:{class:"cv-interactive-full"}})}),[]),f=n&&o.nextInteractionIndex<o.interactionIndex,d=n&&o.nextInteractionIndex>o.interactionIndex,p=d&&o.slideIn,m=f&&o.slideIn,h=t&&!f&&!d;return i().createElement(i().Fragment,null,i().createElement("div",{className:"cv-interactive-full-container ".concat(h?"":"cv-closed-full")},i().createElement(Ie.t0,{node:u})),i().createElement("div",{className:"cv-interactive-lhs-container ".concat(h?"":"cv-closed-lhs")},i().createElement(Ie.t0,{node:s})),i().createElement("div",{className:"cv-interactive ".concat(t?"cv-open":"")},f&&i().createElement("div",{className:"cv-prev-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(Ni,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r}))),i().createElement("div",{className:"\n cv-main-slide\n ".concat(p?"cv-slide-out-up":"","\n ").concat(m?"cv-slide-out-down":"","\n ").concat(n?"cv-transitioning":"","\n ")},i().createElement(Ni,Object.assign({key:null==a?void 0:a.id},e,{currentIndex:o.interactionIndex,shouldFocus:a&&!f&&!d,delayFocus:c,leftHandSidePortalNode:s,fullWidthPortalNode:u,experimentalInteractiveQuestions:l}))),d&&i().createElement("div",{className:"cv-next-interaction ".concat(o.slideIn?"cv-slide-in":"")},i().createElement(Ni,Object.assign({},e,{currentIndex:o.nextInteractionIndex,interaction:n,interactionState:r})))))}function Pi(e){return Pi="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},Pi(e)}function Ii(e,t,n){return(t=function(e){var t=function(e){if("object"!=Pi(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pi(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Li={interactions:{},timepoints:{}};function Ti(e,t){return"interaction"===t.type?{timepoints:e.timepoints,interactions:Object.assign(Object.assign({},e.interactions),Ii({},t.id,t.value))}:"timepoint"===t.type?{interactions:e.interactions,timepoints:Object.assign(Object.assign({},e.timepoints),Ii({},t.id,t.value))}: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={interactionIndex:0},Fi=function(e){var t,n,r=e.mode,o=e.timepoint,a=e.latestSession,c=r===M.Create,l=i().useReducer(Ti,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]),Ii(Ii({},t.actionableItemId,t.data),"submitted",!0)),e}),{})}:Li}(a)})),s=(n=2,function(e){if(Array.isArray(e))return e}(t=l)||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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(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}}(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=s[0],f=s[1],d=y(null==o?void 0:o.id),p=null==o?void 0:o.interactions[d.interactionIndex],m="number"==typeof d.nextInteractionIndex?null==o?void 0:o.interactions[d.nextInteractionIndex]:null,h=g(null==p?void 0:p.id),v=g(null==m?void 0:m.id);function y(e){return e&&u.timepoints[e]||_i}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:h,timepointState:d,nextInteraction:m,nextInteractionState:v,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 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(){Ri=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Di(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Di(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var Mi=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Ui=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},Vi=!1;function Bi(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qi(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)?qi(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 qi(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 Gi=n(25417),Zi=n(81937),zi=n(69184);function Hi(e,t){if(e){if("string"==typeof e)return Wi(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)?Wi(e,t):void 0}}function Wi(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 Qi=Ye.T.encloseNamespace("shared.hooks"),Yi=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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||Hi(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=hr.Radio.channel(Gi.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(q.Q.Vy.LOCK_NAV),o([].concat(function(e){return function(e){if(Array.isArray(e))return Wi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Hi(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 l(e){var t=r.filter((function(t){return t.id!==e}));0!==t.length&&t.find((function(e){return!e.allowAppLinks}))||a.trigger(q.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(q.Q.Vy.UNLOCK_NAV),void window.setTimeout((function(){q.Q.C$.trigger(e),a.trigger(q.Q.Vy.LOCK_NAV)}),0);s.q.isFunction(n.renderCustomDialog)?n.renderCustomDialog():bt(i().createElement("p",null,n.text),{title:n.title,submitButtonProps:{onClick:function(){n.onConfirmUnlock&&n.onConfirmUnlock(),function(e){a.trigger(q.Q.Vy.NAV_UNLOCKED_BY_USER),r.forEach((function(e){e.allowAppLinks||l(e.id)})),window.removeEventListener("beforeunload",f),q.Q.C$.trigger(e)}(e)},variant:"danger",text:Qi("discard")},cancelButtonProps:{text:Qi("cancel"),variant:"link"}})}}function f(e){var t=r.find((function(e){return e.allowAppLinks}));return t||(t=ze.m.first(r)),e.returnValue=t.text,t.text}return i().useEffect((function(){return r.find((function(e){return!e.allowAppLinks}))&&a.on(q.Q.Vy.NAV_IS_LOCKED,u),r.length&&window.addEventListener("beforeunload",f),function(){a.off(q.Q.Vy.NAV_IS_LOCKED,u),window.removeEventListener("beforeunload",f)}}),[r]),i().useEffect((function(){function e(){c({id:"upload",title:Qi("navLockTitle"),text:Qi("navLockBody"),allowAppLinks:!0})}var t=hr.Radio.channel(zi.Q4.VIDEO_UPLOAD);return t.on(Zi.S.FILES_ADDED,e),t.on(Zi.S.UNLOCK_NAV,l),function(){t.off(Zi.S.FILES_ADDED,e),t.off(Zi.S.UNLOCK_NAV,l)}}),[]),{lock:c,unlock:l}};function Ki(e){return Ki="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},Ki(e)}function $i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xi(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 Ji(e,t,n){return t&&Xi(e.prototype,t),n&&Xi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function eo(e){var t=function(e){if("object"!=Ki(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ki(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ki(t)?t:t+""}function to(e,t,n){return t=io(t),function(e,t){if(t&&("object"==Ki(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,no()?Reflect.construct(t,n||[],io(e).constructor):t.apply(e,n))}function no(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(no=function(){return!!e})()}function ro(){return ro="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=io(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}},ro.apply(null,arguments)}function io(e){return io=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},io(e)}function oo(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&&ao(e,t)}function ao(e,t){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ao(e,t)}var co=function(e){function t(e,n){return $i(this,t),to(this,t,[e,n])}return oo(t,e),Ji(t,[{key:"dispose",value:function(){var e,n,r,i=this;setImmediate((function(){var e;null===(e=i.root)||void 0===e||e.unmount()})),(e=t,n=this,"function"==typeof(r=ro(io(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}}])}(oe.Z.getComponent("Component")),lo={tagName:"div"};function so(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lo;if(!e)throw new Error("componentCtor is required");var n=function(n){function r(){return $i(this,r),to(this,r,arguments)}return oo(r,n),Ji(r,[{key:"createEl",value:function(){var n=oe.Z.dom.createEl(t.tagName,t.properties,t.attributes),r=(0,vt.s)(n);return r.render(e(this.player_,this.options_)),this.root=r,n}}])}(co);return n}var uo=n(42120),fo=n(50028);function po(e){var t,n=!e.parentVideo||(null===(t=e.parentVideo)||void 0===t?void 0:t.status)===fo.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:C.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(Ie.Nq,{node:e.portalNode},i().createElement(uo.e,{actions:o,actionsDropdownClassName:"btn btn-outline-dark ms-2"})):i().createElement(i().Fragment,null)}var mo=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 ho(e){var t=e.title,n=e.player,r=e.track,o=e.mode,a=e.interactive,c=e.imageApi,l=e.actionsPortalNode,s=e.questionListPortalNode,u=e.summaryPortalNode,f=e.resultsService,p=e.currentUser,m=e.progress,h=e.latestSession,v=e.clipOffset,y=e.analyticsService,g=e.enableImmersiveReader,b=e.mobile,w=e.parentVideo,E=e.experimentalInteractiveQuestions,S=function(e){var t=e.player,n=e.track,r=e.interactive,o=e.clipOffset,a=Bi(i().useState(!1),2),c=a[0],l=a[1],s=Bi(i().useState(!1),2),u=s[0],f=s[1],d=Bi(i().useState(null),2),p=d[0],m=d[1];function h(e){return o?e+o:e}function v(e){f(!!e&&c),l(e)}function y(){var e=n.activeCues;if(!e.length)return v(!1),void m(null);var i=r.timepoints.find((function(t){return t.id.toString()===e[0].text.toString()}));if(!i)return v(!1),void m(null);i.shouldPause&&(t.seeking()?t.one("play",(function(){return t.pause()})):t.pause()),v(!0),m(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:v,wasOpen:u,timepoint:p,continueInteractive:function(){v(!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:h(r)-.001,endTime:h(r+1),text:e}),n.trigger("cv:cuechange"),t.paused()&&n.trigger("cuechange")},removeCue:function(e){e=h(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=h(i),r.endTime=h(i+1),t.currentTime(i+.5,!0),p.visibleAt=e,n.trigger("cv:cuechange")}},getClipOffset:h}}({player:n,track:r,interactive:a,mode:o,clipOffset:v}),k=S.open,x=S.timepoint,O=S.wasOpen,C=mo(S,["open","timepoint","wasOpen"]),N=function(e){var t=e.interactive,n=e.timepoint,r=e.player,o=e.mode,a=e.resultsService,c=e.latestSession,l=e.analyticsService,s=e.imageApi,u=Ui(e,["interactive","timepoint","player","mode","resultsService","latestSession","analyticsService","imageApi"]),f=Fi({mode:o,timepoint:n,latestSession:c}),p=f.state,m=f.interaction,h=f.interactionState,v=f.timepointState,y=f.nextInteraction,g=f.nextInteractionState,b=Ui(f,["state","interaction","interactionState","timepointState","nextInteraction","nextInteractionState"]),w=o===M.Create;function E(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 S(e){var n=j.w.getTypeInfo(e.typeId);return{id:nn(e.id)?void 0:e.id,typeId:e.typeId,type:n.typeName,interactiveId:t.id,timepointId:nn(e.timepointId)?void 0:e.timepointId,order:e.order}}function k(e){return Mi(this,void 0,void 0,Ri().mark((function n(){var r,i,o,a,c,s,f;return Ri().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=E(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=S(i),nn(i.id)){n.next=10;break}return n.next=7,nr.deleteInteraction(i.id);case 7:null==l||l.logUserAction(a,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Complete}),n.next=11;break;case 10:null==l||l.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),b.clearInteractionState(i.id),s=b.getTimepointState(o.id),c<s.interactionIndex&&b.updateTimepointState(o.id,{interactionIndex:s.interactionIndex-1}),!(o.interactions.length>0)){n.next=18;break}return n.abrupt("return");case 18:if(nn(o.id)){n.next=21;break}return n.next=21,nr.deleteTimepoint(o.id);case 21:f=t.timepoints.findIndex((function(e){return e.id===o.id})),t.timepoints.splice(f,1),u.removeCue(o.visibleAt/1e3),b.clearTimepointState(o.id);case 25:case"end":return n.stop()}}),n)})))}function x(e){if(m){var t=nn(m.id);t||(null==h?void 0:h.hasChanges)||(null==v?void 0:v.hasChanges)?bt(i().createElement("p",null,"Do you want to discard your changes?"),{title:"Unsaved changes",submitButtonProps:{onClick:function(){(null==v?void 0:v.hasChanges)&&I(!0),t?k(m.id):b.clearInteractionState(m.id),e&&e()},variant:"danger",text:"Discard"},cancelButtonProps:{variant:"link",text:"Cancel"}}):e&&e()}else e&&e()}function O(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(w)x((function(){b.updateTimepointState(n.id,{interactionIndex:e})}));else{var r=function(){b.updateTimepointState(n.id,{nextInteractionIndex:e}),window.requestAnimationFrame((function(){b.updateTimepointState(n.id,{nextInteractionIndex:e,slideIn:!0}),window.setTimeout((function(){b.updateTimepointState(n.id,{interactionIndex:e,nextInteractionIndex:null,slideIn:null})}),400)}))};t?x(r):r()}}function C(){v.interactionIndex+1>=n.interactions.length?u.continueInteractive():O(v.interactionIndex+1,!1)}function N(){t.timepoints.sort((function(e,t){return e.visibleAt>t.visibleAt?1:t.visibleAt>e.visibleAt?-1:0}))}function P(){O(n.interactions.length)}function I(e){(null==v?void 0:v.hasChanges)&&(e&&u.moveTimepoint(v.originalVisibleAt),b.updateTimepointState(n.id,{hasChanges:void 0,originalVisibleAt:void 0}),Vi=!1)}return{state:p,interaction:m,interactionState:h,timepointState:v,nextInteraction:y,nextInteractionState:g,skip:C,cancel:function(){return Mi(this,void 0,void 0,Ri().mark((function e(){return Ri().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null==h?void 0:h.hasChanges)){e.next=3;break}return x(),e.abrupt("return");case 3:return e.next=5,k(m.id);case 5:u.setOpen(!0);case 6:case"end":return e.stop()}}),e)})))},addAnotherQuestion:P,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),b.updateTimepointState(i.id,{interactionIndex:i.interactions.indexOf(o)})},discardChanges:x,changeIndex:O,promptDelete:function(e){var t=S(E(e).localInteraction);null==l||l.logUserAction(t,{actionType:d.Vw.Delete,entity:d.py.Interaction,workflowPhase:d.eu.Start}),bt(i().createElement("p",null,"Are you sure you want to delete this question?"),{title:"Delete question",submitButtonProps:{onClick:function(){return k(e)},variant:"danger",text:"Delete question"},cancelButtonProps:{variant:"link",text:"Cancel"}})},showTypeSelector:function(){r.pause(),u.setOpen(!0),n&&P()},cancelTypeSelector:function(){n?O(v.interactionIndex-1):(u.setOpen(!1),r.play())},deleteInteraction:k,saveInteraction:function(){return Mi(this,void 0,void 0,Ri().mark((function e(){var t,r,i,o,a,c,s;return Ri().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(w){e.next=2;break}throw new Error("Should not be calling onClickSave while viewing an interactive");case 2:if(f=m.typeId,t=Xr[f],!(r=t(b.getInteractionState(m.id),m))){e.next=7;break}return b.updateInteractionState(m.id,{error:r}),e.abrupt("return");case 7:if(b.updateInteractionState(m.id,{spinner:!0}),!nn(n.id)){e.next=15;break}return i=n.id,e.next=12,nr.saveTimepoint(n);case 12:u.updateCue(i,n.id),b.clearTimepointState(i),(null==v?void 0:v.hasChanges)&&(N(),I());case 15:return m.timepointId=n.id,o=m.id,a=ei(m.typeId),e.next=20,a(b.getInteractionState(m.id),m);case 20:b.clearInteractionState(o),c=nn(o),s=S(m),null==l||l.logUserAction(s,{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=S(a);if(null==l||l.logUserAction(c,{actionType:d.Vw.Create,entity:d.py.Interaction,workflowPhase:d.eu.Start}),n)return n.interactions.push(a),void O(v.interactionIndex);var s=r.currentTime();t.timepoints||(t.timepoints=[]),t.timepoints.push({id:o,visibleAt:1e3*s,interactiveId:t.id,shouldPause:1,interactions:[a]}),N(),u.addCue(o)},submitInteractionAnswer:function(){return Mi(this,void 0,void 0,Ri().mark((function e(){var r,i,c,f,p,y;return Ri().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o===M.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 u.continueInteractive(),e.abrupt("return");case 6:return O(v.interactionIndex+1),e.abrupt("return");case 8:if(r=rn(h),g=m.typeId,i=Wt[g],!(c=i(r,m))){e.next=14;break}return b.updateInteractionState(m.id,{error:c}),e.abrupt("return");case 14:if(f={},!a||!h.hasChanges){e.next=27;break}if(p=Yt(m.typeId),b.updateInteractionState(m.id,{spinner:!0}),!p){e.next=27;break}return e.next=21,p(r,m,a.save,{imageApi:s});case 21:if(e.t0=e.sent,e.t0){e.next=24;break}e.t0={};case 24:f=e.t0,y=S(m),null==l||l.logUserAction(y,{actionType:d.Vw.Submit,entity:d.py.Interaction});case 27:if(b.updateInteractionState(m.id,Object.assign(Object.assign({},f),{submitted:!0,error:null,hasChanges:!1,spinner:!1})),t.immediateFeedback){e.next=31;break}return C(),e.abrupt("return");case 31:Zt(m.typeId)(m)||C();case 34:case"end":return e.stop()}var g}),e)})))},userUpdateInteractionState:b.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;Vi||(Vi=!0,b.updateTimepointState(n.id,{originalVisibleAt:a,hasChanges:!0})),u.moveTimepoint(o)}},saveTimepoint:function(){return Mi(this,void 0,void 0,Ri().mark((function e(){return Ri().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!nn(n.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,nr.updateTimepoint(n);case 4:N(),I();case 6:case"end":return e.stop()}}),e)})))},clearTimepointTimeState:I,reOrderQuestions:function(e){return Mi(this,void 0,void 0,Ri().mark((function t(){var r,i;return Ri().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,nr.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,b.updateTimepointState(n.id,{interactionIndex:e.indexOf(i)});case 10:case"end":return t.stop()}}),t)})))}}}(Object.assign({mode:o,interactive:a,timepoint:x,player:n,resultsService:f,latestSession:h,analyticsService:y,imageApi:c},C)),P=N.interaction,I=N.interactionState,L=N.nextInteraction,T=N.nextInteractionState,A=N.timepointState,_=N.state,F=mo(N,["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,l=e.interactionState,s=e.timepointState,u=Yi(),f=n===M.Create;i().useEffect((function(){if(f){if(nn(null==a?void 0:a.id)||(null==l?void 0:l.hasChanges)||(null==s?void 0:s.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==l?void 0:l.hasChanges,null===(t=null==o?void 0:o.interactions)||void 0===t?void 0:t.length,null==s?void 0:s.hasChanges])}({mode:o,player:n,timepoint:x,interaction:P,discardChanges:F.discardChanges,interactionState:I,timepointState:A});var D={mode:o,open:k,isCreate:o===M.Create,interaction:P,nextInteraction:L,timepoint:x,interactive:a,interactionState:I,nextInteractionState:T,timepointState:A,player:n};return i().createElement(i().Fragment,null,!!l&&i().createElement(po,{interactive:a,onClickEditDetails:e.onClickEditDetails,onClickPublish:e.onClickPublish,onClickDelete:e.onClickDelete,onClickCopy:e.onClickCopy,portalNode:l,parentVideo:w}),i().createElement(Ne,Object.assign({},D,F)),i().createElement(ji,Object.assign({imageApi:c,currentUser:p,immediateFeedback:a.immediateFeedback,delayFocus:!O,enableImmersiveReader:g,experimentalInteractiveQuestions:E},D,F,C)),i().createElement(pn,Object.assign({title:t,currentUser:p,state:_,portalNode:u,progress:m,resultsService:f,imageCdnUrl:c.toString(),onShowSummary:e.onShowSummary,mobile:b},D,F)),i().createElement(yn,Object.assign({portalNode:s,experimentalInteractiveQuestions:E},D,F)))}oe.Z.registerComponent("Interactive",so((function(e,t){return i().createElement(ho,Object.assign({player:e},t))})));function vo(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(yt.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(gt.u,{className:"kw8gW"},i().createElement(gt.u.Cancel,{text:"Start again",onClick:function(){e.continue(!1),n()}}),i().createElement(gt.u.Submit,{variant:"dark",text:"Continue",onClick:r})))}function yo(e){return yo="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},yo(e)}function go(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,bo(r.key),r)}}function bo(e){var t=function(e){if("object"!=yo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=yo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yo(t)?t:t+""}function wo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(wo=function(){return!!e})()}function Eo(e){return Eo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Eo(e)}function So(e,t){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},So(e,t)}oe.Z.registerComponent("ContinueSession",so((function(e,t){return i().createElement(vo,Object.assign({player:e},t))})));var ko=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=function(e,t,n){return t=Eo(t),function(e,t){if(t&&("object"==yo(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,wo()?Reflect.construct(t,n||[],Eo(e).constructor):t.apply(e,n))}(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),"*")}}])&&go(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getPlugin("plugin"));function xo(e){return xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xo(e)}function Oo(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,Co(r.key),r)}}function Co(e){var t=function(e){if("object"!=xo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xo(t)?t:t+""}function No(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(No=function(){return!!e})()}function jo(e){return jo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jo(e)}function Po(e,t){return Po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Po(e,t)}oe.Z.registerPlugin("gradePassbackPlugin",ko);var Io=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=function(e,t,n){return t=jo(t),function(e,t){if(t&&("object"==xo(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,No()?Reflect.construct(t,n||[],jo(e).constructor):t.apply(e,n))}(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&&Po(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this;this.player.gradePassbackPlugin(),Oe.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||M.View,latestSession:this.continueSession&&this.options.latestSession})),this.player.controlBar.getChild("progressControl").getChild("SeekBar").addChild(new xe(this.player,{interactive:this.options.interactive,track:e}))}}])&&Oo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getPlugin("plugin"));function Lo(e){return Lo="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},Lo(e)}function To(){To=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Lo(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Lo(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ao(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(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,Fo(r.key),r)}}function Fo(e){var t=function(e){if("object"!=Lo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Lo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lo(t)?t:t+""}function Do(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Do=function(){return!!e})()}function Ro(e,t,n,r){var i=Mo(Uo(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Mo(){return Mo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Uo(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}},Mo.apply(null,arguments)}function Uo(e){return Uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Uo(e)}function Vo(e,t){return Vo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vo(e,t)}oe.Z.registerPlugin("viewInteractivePlugin",Io),n(51976);var Bo=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=function(e,t,n){return t=Uo(t),function(e,t){if(t&&("object"==Lo(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,Do()?Reflect.construct(t,n||[],Uo(e).constructor):t.apply(e,n))}(this,t,[e,n])).totalProgress=[],K.e.setToken("gateway",r.options.authToken),r.options.mode===M.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&&Vo(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=Ro(t,"getPlayerOptions",this,3)([]);return e.setMaxHeight=!1,this.options.embed||(e.aspectRatio="16:9"),e}},{key:"onFlushProgress",value:function(e){var n;Ro(t,"onFlushProgress",this,3)([e]),this.options.mode!==M.Create&&(n=this.totalProgress).push.apply(n,function(e){return function(e){if(Array.isArray(e))return Ao(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 Ao(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)?Ao(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 Ro(t,"additionalSetup",a,1)}}});return n=this,r=void 0,i=void 0,o=To().mark((function t(){return To().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{l(o.next(e))}catch(e){t(e)}}function c(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,c)}l((o=o.apply(n,r||[])).next())}))}},{key:"setupAnalyticsDependentPlugins",value:function(e){Ro(t,"setupAnalyticsDependentPlugins",this,3)([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():Ro(t,"handleAutoplay",this,3)([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===M.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:"filterNewQuestionTypes",value:function(e){var t;return Object.assign(Object.assign({},e),{timepoints:null===(t=e.timepoints)||void 0===t?void 0:t.map((function(e){var t;return Object.assign(Object.assign({},e),{interactions:null===(t=e.interactions)||void 0===t?void 0:t.filter((function(e){return!O.IL[e.typeId]}))})})).filter((function(e){var t;return!!(null===(t=e.interactions)||void 0===t?void 0:t.length)}))})}},{key:"validateCollectResultsOptions",value:function(){var e=!!this.options.publicName&&!!this.options.profileId;this.options.currentUser||e||q.Q.Ry.throw(new re.H("Must provide a currentUser or PublicName and ProfileId in order to collect interactive results")),this.options.shareId||q.Q.Ry.throw(new re.H("Must provide a shareId in order to collect interactive results"))}},{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;this.options.experimentalInteractiveQuestions||(n=this.filterNewQuestionTypes(n));var r=null===(t=e.additionalData.clipData)||void 0===t?void 0:t.startTime;this.options.collectResults&&(this.validateCollectResultsOptions(),this.resultsService=new ne({interactiveId:n.id,metadataId:e.mediaId,userId:this.options.currentUser.id,customerId:this.options.currentUser.customerId,playerApi:this.options.playerApi,shareId:this.options.shareId,publicName:this.options.publicName,profileId:this.options.profileId})),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,experimentalInteractiveQuestions:this.options.experimentalInteractiveQuestions})}},{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&&_o(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ie.r);function qo(e){return new Proxy(e,{get:function(e,t,n){if("off"===t||!e.isDisposed())return Reflect.get(e,t,n)}})}var Go=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 Zo(e){var t=e.onReady,n=e.className,r=Go(e,["onReady","className"]),o=i().useRef();return i().useEffect((function(){var e=new Bo(o.current,r);return t&&e.ready((function(){t(qo(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 zo={placeholder:"YUoDl"};function Ho(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 Wo(){return i().createElement("div",{className:"".concat(zo.placeholder," partial-loading-background")})}function Qo(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Ho(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)?Ho(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(Zo,{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(Wo,null)}var Yo=n(82602),Ko={avatarContainer:"hwnEk",comment:"LyFKD"},$o="libraryRequests.comments",Xo=Ye.T.encloseNamespace($o);function Jo(e){var t,n,r,o,a,c,l=e.comment,s="".concat(null===(t=l.user)||void 0===t?void 0:t.name," ").concat(null===(n=l.user)||void 0===n?void 0:n.surname);return l.user||(s=Xo("deletedUser")),i().createElement("div",{className:"d-flex ".concat(Ko.comment)},i().createElement("div",{className:"".concat(Ko.avatarContainer," me-2 flex-shrink-0")},i().createElement(_e.q,{imageUrl:null===(o=null===(r=l.user)||void 0===r?void 0:r.avatar)||void 0===o?void 0:o.url,imageCdnUrl:e.imageCdnUrl,initials:Qe.l.getInitials(null===(a=l.user)||void 0===a?void 0:a.name,null===(c=l.user)||void 0===c?void 0:c.surname)})),i().createElement("div",null,i().createElement("span",{className:"fw-bold pe-2"},s),i().createElement("span",{className:"text-secondary"},(0,Yo.WU)(l.dateCreated)),i().createElement("p",{className:"mb-0"},l.message)))}function ea(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:$o,phrase:"comments"})),i().createElement("div",{className:"border rounded p-2"},e.comments.map((function(t,n){return i().createElement(Jo,{key:n,comment:t,imageCdnUrl:e.imageCdnUrl})})))):i().createElement(i().Fragment,null)}var ta=n(10657),na=n(41087),ra=n(98496),ia=n(50997),oa=n(89707),aa={seriesLink:"Z5BW7"};function ca(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 la(e){var t,n,r,o,a,c,l,s,u,f,d,p,m,h,v=e.libraryRequest.object;return i().createElement("div",{className:"row"},((null==v?void 0:v.name)||e.libraryRequest.name)&&i().createElement(g,{phrase:"title"},(null==v?void 0:v.name)||e.libraryRequest.name),!!v&&i().createElement(i().Fragment,null,!!v.series&&i().createElement(g,{phrase:"series"},i().createElement("a",{target:"_blank",href:(p=v.series,m=e.config,h="series/".concat(p.id),oa.k.getMainProductUrl(m,h,h)),className:"".concat(aa.seriesLink," text-reset")},v.series.name,i().createElement(ra.Q,{video:v,withSeriesTitle:!0}))),!!(null===(t=v.rating)||void 0===t?void 0:t.code)&&i().createElement(g,{phrase:"rating"},i().createElement("div",{className:"d-flex"},i().createElement(na.C,{type:na.g.Rating,data:v.rating}))),!!v.description&&i().createElement(g,{phrase:"description"},i().createElement("span",{className:"pre-wrap"},v.description)),!!v.productionYear&&i().createElement(g,{phrase:"productionYear"},v.productionYear),!!(null===(r=null===(n=v.producers)||void 0===n?void 0:n.data)||void 0===r?void 0:r.length)&&i().createElement(g,{phrase:"producers"},i().createElement(ca,{items:v.producers})),!!(null===(a=null===(o=v.directors)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)&&i().createElement(g,{phrase:"directors"},i().createElement(ca,{items:v.directors})),!!(null===(l=null===(c=v.productionCompanies)||void 0===c?void 0:c.data)||void 0===l?void 0:l.length)&&i().createElement(g,{phrase:"productionCompanies"},i().createElement(ca,{items:v.productionCompanies})),!!(null===(u=null===(s=v.distributors)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)&&i().createElement(g,{phrase:"distributors"},i().createElement(ca,{items:v.distributors})),!e.hideBroadcastInfo&&!!(null===(f=v.channel)||void 0===f?void 0:f.name)&&i().createElement(g,{phrase:"channel"},null===(d=v.channel)||void 0===d?void 0:d.name),!e.hideBroadcastInfo&&!!v.dateBroadcast&&i().createElement(g,{phrase:"broadcastDate"},ta.O.format(v.dateBroadcast,ia.K4.FULL_YEAR))))}var sa,ua,fa=n(87860),da=n(33937);function pa(e){return pa="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},pa(e)}function ma(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){if("object"!=pa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pa(t)?t:t+""}!function(e){e.AppleTv="apple-tv",e.Vivi="vivi"}(sa||(sa={})),function(e){e.Available="available",e.Offline="offline",e.Busy="busy"}(ua||(ua={}));var va=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)}}])&&ma(t.prototype,n),r&&ma(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function ya(e){return ya="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},ya(e)}function ga(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ba(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,Ea(r.key),r)}}function wa(e,t,n){return t&&ba(e.prototype,t),n&&ba(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ea(e){var t=function(e){if("object"!=ya(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ya(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ya(t)?t:t+""}Symbol.toStringTag;var Sa=function(){return wa((function e(){ga(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()?va.reject(new Error("This EventChannel instance has been disposed")):new va(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}}])}(),ka=function(){return wa((function e(){ga(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",xa.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 Sa),this.channels[e]}}])}(),xa={void:void 0};function Oa(e){return Oa="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},Oa(e)}function Ca(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,Na(r.key),r)}}function Na(e){var t=function(e){if("object"!=Oa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Oa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Oa(t)?t:t+""}var ja,Pa,Ia,La=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}}])&&Ca(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),Ta=n(90244),Aa=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)}})},_a=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 Fa(e){return Fa="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},Fa(e)}function Da(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,Ma(r.key),r)}}function Ra(e,t,n){return t&&Da(e.prototype,t),n&&Da(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ma(e){var t=function(e){if("object"!=Fa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fa(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"}(ja||(ja={})),function(e){e[e.PlaybackStatusChange=0]="PlaybackStatusChange",e[e.PositionChange=1]="PositionChange"}(Pa||(Pa={})),function(e){e.Begin="BEGIN",e.Play="PLAY",e.Pause="PAUSE",e.Load="LOAD",e.Scan="SCAN",e.Stop="STOP"}(Ia||(Ia={}));var Ua=Ra((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=Ia.Load,this.debounced=Aa(this,2e3),_a(this)}));function Va(e){return Va="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},Va(e)}function Ba(){Ba=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Va(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Va(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function qa(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){if("object"!=Va(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Va(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Va(t)?t:t+""}function Za(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Za=function(){return!!e})()}function za(){return za="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Ha(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}},za.apply(null,arguments)}function Ha(e){return Ha=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ha(e)}function Wa(e,t){return Wa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wa(e,t)}var Qa=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=function(e,t,n){return t=Ha(t),function(e,t){if(t&&("object"==Va(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,Za()?Reflect.construct(t,n||[],Ha(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new Ua(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&&Wa(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(){var e,n,r;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)})),(e=t,n=this,"function"==typeof(r=za(Ha(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{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 Pa.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case Pa.PositionChange:this.handlePositionChange(t,e)}}}},{key:"handlePlaybackChange",value:function(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",xa.void),e.playbackStatus===Ia.Stop&&this.dispose())}},{key:"handlePositionChange",value:function(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger("positionchange",xa.void))}},{key:"loadSource",value:function(){return e=this,t=void 0,n=void 0,r=Ba().mark((function e(){return Ba().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",xa.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{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}},{key:"play",value:function(){this.localState.locked&&this.localState.playbackStatus!==Ia.Play&&(this.localState.playbackStatus=Ia.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",xa.void))}},{key:"pause",value:function(){this.localState.locked&&this.localState.playbackStatus!==Ia.Pause&&(this.localState.playbackStatus=Ia.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",xa.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",xa.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===Ia.Play||this.localState.playbackStatus===Ia.Begin||this.localState.playbackStatus===Ia.Load}},{key:"isPlaybackFinished",value:function(){return this.localState.playbackStatus===Ia.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}}],r&&qa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ka);function Ya(e){return Ya="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},Ya(e)}function Ka(){Ka=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Ya(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Ya(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function $a(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 Xa(e){var t=function(e){if("object"!=Ya(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ya(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ya(t)?t:t+""}function Ja(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ja=function(){return!!e})()}function ec(){return ec="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}},ec.apply(null,arguments)}function tc(e){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tc(e)}function nc(e,t){return nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nc(e,t)}var rc,ic,oc,ac=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((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"}(rc||(rc={})),function(e){e.Command="Command",e.Pair="Pair",e.Unpair="Unpair",e.RenameDevice="Renamedevice",e.Subscribe="Subscribe",e.Lock="Lock"}(ic||(ic={})),function(e){e[e.Connecting=0]="Connecting",e[e.Connected=1]="Connected",e[e.Reconnecting=2]="Reconnecting",e[e.Disconnected=4]="Disconnected"}(oc||(oc={}));var cc=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=function(e,t,n){return t=tc(t),function(e,t){if(t&&("object"==Ya(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,Ja()?Reflect.construct(t,n||[],tc(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken=void 0,n.devices=[],n.heartbeat=new La,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&&nc(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,Ta.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 ac(this,void 0,void 0,Ka().mark((function e(){return Ka().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,da.OB)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy("DeviceUserHub"),this.hubProxy.on(rc.DeviceList,this.handleDeviceList),this.hubProxy.on(rc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.on(rc.Paired,this.handleDevicePaired),this.hubProxy.on(rc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.on(rc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.on(rc.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 ac(this,void 0,void 0,Ka().mark((function e(){var t=this;return Ka().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 ac(this,void 0,void 0,Ka().mark((function t(){return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.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 ac(this,void 0,void 0,Ka().mark((function e(){return Ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection.state===oc.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 ac(this,void 0,void 0,Ka().mark((function t(){var r,i=this;return Ka().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",va.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",xa.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",xa.void))}},{key:"handleDevicePaired",value:function(e){"vivi"!==e.type&&(this.devices.push(t.convertToGenericDevice(e)),this.trigger("deviceschange",xa.void))}},{key:"handleDeviceUnpaired",value:function(e){this.devices=this.devices.filter((function(t){return t.id!==e})),this.trigger("deviceschange",xa.void)}},{key:"handlePlayStatusChange",value:function(e,t){this.trigger("message",{event:Pa.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}},{key:"handleTimeSync",value:function(e,t){this.trigger("message",{event:Pa.PositionChange,deviceId:e,params:{position:t}})}},{key:"dispose",value:function(){var e,n,r;this.hubProxy.off(rc.DeviceList,this.handleDeviceList),this.hubProxy.off(rc.DeviceStateChange,this.handleDeviceStateChange),this.hubProxy.off(rc.Paired,this.handleDevicePaired),this.hubProxy.off(rc.Unpaired,this.handleDeviceUnpaired),this.hubProxy.off(rc.PlayStatusChange,this.handlePlayStatusChange),this.hubProxy.off(rc.TimeSync,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),(e=t,n=this,"function"==typeof(r=ec(tc(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"canCastToDevice",value:function(e){return e===sa.AppleTv}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new Qa(this,e)}},{key:"lock",value:function(e){var t;return ac(this,void 0,void 0,Ka().mark((function n(){return Ka().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.invoke(ic.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 ac(this,void 0,void 0,Ka().mark((function t(){return Ka().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(ic.Command,{DeviceId:e,CommandType:Ia.Play,Data:this.options.trackingCode});case 4:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(e){return ac(this,void 0,void 0,Ka().mark((function t(){return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.Command,{DeviceId:e,CommandType:Ia.Play});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return ac(this,void 0,void 0,Ka().mark((function t(){return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.Command,{DeviceId:e,CommandType:Ia.Pause});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"seek",value:function(e,t){this.invokeDebounced(ic.Command,{DeviceId:e,CommandType:Ia.Play,Params:"1,".concat(Math.trunc(t))})}},{key:"stop",value:function(e){return ac(this,void 0,void 0,Ka().mark((function t(){return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.Command,{DeviceId:e,CommandType:Ia.Stop});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"pair",value:function(e){return ac(this,void 0,void 0,Ka().mark((function t(){var n;return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.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 ac(this,void 0,void 0,Ka().mark((function t(){return Ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.invoke(ic.Unpair,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"renameDevice",value:function(e){var t=e.deviceId,n=e.deviceName;return ac(this,void 0,void 0,Ka().mark((function e(){return Ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.invoke(ic.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 ja.Online:return ua.Available;case ja.Locked:return ua.Busy;case ja.Suspended:case ja.Offline:return ua.Offline}}},{key:"convertToGenericDevice",value:function(e){return{id:e.deviceId,name:e.name,type:sa.AppleTv,status:t.convertToGenericDeviceStatus(e.status)}}}],r&&$a(n.prototype,r),i&&$a(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ka);function lc(e){return lc="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},lc(e)}function sc(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,uc(r.key),r)}}function uc(e){var t=function(e){if("object"!=lc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=lc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lc(t)?t:t+""}var fc={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:""},dc=function(){return e=function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fc;!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({},fc),r),this.webSocket=this.connect(),this.heartbeat=(new La).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()}}])&&sc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),pc=n(27993);function mc(e){return mc="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},mc(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){if("object"!=mc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=mc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==mc(t)?t:t+""}var yc,gc=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=Aa(this,2e3),_a(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}}])&&hc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();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(){wc=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==bc(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(bc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Ec(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sc(r.key),r)}}function Sc(e){var t=function(e){if("object"!=bc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bc(t)?t:t+""}function kc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(kc=function(){return!!e})()}function xc(){return xc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Oc(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}},xc.apply(null,arguments)}function Oc(e){return Oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Oc(e)}function Cc(e,t){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cc(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"}(yc||(yc={}));var Nc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},jc=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=function(e,t,n){return t=Oc(t),function(e,t){if(t&&("object"==bc(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,kc()?Reflect.construct(t,n||[],Oc(e).constructor):t.apply(e,n))}(this,t)).client=e,r.localState=new gc(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&&Cc(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(){var e,n,r;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)})),(e=t,n=this,"function"==typeof(r=xc(Oc(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{key:"handleClientConnected",value:function(){return Nc(this,void 0,void 0,wc().mark((function e(){return wc().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 yc.Update:this.handleUpdateMessage(t,n);break;case yc.NewChapter:this.handleNewChapterMessage(t,n);break;case yc.Volume:this.handleVolumeMessage(t,n);break;case yc.Playing:this.handlePlayingMessage(t);break;case yc.Paused:this.handlePausedMessage(t);break;case yc.Finished:this.handleFinishedMessage(t);break;case yc.Stopped:this.handleStoppedMessage()}}},{key:"handleUpdateMessage",value:function(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger("durationchange",xa.void)),e.position!==t.position&&(e.position=t.position,this.trigger("positionchange",xa.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger("subtitleschange",xa.void))}},{key:"handleVolumeMessage",value:function(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=0===t.level,this.trigger("volumechange",xa.void))}},{key:"handlePlayingMessage",value:function(e){!0!==e.playing&&(e.playing=!0,e.playbackFinished=!1,this.trigger("playingchange",xa.void))}},{key:"handlePausedMessage",value:function(e){!1!==e.playing&&(e.playing=!1,this.trigger("playingchange",xa.void))}},{key:"handleFinishedMessage",value:function(e){!0!==e.playbackFinished&&(e.playing=!1,e.playbackFinished=!0,this.trigger("playingchange",xa.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",xa.void))}},{key:"handleStoppedMessage",value:function(){this.dispose()}},{key:"loadSource",value:function(e,t){return Nc(this,void 0,void 0,wc().mark((function n(){var r,i;return wc().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",xa.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",xa.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",xa.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",xa.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",xa.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",xa.void))}},{key:"setSubtitles",value:function(e){return Nc(this,void 0,void 0,wc().mark((function t(){var n;return wc().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",xa.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}}],r&&Ec(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ka);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 Ic(){Ic=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",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=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",m="executing",h="completed",v={};function y(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(L([])));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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(i,o,a,c){var l=f(e[i],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==Pc(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){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(l.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===m)throw Error("Generator is already running");if(i===h){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var s=f(t,n,r);if("normal"===s.type){if(i=r.done?h:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(i=h,r.method="throw",r.arg=s.arg)}}}function N(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,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(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(j,this),this.reset(!0)}function L(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(Pc(t)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"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,s(e,l,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},x(O.prototype),s(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),s(k,l,"Generator"),s(k,a,(function(){return this})),s(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=L,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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!s)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,v):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),v},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),v}},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:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Lc(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,Tc(r.key),r)}}function Tc(e){var t=function(e){if("object"!=Pc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pc(t)?t:t+""}function Ac(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ac=function(){return!!e})()}function _c(){return _c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Fc(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}},_c.apply(null,arguments)}function Fc(e){return Fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Fc(e)}function Dc(e,t){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dc(e,t)}var Rc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function c(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}l((r=r.apply(e,t||[])).next())}))},Mc=1e4,Uc=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=function(e,t,n){return t=Fc(t),function(e,t){if(t&&("object"==Pc(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,Ac()?Reflect.construct(t,n||[],Fc(e).constructor):t.apply(e,n))}(this,t)).options=e,n.accessToken="",n.devices=[],n.devicesFingerprint="",n.deviceDiscovery=new La,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&&Dc(e,t)}(t,e),n=t,r=[{key:"bindFunctions",value:function(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=(0,Ta.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 dc(this.options.url),this.webSocket.onMessage=function(t){return e.trigger("message",JSON.parse(t.data))},this.webSocket.onOpen=function(){return Rc(e,void 0,void 0,Ic().mark((function e(){return Ic().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",xa.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 Rc(e,void 0,void 0,Ic().mark((function e(){var n,r,i,o;return Ic().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:i=new Set(n.map((function(e){var t;return null!==(t=e.organisation)&&void 0!==t?t:""}))).size,o=new Set(n.map((function(e){var t;return null!==(t=e.location)&&void 0!==t?t:""}))).size,this.devices=n.map((function(e){return{id:e.id,name:e.name,schoolName:i>1?e.organisation:"",description:o>1?e.location:"",type:sa.Vivi,status:ua.Available}})),this.devicesFingerprint=r,this.trigger("deviceschange",xa.void),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(0),console.warn(e.t0);case 17:case"end":return e.stop()}}),e,this,[[0,14]])})))})).trigger().start()}},{key:"dispose",value:function(){var e,n,r,i;this.deviceDiscovery.stop(),null===(e=this.webSocket)||void 0===e||e.dipose(),(n=t,r=this,"function"==typeof(i=_c(Fc(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}},{key:"canCastToDevice",value:function(e){return e===sa.Vivi}},{key:"getDevices",value:function(){return this.devices}},{key:"startCastSession",value:function(e){return new jc(this,e)}},{key:"authenticateWithVivi",value:function(){return Rc(this,void 0,void 0,Ic().mark((function e(){return Ic().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(Mc).catch((function(){throw new Error("Failed to authenticate with Vivi")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomList",value:function(){return Rc(this,void 0,void 0,Ic().mark((function e(){var t;return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function t(){return Ic().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(Mc).catch((function(){throw new Error("Failed to join room")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"query",value:function(e){return Rc(this,void 0,void 0,Ic().mark((function n(){var r;return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function e(){return Ic().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(Mc).catch((function(){throw new Error("Failed to load media")}));case 3:case"end":return e.stop()}}),e,this)})))}},{key:"play",value:function(e){return Rc(this,void 0,void 0,Ic().mark((function t(){return Ic().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(Mc).catch((function(){throw new Error("Failed to play video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"pause",value:function(e){return Rc(this,void 0,void 0,Ic().mark((function t(){return Ic().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(Mc).catch((function(){throw new Error("Failed to pause video")}));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"stop",value:function(e){return Rc(this,void 0,void 0,Ic().mark((function t(){return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function n(){return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function n(){return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function n(){return Ic().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(Mc).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 Rc(this,void 0,void 0,Ic().mark((function r(){var i;return Ic().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(Mc).catch((function(){throw new Error("Failed to set subtitles")}));case 4:case"end":return r.stop()}}),r,this)})))}}],i=[{key:"createAckId",value:function(){return pc.x.generateRandomId()}},{key:"calculateFingerprint",value:function(e){return e.map((function(e){return e.id})).sort().join(",")}}],r&&Lc(n.prototype,r),i&&Lc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ka);function Vc(e){return Vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vc(e)}function Bc(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 Gc(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,Zc(r.key),r)}}function Zc(e){var t=function(e){if("object"!=Vc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Vc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vc(t)?t:t+""}function zc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(zc=function(){return!!e})()}function Hc(){return Hc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Wc(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}},Hc.apply(null,arguments)}function Wc(e){return Wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Wc(e)}function Qc(e,t){return Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qc(e,t)}var Yc=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=function(e,t,n){return t=Wc(t),function(e,t){if(t&&("object"==Vc(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,zc()?Reflect.construct(t,n||[],Wc(e).constructor):t.apply(e,n))}(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&&Qc(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(Bc(e),Bc(t))}),[]);this.trigger("deviceschange",e)}},{key:"dispose",value:function(){var e,n,r,i;null===(e=this.castSession)||void 0===e||e.dispose(),this.clients.forEach((function(e){return e.dispose()})),this.castSession=void 0,this.clients=[],(n=t,r=this,"function"==typeof(i=Hc(Wc(1&3?n.prototype:n),"dispose",r))?function(e){return i.apply(r,e)}:i)([])}}],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&&Gc(n.prototype,r),i&&Gc(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(ka);Yc.instances={};var Kc=n(12424),$c=n(4579);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 Jc(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,el(r.key),r)}}function el(e){var t=function(e){if("object"!=Xc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Xc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xc(t)?t:t+""}function tl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(tl=function(){return!!e})()}function nl(e,t,n,r){var i=rl(il(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function rl(){return rl="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}},rl.apply(null,arguments)}function il(e){return il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},il(e)}function ol(e,t){return ol=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ol(e,t)}var al=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=function(e,t,n){return t=il(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,tl()?Reflect.construct(t,n||[],il(e).constructor):t.apply(e,n))}(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&&ol(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e,n;return nl(t,"createEl",this,3)(["li",{className:"vjs-menu-item cv-device-menu-item",innerHTML:'\n <div class="cv-device-menu-item-body">\n <span class="cv-device-icon '.concat({vivi:"cv-vivi-icon","apple-tv":"cv-apple-icon"}[this.options_.type],'"></span>\n <div>\n <span class="vjs-menu-item-text">').concat(this.options_.label,'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text">').concat(null!==(e=this.options_.schoolName)&&void 0!==e?e:"",'</span>\n <span class="vjs-menu-item-text cv-device-truncated-text cv-device-description">').concat(null!==(n=this.options_.description)&&void 0!==n?n:"","</span>\n </div>\n </div>\n ")}])}},{key:"handleClick",value:function(){this.options_.onClick()}},{key:"show",value:function(){nl(t,"show",this,3)([])}},{key:"hide",value:function(){nl(t,"hide",this,3)([])}},{key:"isVisible",value:function(){return!nl(t,"hasClass",this,3)(["vjs-hidden"])}}])&&Jc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("MenuItem")),cl=n(86777);function ll(e){return ll="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},ll(e)}function sl(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,ul(r.key),r)}}function ul(e){var t=function(e){if("object"!=ll(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ll(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ll(t)?t:t+""}function fl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fl=function(){return!!e})()}function dl(e){return dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dl(e)}function pl(e,t){return pl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pl(e,t)}var ml=oe.Z.getComponent("Menu"),hl=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=dl(t),function(e,t){if(t&&("object"==ll(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,fl()?Reflect.construct(t,n||[],dl(e).constructor):t.apply(e,n))}(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&&pl(e,t)}(t,e),n=t,(r=[{key:"createEl",value:function(){var e=ml.originalProto.createEl.apply(this),t=this.contentEl_;return this.contentWrapper=oe.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 cl.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"))}}])&&sl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ml);function vl(e){var t=e.inactiveIntegrations,n=e.canUserManageIntegrations,i=e.player,o=e.onDismiss,a=e.onInstall,c=e.onLearnMore,l=e.onContactSupport;if(0===t.length)return r.createElement(r.Fragment,null);var s,u=function(e){return i.localize(e)},f=function(e){return-1!==t.indexOf(e)};return s=f(sa.AppleTv)&&f(sa.Vivi)?"vivi_and_apple_tv":f(sa.Vivi)?"vivi":"apple_tv",r.createElement("div",{className:"cv-devices-cta",tabIndex:-1},r.createElement(yl,{context:s,localize:u,onDismiss:function(){return o(s)}}),r.createElement(gl,{context:s}),r.createElement(bl,{context:s,canUserManageIntegrations:n,localize:u,onContactSupport:function(){return l(s)},onInstall:function(){return a(s)},onLearnMore:function(){return c(s)}}))}function yl(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 gl(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 bl(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 wl(e){return wl="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},wl(e)}function El(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,Sl(r.key),r)}}function Sl(e){var t=function(e){if("object"!=wl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=wl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wl(t)?t:t+""}function kl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(kl=function(){return!!e})()}function xl(e,t,n,r){var i=Ol(Cl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Ol(){return Ol="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Cl(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}},Ol.apply(null,arguments)}function Cl(e){return Cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Cl(e)}function Nl(e,t){return Nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Nl(e,t)}oe.Z.registerComponent("DevicesMenu",hl),oe.Z.registerComponent("DevicesCta",so((function(e,t){return r.createElement(vl,Object.assign({player:e},t))}),{properties:{className:"cv-devices-cta-wrapper"}}));var jl=oe.Z.getComponent("DevicesCta"),Pl=oe.Z.getComponent("MenuButton"),Il=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=function(e,t,n){return t=Cl(t),function(e,t){if(t&&("object"==wl(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,kl()?Reflect.construct(t,n||[],Cl(e).constructor):t.apply(e,n))}(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&&Nl(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=Pl.prototype.createEl).apply.apply(e,[this].concat(n))}},{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-devices-button ".concat(xl(t,"buildWrapperCSSClass",this,3)([]))}},{key:"createMenu",value:function(){var e=this,t=new hl(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 jl(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 Kc.Z(this.player_,{label:this.localize("Select a device"),selectable:!1}),this.searchInputItem=new $c.Z(this.player_,{menuButton:this,search:function(t){return e.setSearchText(t)},className:"cv-devices-search-input"}),this.emptyPlaceholder=new $c.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;xl(t,"pressButton",this,3)([]),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 al}))}},{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){var n,r,i,o,a="".concat(e.type).concat(null!==(n=e.schoolName)&&void 0!==n?n:"").concat(null!==(r=e.description)&&void 0!==r?r:"").concat(e.name),c="".concat(t.type).concat(null!==(i=t.schoolName)&&void 0!==i?i:"").concat(null!==(o=t.description)&&void 0!==o?o:"").concat(t.name);return a.localeCompare(c)})).forEach((function(e){var n=new al(t.player(),{id:e.id,label:e.name,schoolName:e.schoolName,description:e.description,selected:!1,multiSelectable:!1,selectable:!0,available:e.status===ua.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,a,c=e.devices.find((function(e){return e.id===t.options_.id}));if(c){var l=c.status===ua.Available,s=c.id===(null===(i=e.castSession)||void 0===i?void 0:i.getDevice().id),u=!n||-1!=="".concat(c.name," ").concat(null!==(o=c.schoolName)&&void 0!==o?o:""," ").concat(null!==(a=c.description)&&void 0!==a?a:"").trim().toLowerCase().indexOf(r);l?t.enable():t.disable(),u?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(){xl(t,"handleClick",this,3)([null]),this.options_.onClick()}}],r&&El(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Pl);function Ll(e){return Ll="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},Ll(e)}function Tl(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){if("object"!=Ll(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ll(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ll(t)?t:t+""}function _l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_l=function(){return!!e})()}function Fl(){return Fl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Dl(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}},Fl.apply(null,arguments)}function Dl(e){return Dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dl(e)}function Rl(e,t){return Rl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Rl(e,t)}Il.prototype.controlText_="Devices",oe.Z.registerComponent("DevicesButton",Il);var Ml=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),function(e,t,n){return t=Dl(t),function(e,t){if(t&&("object"==Ll(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,_l()?Reflect.construct(t,n||[],Dl(e).constructor):t.apply(e,n))}(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&&Rl(e,t)}(t,e),n=t,r=[{key:"createEl",value:function(){return(e=t,n=this,"function"==typeof(r=Fl(Dl(1&3?e.prototype:e),"createEl",n))?function(e){return r.apply(n,e)}:r)(["div",{className:"cv-devices-tech"}]);var e,n,r}},{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:sa.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(){}}],r&&Tl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("Component"));function Ul(e){return Ul="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},Ul(e)}function Vl(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,Bl(r.key),r)}}function Bl(e){var t=function(e){if("object"!=Ul(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ul(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ul(t)?t:t+""}function ql(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ql=function(){return!!e})()}function Gl(e,t,n,r){var i=Zl(zl(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function Zl(){return Zl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=zl(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}},Zl.apply(null,arguments)}function zl(e){return zl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zl(e)}function Hl(e,t){return Hl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hl(e,t)}var Wl=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=function(e,t,n){return t=zl(t),function(e,t){if(t&&("object"==Ul(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,ql()?Reflect.construct(t,n||[],zl(e).constructor):t.apply(e,n))}(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,oe.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&&Hl(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 Oe.O.findTrackByPredicate(this.videojsPlayer.player_,(function(e){return"showing"===e.mode&&!!e.src}))}},{key:"setSelectedTextTrack",value:function(e){Oe.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(),Gl(t,"cleanupAutoTextTracks",this,3)([]),Gl(t,"dispose",this,3)([])}},{key:"createEl",value:function(){var e=this;return this.ui=this.ui||new Ml({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 Gl(t,"addRemoteTextTrack",this,3)([e,!0])}},{key:"getCastSession",value:function(){var e;return Yc.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 oe.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!!Yc.getOrCreateInstance(null!==(n=null==t?void 0:t.instanceId)&&void 0!==n?n:"").getCastSession()}},{key:"isSupported",value:function(){return Yc.isActive()}}],r&&Vl(n.prototype,r),i&&Vl(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(oe.Z.getComponent("Tech"));function Ql(e){return Ql="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},Ql(e)}function Yl(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,Kl(r.key),r)}}function Kl(e){var t=function(e){if("object"!=Ql(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ql(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ql(t)?t:t+""}function $l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return($l=function(){return!!e})()}function Xl(){return Xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Jl(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}},Xl.apply(null,arguments)}function Jl(e){return Jl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Jl(e)}function es(e,t){return es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},es(e,t)}oe.Z.registerTech("devices",Wl);var ts=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=function(e,t,n){return t=Jl(t),function(e,t){if(t&&("object"==Ql(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,$l()?Reflect.construct(t,n||[],Jl(e).constructor):t.apply(e,n))}(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&&es(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,l=[];this.options.appleTv.enabled||l.push(sa.AppleTv),c.enabled&&c.accountConnected||l.push(sa.Vivi);var s={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:l})};this.devicesButton=t.addChild("DevicesButton",s,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(sa.AppleTv)),this.player.removeClass("cv-device-".concat(sa.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(Uc)){var t=new Uc({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(cc)){var t=new cc({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 Yc.getOrCreateInstance(this.instanceId)}},{key:"dispose",value:function(){var e,n,r,i=this.getSessionManager();i&&(i.off("deviceschange",this.onDevicesChanged),i.off("castsessionchange",this.onCastSessionChanged),i.off("error",this.onDevicesError),Yc.disposeAndRemoveInstance(i),(e=t,n=this,"function"==typeof(r=Xl(Jl(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([]))}}],r&&Yl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getPlugin("plugin"));function ns(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 rs(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,i)||function(e,t){if(e){if("string"==typeof e)return ns(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)?ns(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],l=a[1];function s(){var t=e.player.duration()-e.player.currentTime();l(t),t>o.current&&(o.current=t)}if(r.useEffect((function(){return e.player.on("timeupdate",s),function(){e.player.off("timeupdate",s)}}),[]),!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 is(e){return is="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},is(e)}function os(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,as(r.key),r)}}function as(e){var t=function(e){if("object"!=is(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=is(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==is(t)?t:t+""}function cs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(cs=function(){return!!e})()}function ls(){return ls="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ss(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}},ls.apply(null,arguments)}function ss(e){return ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ss(e)}function us(e,t){return us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},us(e,t)}oe.Z.registerPlugin("devicesPlugin",ts),oe.Z.registerComponent("UpNext",so((function(e,t){return r.createElement(rs,Object.assign({player:e},t))})));var fs=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=function(e,t,n){return t=ss(t),function(e,t){if(t&&("object"==is(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,cs()?Reflect.construct(t,n||[],ss(e).constructor):t.apply(e,n))}(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&&us(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,oe.Z.dom.addClass(this.toggleEl,"on"),this.player_.nextVideoPlugin().setShouldPlayNext(this.playNext,!0)}},{key:"toggleOff",value:function(){this.playNext=!1,oe.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=oe.Z.dom.createEl("div",{className:"custom-toggle custom-toggle-info toggle-option float-end",innerHTML:'<span class="handle"></span></div>'}),this.toggleEl.addEventListener("click",this.handleToggle);var i,o,a,c=(i=t,o=this,"function"==typeof(a=ls(ss(1&3?i.prototype:i),"createEl",o))?function(e){return a.apply(o,e)}:a)([e,{className:"vjs-menu-item cv-cog-menu-item cv-play-next-toggle",innerHTML:'\n <span class="vjs-menu-item-text">Play next video</span>\n <span class="cv-toggle-container"></span>'},r]);return c.children[1].appendChild(this.toggleEl),c}}],r&&os(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("MenuItem"));function ds(e){return ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(e)}function ps(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,ms(r.key),r)}}function ms(e){var t=function(e){if("object"!=ds(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ds(t)?t:t+""}function hs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(hs=function(){return!!e})()}function vs(){return vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ys(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}},vs.apply(null,arguments)}function ys(e){return ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ys(e)}function gs(e,t){return gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},gs(e,t)}oe.Z.registerComponent("NextVideoMenuItem",fs);var bs="cv-persisttest",ws="cv-play-next-video",Es=oe.Z.getPlugin("plugin"),Ss=(oe.Z.getComponent("MenuItem"),oe.Z.getComponent("NextVideoMenuItem")),ks=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=function(e,t,n){return t=ys(t),function(e,t){if(t&&("object"==ds(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,hs()?Reflect.construct(t,n||[],ys(e).constructor):t.apply(e,n))}(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(ws);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&&gs(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.player.isDisposed()||this.bindListeners()}},{key:"getChapterTrack",value:function(){return Oe.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:Ss,name:"NextVideoMenuItem"})}},{key:"getShouldPlayNext",value:function(){return this.shouldPlayNextVideo}},{key:"setShouldPlayNext",value:function(e,t){this.shouldPlayNextVideo=e,this.hasLocalStorage&&t&&window.localStorage.setItem(ws,e.toString())}},{key:"bindListeners",value:function(){this.player.on("timeupdate",this.onTimeUpdate)}},{key:"dispose",value:function(){var e,n,r;this.player.off("timeupdate",this.onTimeUpdate),this.hideUpNext(),(e=t,n=this,"function"==typeof(r=vs(ys(1&3?e.prototype:e),"dispose",n))?function(e){return r.apply(n,e)}:r)([])}},{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(bs,"persistPlayNext"),window.localStorage.removeItem(bs),!0}catch(e){return!1}}}],r&&ps(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Es);oe.Z.registerPlugin("nextVideoPlugin",ks);var xs=n(52765),Os=n(75390),Cs=n(86257),Ns=n(87013),js=n(38e3),Ps={width:200,resizeType:Ae.Nq.Cover};function Is(e){var t;return js.G.isResource(e)?e.metadata.type===Cs.L.Pdf||(null===(t=e.pdf)||void 0===t?void 0:t.url)?Ae.__.Pdf:Ae.__.Thumbnails:Ae.__.Link}function Ls(e){var t,n,r,o=null,a=0;js.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]:Ps,a=Is(t);if("thumbnail"in t&&(null===(n=t.thumbnail)||void 0===n?void 0:n.url))return Ns.j.createUrl(null===(r=t.thumbnail)||void 0===r?void 0:r.url,Object.assign({},o));var c=Os._.safeUrlConcat(e,"/v1/previews");return js.G.isResource(t)?a===Ae.__.Pdf?t.metadata.type===Cs.L.Pdf?Ns.j.createResourceImage(c,t.url,Object.assign({},o)):Ns.j.createResourceImage(c,null===(i=t.pdf)||void 0===i?void 0:i.url,Object.assign({},o)):t.metadata.type!==Cs.L.Zip?Ns.j.createUrl(t.url,{size:Ae.h2.Medium,resizeType:Ae.Nq.Cover}):"/images/zip-resource.png":Ns.j.createResourceImage(c,t.url,Object.assign({},o))}(e.imageCdnUrl,e.resource,e.dynamicRatioImageOptions);return i().createElement(Te.Z,{data:c,imageType:Is(e.resource),imageStyle:{transform:"rotate(".concat(a,"deg)")},alt:e.resource.name,errorFallbackImageSrc:e.imageErrorFallbackUrl,errorFallbackImageClassName:"Xy4zX",imageClassName:(null==o?void 0:o.type)===Cs.L.Image?"".concat("z4O5p"," ").concat("FFgf3"):"",preload:e.preloadImage,preventLoad:!e.preloadImage})}var Ts=n(96461),As=n(43803),_s=n(74421),Fs=n(13799);function Ds(e){var t,n,r,o,a=null;"metadata"in e.data&&(a=e.data.metadata);var c=js.G.isType(e.data,_s.E.Resource);return i().createElement(i().Fragment,null,i().createElement("div",{className:"OnJDH"},i().createElement("div",{className:"CIFy7"},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"X39wU";case"student-activity":return"X9pMl";case"teacher-pack":return"_tdVE";case"additional-materials":return"qRVUo";default:return"_18JaV"}}(t)," ").concat("oUZPD");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("xRYhX")),r}(null==a?void 0:a.resourceType)},"above"===e.titlePosition&&i().createElement(_r.u,{title:e.data.name},i().createElement("h3",{className:"text-center text-break h5 mb-3 ".concat("g5NWS")},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("EDiGi"," ").concat("above"===e.titlePosition?"e9ejn":""," \n ").concat("I9E5O","\n ")},i().createElement(Ls,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})),c&&e.onClickDownload&&"normal"===e.actionBehaviour&&i().createElement("div",{className:"jzGAm"},i().createElement(k.L,{onClick:function(t){return e.onClickDownload(t,e.data)},className:"".concat("fbb_e"," d-flex align-items-center justify-content-center")},i().createElement(x.x,{svgName:C.vn.Download}))),!e.hideTypeBadge&&c&&i().createElement(As.y,{typeId:_s.E.Resource})))),"below"===e.titlePosition&&i().createElement("div",{className:"mt-1 ".concat("Cpjs3")},js.G.isType(e.data,_s.E.Resource)&&!!(null===(o=null===(r=e.data)||void 0===r?void 0:r.metadata)||void 0===o?void 0:o.resourceType)&&i().createElement(Ts.m,null,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"}}(e.data.metadata.resourceType)),i().createElement("h3",{className:"h6 clamp-2"},e.data.name)))}function Rs(e){return Rs="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},Rs(e)}function Ms(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,Us(r.key),r)}}function Us(e){var t=function(e){if("object"!=Rs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Rs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rs(t)?t:t+""}function Vs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vs=function(){return!!e})()}function Bs(e){return Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bs(e)}function qs(e,t){return qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qs(e,t)}function Gs(e){return i().createElement("div",{className:"cv-resource-item"},i().createElement(Ds,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:"above",hideTypeBadge:!0}))}Ds.defaultProps={preloadImage:!0,actionBehaviour:"normal"},i().memo((function(e){var t,n,r,o,a=(t=e.data,n=e.actionBehaviour,o=i().useContext(Fs.X),"public"===n||!o.xs&&!o.sm&&"resource"===t.type&&"metadata"in t&&(t.metadata.type===Cs.L.Image||(t.metadata.type===Cs.L.Pdf?!!t.url:!!(null===(r=t.pdf)||void 0===r?void 0:r.url)))),c=Object.assign(Object.assign({},e.analyticsData),e.data),l=Object.assign(Object.assign({},e.analyticsOptions),{actionType:d.Vw.Click,entity:e.data.typeId===_s.E.Resource?d.py.Resource:d.py.Link});function s(){Fn.k.logUserAction(c,l)}var u,f=Object.assign(Object.assign({},e),{applyHoverState:a||!!e.data.url});return i().createElement("div",{className:"px-1 flex-shrink-0 ".concat("tqUFn"," ").concat("play-page"===e.location?"V2RwX":"o7j7p"," ").concat("resource-item")},(u="d-block no-decoration","link"===e.data.type?i().createElement("a",{href:e.data.url,target:"_blank",className:u,onClick:s},i().createElement(Ds,Object.assign({},f))):a?"public"===e.actionBehaviour?i().createElement("div",{className:"".concat(u," cursor-pointer d-inline"),onClick:function(){s(),xs.C$.trigger(e.getAppLink(e.data))}},i().createElement(Ds,Object.assign({},f))):i().createElement(N.F,{appLink:e.getAppLink(e.data),className:u,analyticsData:c,analyticsOptions:l},i().createElement(Ds,Object.assign({},f))):e.data.url?i().createElement("a",{href:e.data.url,className:u,onClick:s},i().createElement(Ds,Object.assign({},f))):i().createElement("div",{className:u},i().createElement(Ds,Object.assign({},f)))))}));var Zs=so((function(e,t){return i().createElement(Gs,Object.assign({},t))})),zs=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=function(e,t,n){return t=Bs(t),function(e,t){if(t&&("object"==Rs(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,Vs()?Reflect.construct(t,n||[],Bs(e).constructor):t.apply(e,n))}(this,t,[e,n]);var i=new Zs(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&&qs(e,t)}(t,e),n=t,(r=[{key:"handleClick",value:function(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}}])&&Ms(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("MenuItem"));function Hs(e){return Hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hs(e)}function Ws(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){if("object"!=Hs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Hs(t)?t:t+""}function Ys(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ys=function(){return!!e})()}function Ks(e,t,n,r){var i=$s(Xs(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}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=Xs(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 Xs(e){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xs(e)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Js(e,t)}var eu=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=function(e,t,n){return t=Xs(t),function(e,t){if(t&&("object"==Hs(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,Ys()?Reflect.construct(t,n||[],Xs(e).constructor):t.apply(e,n))}(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&&Js(e,t)}(t,e),n=t,(r=[{key:"buildWrapperCSSClass",value:function(){return"cv-menu-small cv-resources-button-wrapper ".concat(Ks(t,"buildWrapperCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){return"cv-resources-button ".concat(Ks(t,"buildCSSClass",this,3)([]))}},{key:"update",value:function(){Ks(t,"update",this,3)([])}},{key:"createItems",value:function(){var e=this,t=[];return t.push(new Kc.Z(this.player_,{label:"Resources"})),this.options_.resources.forEach((function(n){var r=new zs(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:xs.Ab.PageLoad(e.url,!0)}},{key:"getDownloadIframe",value:function(){return this.downloadIframe||(this.downloadIframe=oe.Z.dom.createEl("iframe"),this.downloadIframe.style.display="none",oe.Z.dom.appendContent(oe.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(){Ks(t,"handleClick",this,3)([null])}}])&&Ws(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getComponent("MenuButton"));function tu(e){return tu="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},tu(e)}function nu(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,ru(r.key),r)}}function ru(e){var t=function(e){if("object"!=tu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=tu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tu(t)?t:t+""}function iu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(iu=function(){return!!e})()}function ou(e){return ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ou(e)}function au(e,t){return au=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},au(e,t)}eu.prototype.controlText_="Resources",oe.Z.registerComponent("ResourcesButton",eu);var cu=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=function(e,t,n){return t=ou(t),function(e,t){if(t&&("object"==tu(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,iu()?Reflect.construct(t,n||[],ou(e).constructor):t.apply(e,n))}(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&&au(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)}}}])&&nu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(oe.Z.getPlugin("plugin"));oe.Z.registerPlugin("resourcesPlugin",cu);var lu=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 su(e){var t=e.className,n=void 0===t?"":t,r=e.playerApi,o=e.onReady,a=e.onDispose,c=lu(e,["className","playerApi","onReady","onDispose"]),l=i().useRef();return i().useEffect((function(){if(l){var e=new fa.J(l.current,Object.assign(Object.assign({},c),{playerApi:r}));return o&&e.ready((function(){o(qo(e))})),a&&e.one("dispose",a),function(){null==e||e.dispose()}}}),[e.viewKey]),i().createElement("div",{ref:l,className:n})}var uu={placeholder:"JemW5"};function fu(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 du(){return i().createElement("div",{className:"".concat(uu.placeholder," partial-loading-background")})}function pu(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fu(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)?fu(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(su,{playerApi:new URL(e.config.get("playerApiUrl")),viewKey:o})):i().createElement(du,null)}var mu="libraryRequests.info";function hu(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(ea,{comments:e.comments,imageCdnUrl:e.config.get("imageCdnUrl")}),i().createElement("h2",{className:"h5"},i().createElement(o.x,{namespace:mu,phrase:"videoDetails"})),t&&i().createElement(i().Fragment,null,i().createElement(h,{video:e.libraryRequest.object,user:e.user,createViewKey:e.createViewKey,config:e.config}),i().createElement(la,{libraryRequest:e.libraryRequest,hideBroadcastInfo:e.user.get("instanceRegion")===a.b.US,config:e.config})),n&&i().createElement(i().Fragment,null,i().createElement(Qo,{video:e.libraryRequest.object,currentUser:e.currentUser,createViewKey:e.createViewKey,config:e.config}),i().createElement(B,{libraryRequest:e.libraryRequest})),r&&i().createElement(i().Fragment,null,i().createElement(pu,{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"}}))))}},27789:function(e,t,n){"use strict";n.d(t,{q:function(){return St}});var r=n(1024),i=n.n(r),o=n(42648),a=n(82602),c=n(70868),l=n(70065),s=n(49642),u=n(99910),f=n(64038),d=n(39396),p=n(63791),m={container:"VwD1b",spinner:"eJ85e"};function h(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 v(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return h(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)?h(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(m.container),ref:o},e.isFetching?r.createElement(u.Spinner,{as:"span",animation:"border",role:"status",className:m.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)}}))}v.defaultProps={fetchOnScroll:!1};var y=n(66703),g=n(85887),b=n(41087),w=n(44550),E=n(57857),S=n(53808),k=n(58424),x=n(2491),O=n(37360),C=n(40221),N=n(12927),j={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!!C.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&&!O.V.isTabletOrMobile()&&!j.isFavouritedByCurrentUser(e))}},P={favourited:"t0svX",favouriteButton:"CFRo3",heart:"ZMMQu",heartOutline:"truFo"};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}var L=E.T.encloseNamespace("shared.favouriteButton");function T(e){var t,n,i=(0,x.Z)(),o=j.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||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}}(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],l=a[1];r.useEffect((function(){l(o)}),[o]);var s="".concat("d-flex align-items-center justify-content-center"," cursor-pointer ").concat(P.favouriteButton," ").concat(c?P.favourited:"");return e.className&&(s+=" ".concat(e.className)),S.q.isFunction(e.setFavourite)&&S.q.isFunction(e.canFavourite)&&e.canFavourite(e.video)?r.createElement(k.L,{className:s,onClick:function(){var t=!c;l(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")),l(!t)}),e.analyticsData,e.analyticsOptions)},tabIndex:e.preventFocus?-1:void 0},r.createElement(d.x,{svgName:p.vn.Heart,className:"svg-container ".concat(P.heart)}),r.createElement(d.x,{svgName:p.vn.HeartOutline,className:"svg-container ".concat(P.heartOutline)})):r.createElement(r.Fragment,null)}var A,_,F,D=n(49619),R=n(24828),M=n(22231),U={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 V(e){var t,n=e.type,i=e.mediaType,o=e.extraClasses,a=e.containerClassSize;if(n===A.Video)return r.createElement("div",{className:"".concat(U.videoFallback," ").concat(e.extraClasses," bg-light-blue")});if(n===A.Folder)return r.createElement("div",{className:"".concat(U.folderFallback," ").concat(e.extraClasses," ").concat((0,M.x)(e.name,R.o))});var c=function(e){return e===A.SeriesThumbnail?U.seriesItemFallback:e===A.PlaylistThumbnail?U.playlistItemFallback:e===A.Playlist?U.playlistFallback:e===A.Series||e===A.TallSubject?U.posterFallback:e===A.Subject?"".concat(U.subjectFallback," svg-container d-inline-block"):""}(n),l=function(e){return e===A.SeriesThumbnail||e===A.PlaylistThumbnail?p.vn.Play:e===A.Playlist?p.vn.Image:e===A.Series?p.vn.Series:e===A.Subject||e===A.TallSubject?p.vn.FileImg:""}(n),s=function(e){return e===A.Subject?d.S.ExtraLarge:d.S.Standard}(n),u="".concat(function(e,t,n){if(t===A.Subject){var r=n===F.Large?U.subjectFallbackContainerLarge:U.subjectFallbackContainerSmall;return"".concat(U.subjectFallbackContainer," ").concat(r)}return e===_.Svg?t===A.SeriesThumbnail||t===A.PlaylistThumbnail?"".concat(U.svgFallbackContainer," rounded-3"):U.svgFallbackContainer:U.baseFallbackContainer}(i,n,a));return o&&(u+=" ".concat(e.extraClasses)),r.createElement("div",{className:u},i===_.Svg?r.createElement(d.x,{svgName:l,className:"".concat(c," ").concat(null!==(t=e.svgContainerClassName)&&void 0!==t?t:""),tagName:"div",size:s}):r.createElement("div",{className:U.fallbackThumbnailImage,style:{backgroundImage:"url('".concat(l,"')")}}))}function B(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"}(A||(A={})),function(e){e[e.Svg=0]="Svg",e[e.Image=1]="Image"}(_||(_={})),function(e){e[e.Large=0]="Large",e[e.Small=1]="Small"}(F||(F={})),V.defaultProps={mediaType:_.Svg,containerClassSize:F.Large};var q={bottomBar:"YnXtZ"};function G(e){return N.M.isVideo(e.video)?i().createElement("div",{className:q.bottomBar},i().createElement(B,{video:e.video})):i().createElement(i().Fragment,null)}var Z=n(38182),z=n(63946),H="d-inline-block svg-container",W="span";function Q(e){var t=e.children,n=e.className,i=void 0===n?H:n,o=e.tagName,a=void 0===o?W:o,c=e.size,l=void 0===c?d.S.Standard:c,s=e.onClick,u=e.title,f=e.tooltipPlacement,p=void 0===f?"right":f,m=a,h={className:"".concat(i," svg-container ").concat(l),onClick:S.q.isFunction(s)?s:null};return u?r.createElement(z.u,{title:u,placement:p},r.createElement(m,Object.assign({},h),t)):r.createElement(m,Object.assign({},h),t)}function Y(){return i().createElement("svg",{viewBox:"0 0 41 70"},i().createElement("g",null,i().createElement("path",{fill:"#F8981D",d:"M 0 0 41 35 0 70z"})))}var K=n(76044),$={std:"ct8Ht",sm:"dvCes",stdIcon:"iy0pu",smIcon:"Z_mZf"};function X(e){var t,n,r;return(N.M.isInteractive(e.video)||N.M.isClip(e.video))&&(e.video._liteOwner||(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value))?(null===(n=e.video._isClickViewCurated)||void 0===n?void 0:n.value)?i().createElement("div",{className:"".concat("sm"===e.size?$.sm:$.std," me-1 rounded-circle position-relative bg-white")},i().createElement(Q,{className:"me-1 ".concat("sm"===e.size?$.smIcon:$.stdIcon)},i().createElement(Y,null))):i().createElement("div",{className:"".concat("sm"===e.size?$.sm:$.std," me-1")},i().createElement(Z.q,{imageCdnUrl:e.imageCdnUrl,initials:K.l.getInitials(e.video._liteOwner.name,e.video._liteOwner.surname),imageUrl:null===(r=e.video._liteOwner.avatar)||void 0===r?void 0:r.url})):i().createElement(i().Fragment,null)}var J={pluginHover:"h4RQa"},ee="shared.pluginHover";function te(e){return e.isPlugin?i().createElement(s.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(J.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:ee,phrase:"embed"}))):i().createElement(i().Fragment,null)}var ne={padlock:"w4cg8",sm:"JpIYd"};function re(e){var t="sm"===e.size?d.S.Small:d.S.Standard;return i().createElement("div",{className:"".concat(ne.padlock," ").concat("sm"===e.size?ne.sm:""," bg-white cursor-default d-flex align-items-center justify-content-center")},i().createElement(d.x,{svgName:p.vn.Lock,size:t}))}var ie=n(88483),oe=n(87013),ae={logo:"OA9ft",sm:"fyo2J"};function ce(e){var t,n,r,o,a,c;if(!N.M.isVideo(e.video)||!e.companyLogoFallbackUrl)return i().createElement(i().Fragment,null);var l=null===(n=null===(t=e.video.productionCompanies)||void 0===t?void 0:t.data)||void 0===n?void 0:n[0],s=oe.j.createUrl(null!==(o=null===(r=null==l?void 0:l.logo)||void 0===r?void 0:r.url)&&void 0!==o?o:e.companyLogoFallbackUrl,{size:ie.h2.Small}),u=(0,M.x)(l.name,R.o);return s?i().createElement("div",null,i().createElement(z.u,{title:null==l?void 0:l.name,spanHack:!0},i().createElement("div",{className:"".concat(ae.logo," ").concat("sm"===e.size?ae.sm:""," ").concat(!(null===(a=null==l?void 0:l.metadata)||void 0===a?void 0:a.colour)&&u),style:{backgroundImage:"url(".concat(s,")"),backgroundColor:null===(c=null==l?void 0:l.metadata)||void 0===c?void 0:c.colour}}))):i().createElement(i().Fragment,null)}ce.defaultProps={size:"md"};var le=n(98496),se=n(74421),ue=n(43803);function fe(e){return N.M.isClip(e.video)?i().createElement(ue.y,{typeId:se.E.Clip,size:e.size,inContainer:!0}):N.M.isInteractive(e.video)?i().createElement(ue.y,{typeId:se.E.Interactive,status:e.video.status,size:e.size,inContainer:!0}):i().createElement(i().Fragment,null)}fe.default={size:"md"};var de=n(17082);n(33755);var pe=i().createContext({hasProvider:!1}),me={hoverContainer:"TzWQw",hovering:"gdTcW"};function he(e){var t,n=i().useContext(pe);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("play-page"===e.location)return i().createElement(de.t0,{node:n.portalNode});var r=n.started,o="rounded-3";"popout-video"===e.location&&(o="rounded-top-3");var a="".concat(me.hoverContainer," ").concat(r?me.hovering:""," ").concat(o," overflow-hidden");return i().createElement("div",{className:a},i().createElement(de.t0,{node:n.portalNode}))}var ve=n(32557),ye={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 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 be(e){var t="mb-1";return e&&(t+=ye.downScale),t}function we(e){var t,n,r,o=e.video,a=e.appLink,c=e.imageOptions,s=e.setFavourite,u=e.canFavourite,f=e.preload,m=e.hovering,h=e.hoverToPlay,v=e.companyLogoFallbackUrl,y=N.M.getCanBeConsumed(e.video),E=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=j.showFavouriteButton(e.video,m),C=N.M.isVideo(o),P=N.M.getRating(e.video),I=(n=(0,ve.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(n,r)||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}}(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.")}()),L=I[0],_=I[1]&&S&&h,F=Object.assign(Object.assign({},e.analyticsData),{id:o.id,name:o.name}),R=Object.assign(Object.assign({},x),{actionType:l.Vw.Click,descriptor:l._S.Thumbnail});return i().createElement(z.u,{title:N.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement("div",{className:"position-relative rounded-3 overflow-hidden",ref:L},i().createElement(te,{isPlugin:e.isPlugin,className:"rounded-3",appLink:E?a:null,analyticsData:F,analyticsOptions:R}),O&&i().createElement("div",{className:ye.topRightContainer},i().createElement(T,{setFavourite:s,canFavourite:u,video:o,analyticsData:e.analyticsData,analyticsOptions:x})),!E&&i().createElement("div",{className:ye.topRightContainer},i().createElement(re,null)),i().createElement("div",{className:"".concat(ye.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&i().createElement(X,{video:o,imageCdnUrl:e.imageCdnUrl}),i().createElement(fe,{video:o}),i().createElement(ce,{video:o,companyLogoFallbackUrl:v})),i().createElement(D.Z,{data:N.M.getThumbnail(o),appLink:E?a:null,imageType:ie.__.Thumbnails,imageOptions:c,preload:f,className:ye.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:R,preventFocus:!0},!(!m||!E)&&i().createElement(d.x,{className:ye.playIcon,svgName:p.vn.PlayCircle}),i().createElement(V,{type:A.Video}),i().createElement("div",{className:ye.overlayContainer},i().createElement("div",{className:ye.overlay},i().createElement("div",{className:"".concat(be(m)," ").concat(ye.title)},C&&i().createElement(le.$,{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(G,{video:o}),m&&i().createElement(w.c,{className:"mt-1"},N.M.isVideo(o)&&i().createElement(i().Fragment,null,i().createElement(b.C,{type:b.g.Rating,data:P}),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)})))))),_&&i().createElement(he,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:k.context,contextId:k.contextId,moviesAndTv:k.mtv})))}var Ee,Se=n(11306),ke=n(31647),xe=i().createContext({}),Oe=n(52076);function Ce(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"}(Ee||(Ee={}));var Ne=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,l=e.height,s=document.getElementById("content-width-reference");if(!s)return{};var u=t||c*i,f=t?t*(l/c):l*i,d=t?u/c:i;r=o-(u-c)/2,u<n&&(r-=(n-u)/2,f=l*(d=(u=n)/c));var p=a-(f-l)/2+window.scrollY,m=r,h=Ee.Center;return r-s.offsetLeft<8&&(m=o-4,h=Ee.Left),s.offsetWidth+s.offsetLeft-(r+u)<8&&(m=t?o+c-t:o-c*(d-1)+8,h=Ee.Right),{left:m,top:p,height:f,width:u,transformOrigin:h,position:"absolute",originalWidth:c,originalHeight:l}},je={positionWrapper:"jO7pW",animationWrapper:"xXfXO",zoom:"BrrtL"};function Pe(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ie(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)?Ie(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 Ie(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 Le(e){var t,n,r=e.hoverableComponent,o=e.componentProps,a=e.minHoverWidth,c=e.fixedHoverWidth,s=e.hoverScale,u=i().useContext(xe).setPreviewContentNode;void 0===u&&ke.Q.Ry.throw(new Se.H("Please use VideoPreviewContext inside a VideoPreviewContextProvider"));var f=i().useMemo((function(){return(0,de.oD)()}),[]),d=Pe((0,ve.L)({delay:100}),2),p=d[0],m=d[1],h=Pe((0,ve.X)(),2),v=h[0],y=h[1],g=Pe(i().useState(!1),2),b=g[0],w=(g[1],i().useRef(null)),E=i().useRef(!1),S=m||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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(r,o)||function(e,t){if(e){if("string"==typeof e)return Ce(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)?Ce(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],s=a[1],u=i().useRef(e?new Date:null);i().useEffect((function(){if(t&&n&&n.entity&&t.location)if(e)c||s(!0),u.current=new Date,Oe.k.logUserAction(t,Object.assign(Object.assign({},n),{actionType:l.Vw.Hover}));else{if(!c)return;var r=(new Date).getTime()-u.current.getTime();u.current=null,Oe.k.logUserAction(Object.assign(Object.assign({},t),{timeHoveredInMilliseconds:r,timeHoveredInSeconds:r/1e3}),Object.assign(Object.assign({},n),{actionType:l.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,N=k.height,j=i().useMemo((function(){return Ne({x:x,y:O,width:C,height:N},c,a,s)}),[x,O,C,N,s]),P=j?j.originalWidth/j.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(de.Nq,{node:f},i().createElement("div",{className:"".concat(je.positionWrapper," ").concat(je.animationWrapper),style:Object.assign({"--scale":P},j),ref:v},i().createElement(I,Object.assign({isHovering:!0,hoverPositionConfig:j,cleanPortalNode:function(){return u(null)}},o)))))}function Te(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)}Le.ReferenceContainer=function(e){return i().createElement("div",{id:"content-width-reference",className:"flex-grow-1"},e.children)};var Ae={badgeContainer:"fy9Un",sm:"Rb0TL"};function _e(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(w.c,{className:"".concat(Ae.badgeContainer," ").concat("sm"===e.size?Ae.sm:"")},n&&i().createElement(Te,{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)}_e.defaultProps={newDurationStyle:!0,size:"md"};var Fe=n(10657),De=n(45428);function Re(e){if(!e.yearGroups)return i().createElement(i().Fragment,null);var t=De.l.mapRestrictionToText(e.video._restrictions,e.yearGroups);return N.M.getCanBeConsumed(e.video).canConsume&&t?i().createElement(z.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)}var Me={dot:"VrK4W",smallText:"OScyH",title:"svw3F"},Ue=E.T.encloseNamespace("shared.videoTitle"),Ve=new Date;function Be(e){var t,n,r=e.video.dateReleased,o=r&&(n=r,Fe.O.isSame(n,Ve,"year")&&Fe.O.isSame(n,Ve,"month")),a=e.showNewVideoIndicator&&o&&(null===(t=e.video._isClickViewCurated)||void 0===t?void 0:t.value);return i().createElement(i().Fragment,null,i().createElement(z.u,{title:"".concat(a?Ue("newVideo"):""),spanHack:!0,spanHackClassName:"d-inline-block"},a&&i().createElement("span",{className:"rounded-circle bg-green d-inline-block me-1 ".concat(Me.dot," ").concat("h6"===e.titleSize?Me.smallText:"")})),i().createElement("h2",{className:"".concat(e.titleSize," ").concat(Me.title," ").concat(e.className," d-inline")},e.title||e.video.name),i().createElement(Re,{video:e.video,yearGroups:e.yearGroups,size:e.lockSize}))}Be.defaultProps={titleSize:"h6",className:""};function qe(e){var t=e.video,n=e.appLink,r=e.subTextAppLink,o=e.showNewVideoIndicator,a=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(le.$,{type:e.subTextType,className:"text-truncate",video:t,appLink:r,analyticsOptions:{location:l.LZ.VideoThumbnail}}),i().createElement(s.F,{className:"text-reset clamp-2 align-middle",appLink:a?n:null},i().createElement(Be,{video:e.video,yearGroups:e.yearGroups,lockSize:"sm",showNewVideoIndicator:o}))))}var Ge="OjHQZ";function Ze(e){var t,n;return e.appLink?i().createElement(s.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(Ge," ").concat(e.active?"kD1xM":"","\n ")},i().createElement(ze,Object.assign({},e))):i().createElement("div",{className:"p-1 pe-2 rounded-pill d-inline-flex align-items-center ".concat(null===(n=e.theme)||void 0===n?void 0:n.container," ").concat(Ge," ").concat("eGiNR")},i().createElement(ze,Object.assign({},e)))}function ze(e){var t;return i().createElement(i().Fragment,null,i().createElement(d.x,{className:"".concat("SS2zL"," 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))}function He(e){var t,n,r;return!e.video||N.M.isInteractive(e.video)?i().createElement(i().Fragment,null):e.video.glance?i().createElement(Ze,{theme:{container:"classroom-guide-tag",tabLabel:"classroom-guide-tag-label"},svgName:p.vn.GraduationCap,iconVariant:"navy",text:E.T.getPhrase("shared.classroomGuideTag","classroomGuide"),appLink:e.appLink,appLinkAnalyticsData:Object.assign(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"},N.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)}):i().createElement(i().Fragment,null)}function We(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(Ze,{svgName:p.vn.Interactive,iconVariant:"green",text:E.T.getPhrase("shared.interactivesTag","interactives",{smartCount:n}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"interactive",videoGuidanceTotalItems:n},N.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function Qe(e){if(!N.M.showResourcesGuidance(e.video))return i().createElement(i().Fragment,null);var t,n,r,o=(t=e.video,N.M.isInteractive(t)?0:((null===(n=t.resources)||void 0===n?void 0:n.data.length)||0)+((null===(r=t.links)||void 0===r?void 0:r.data.length)||0));return i().createElement(Ze,{svgName:p.vn.Resources,iconVariant:"indigo",text:E.T.getPhrase("shared.resourcesTag","resources",{smartCount:o}),appLink:e.appLink,appLinkAnalyticsData:Object.assign(Object.assign({videoGuidanceType:"resource",videoGuidanceTotalItems:o},N.M.getAnalyticsData(e.video)),e.analyticsData),appLinkAnalyticsOptions:Object.assign({actionType:l.Vw.Click,entity:N.M.getAnalyticsEntity(e.video)},e.analyticsOptions)})}function Ye(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(He,{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(Qe,{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(We,{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 Ke={button:"CXHmZ"};function $e(e){var t=e.removeButtonTooltip||E.T.getPhrase("shared.removeVideoButton","removeFromRow");return i().createElement("div",{className:"me-2"},i().createElement(z.u,{title:t,spanHack:!0},i().createElement(k.L,{onClick:e.onClickRemove,className:"d-flex align-items-center justify-content-center ".concat(Ke.button),tabIndex:e.preventFocus?-1:void 0},i().createElement(d.x,{svgName:p.vn.Close,className:"svg-container ".concat(Ke.heart)}))))}var Xe=function(e){var t,n=e.video,r=e.appLink,o=e.imageOptions,a=e.preload,c=e.setFavourite,s=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:{},m=N.M.getCanBeConsumed(n),h=m.canNavigate,v=m.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&&v&&f,E=j.showFavouriteButton(e.video,u),k=Object.assign(Object.assign({},e.analyticsData),{id:n.id,name:n.name}),x=Object.assign(Object.assign({},b),{actionType:l.Vw.Click,descriptor:l._S.Thumbnail});return i().createElement("div",{className:y},i().createElement("div",{className:"FAuzc"},!!S.q.isFunction(e.onClickRemove)&&(!!O.V.isTabletOrMobile()||u)&&i().createElement($e,{onClickRemove:function(t){var n;t.preventDefault(),null===(n=e.onClickRemove)||void 0===n||n.call(e)},removeButtonTooltip:e.removeButtonTooltip,preventFocus:!0}),E&&i().createElement(T,{setFavourite:c,canFavourite:s,video:n,analyticsData:e.analyticsData,analyticsOptions:b,preventFocus:!0}),!h&&i().createElement(z.u,{title:N.M.getPrivacyReasoning(e.video),spanHack:!0,spanHackClassName:""},i().createElement(re,null))),i().createElement("div",{className:"position-relative"},i().createElement(te,{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:h?r:null,analyticsData:k,analyticsOptions:x}),i().createElement(D.Z,{onClick:function(){var t;return null===(t=e.cleanPortalNode)||void 0===t?void 0:t.call(e)},data:N.M.getThumbnail(n),appLink:h?r:null,imageType:ie.__.Thumbnails,imageOptions:o,preload:a,alt:("series"in n&&(null===(t=n.series)||void 0===t?void 0:t.name)?"".concat(n.series.name,": "):"")+n.name,analyticsData:k,analyticsOptions:x,preventFocus:!e.hideTitle,appLinkClassName:"position-absolute top-0 start-0 h-100 w-100 overflow-hidden ".concat(u?"rounded-top-3":"rounded-3"),imageClassName:u?"rounded-top-3":"rounded-3"},i().createElement(V,{type:A.Video}),i().createElement("div",{className:"p-absolute w-100 h-100 text-white"},i().createElement("div",{className:"".concat("wHY80"," d-flex flex-no-wrap")},e.showOwner&&i().createElement(X,{video:n,imageCdnUrl:e.imageCdnUrl}),i().createElement(fe,{video:n}),i().createElement(ce,{video:n,companyLogoFallbackUrl:d})),i().createElement(_e,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration}),i().createElement(G,{video:n}))),w&&i().createElement(he,{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(qe,Object.assign({},e)),i().createElement("div",{className:"".concat("vMaXP"," ").concat(u?"".concat("tR1jA"," box-shadow"):"")},u&&i().createElement(i().Fragment,null,i().createElement("div",{className:"".concat(u?"KJrT1":"")},i().createElement(qe,Object.assign({},e)),e.showVideoGuidance&&u&&i().createElement(Ye,{getClassroomGuideAppLink:e.getClassroomGuideAppLink,getResourceGuidanceAppLink:e.getResourceGuidanceAppLink,getInteractiveGuidanceAppLink:e.getInteractiveGuidanceAppLink,video:e.video,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,responsiveClassName:"OixHb",containerClassName:"d-flex justify-content-start align-items-center pt-2"})))))};function Je(e){return i().createElement(i().Fragment,null,i().createElement(Le,{hoverableComponent:Xe,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 et,tt={mask:"qpc7L",small:"L8Oxs",video:"b8kJW",playlist:"eo2p2",maskContainer:"lpwag"};function nt(e){var t=e.type,n=e.size,i=function(e){return e===et.Video?tt.video:e===et.Playlist?tt.playlist:""}(t),o=function(e){return e===et.Video?p.vn.PlayCircle:""}(t);return r.createElement("div",{className:"".concat(tt.maskContainer," ").concat("sm"===n?tt.small:"")},r.createElement("div",{className:tt.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"}(et||(et={})),nt.defaults={size:"md"};var rt,it={unchecked:"bup9I",outline:"ealw_",checked:"A1Ov0",checkMark:"c14lI"};function ot(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 at(e){var t,n,r=(t=i().useState(e.status===rt.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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ot(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)?ot(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===rt.Complete)}),[e.status]);var c="cursor-pointer rounded-circle ".concat(o?it.checked:it.unchecked);return e.className&&(c+=" ".concat(e.className)),"outline"===e.style&&(c+=" ".concat(it.outline)),e.status&&e.status!==rt.None&&S.q.isFunction(e.setStatus)?i().createElement(k.L,{className:c,onClick:function(){var t=!o;a(t);var n=t?rt.Complete:rt.Incomplete;e.setStatus(n).catch((function(){a(!t)}))},disabled:e.disabled},i().createElement(d.x,{svgName:p.vn.Tick,className:"svg-container ".concat(it.checkMark)})):i().createElement(i().Fragment,null)}!function(e){e.None="None",e.Complete="Complete",e.Incomplete="Incomplete"}(rt||(rt={})),at.defaultProps={style:"filled"};var ct,lt={container:"efxnE",cvIcon:"OJ_ZQ",action:"vWvGn"};function st(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)||!(!S.q.isFunction(e.setFavourite)||!S.q.isFunction(e.canFavourite))||!!S.q.isFunction(e.setCheckMarkStatus)}(e)?i().createElement("div",{className:"".concat(lt.container," d-flex align-items-center")},i().createElement(T,{setFavourite:e.setFavourite,canFavourite:e.canFavourite,video:e.video,className:lt.action,analyticsData:e.analyticsData,analyticsOptions:e.analyticsOptions,preventFocus:!0}),i().createElement(at,{status:e.checkMarkStatus,setStatus:e.setCheckMarkStatus,className:lt.action})):i().createElement(i().Fragment,null):i().createElement("div",{className:lt.container},i().createElement(re,{size:e.size}))}!function(e){e[e.Below=1]="Below",e[e.Overlay=2]="Overlay",e[e.Independent=3]="Independent"}(ct||(ct={}));var ut={titleOverlay:"krg9f",clip:"MPRU6",large:"g5_ww",interactive:"Zzo3e",titleBelow:"tZjPt",overlayContainer:"EElm1",topLeftContainer:"hrw3I",gradient:"LS_EH"};function ft(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=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(e,t)||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}}(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 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="shared.staticVideoThumbnail";function mt(e){var t,n=e.video,r=e.subTextAppLink,o=e.textPosition,a=e.appLink,c=o===ct.Overlay,u=N.M.getCanBeConsumed(e.video).canNavigate,f="";return c?(f=ut.titleOverlay,u&&(N.M.isClip(n)&&(f+=" "+ut.clip),N.M.isInteractive(n)&&(f+=" "+ut.interactive))):f=ut.titleBelow,i().createElement("div",{className:f},N.M.isVideo(n)&&i().createElement(le.$,{type:e.subTextType,className:c?"text-shadow clamp-1":"clamp-2",video:n,appLink:c?null:r,analyticsOptions:{location:l.LZ.VideoThumbnail}}),c||!u?i().createElement("span",{className:"h6 text-reset clamp-1"},i().createElement(Be,{video:n,title:null!==(t=n.name)&&void 0!==t?t:E.T.getPhrase(pt,"videoUnavailable"),showNewVideoIndicator:e.showNewVideoIndicator})):i().createElement(s.F,{className:"h6 text-reset clamp-2",appLink:a},i().createElement(Be,{video:n,showNewVideoIndicator:e.showNewVideoIndicator})))}function ht(e){var t,n,r=e.video,o=e.appLink,a=e.textPosition,c=e.imageOptions,s=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=ft((0,ve.X)(),2),m=p[0],h=p[1],v=ft((0,ve.L)({delay:100}),2),y=v[0],b=v[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),P=Object.assign(Object.assign({},e.analyticsData),{id:r.id,name:r.name}),I=Object.assign(Object.assign({},x),{actionType:l.Vw.Click,descriptor:l._S.Thumbnail});return i().createElement(z.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===ct.Overlay&&(n+=" rounded overflow-hidden"),n),ref:function(e){m.current=e,y.current=e}},i().createElement(te,{isPlugin:e.isPlugin,className:"sm"===e.size?"rounded":"rounded-3",appLink:E?o:null,analyticsData:P,analyticsOptions:I}),i().createElement(st,{video:r,checkMarkStatus:e.checkMarkStatus,setCheckMarkStatus:e.setCheckMarkStatus,setFavourite:s,canFavourite:function(){var t;return(null===(t=e.canFavourite)||void 0===t?void 0:t.call(e,e.video))&&j.showFavouriteButton(r,h)},analyticsData:e.analyticsData,analyticsOptions:x,size:e.size}),i().createElement(D.Z,{data:N.M.getThumbnail(r),appLink:E?o:null,onClick:E?e.onClick:void 0,imageType:ie.__.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===ct.Overlay&&(t+=" ".concat(ut.gradient)),t}(),alt:("series"in r&&(null===(t=r.series)||void 0===t?void 0:t.name)?"".concat(r.series.name,": "):"")+r.name,analyticsData:P,analyticsOptions:I,preventFocus:!0},O&&i().createElement(nt,{type:et.Video,size:e.size}),i().createElement(V,{type:A.Video}),i().createElement("div",{className:ut.overlayContainer},a===ct.Overlay&&i().createElement(mt,Object.assign({},e)),i().createElement("div",{className:"".concat(ut.topLeftContainer," d-flex flex-no-wrap")},e.showOwner&&i().createElement(X,{video:r,imageCdnUrl:e.imageCdnUrl}),!e.hideVideoTypeBadge&&i().createElement(fe,{video:r,size:e.size}),i().createElement(ce,{video:r,companyLogoFallbackUrl:e.companyLogoFallbackUrl,size:e.size})),i().createElement(G,{video:r}),i().createElement(_e,{video:e.video,audience:e.audience,hideRating:e.hideRating,hideDuration:e.hideDuration,newDurationStyle:e.newDurationStyle,size:e.size}))),k&&i().createElement(he,{key:e.video.id,objectId:e.video.id,objectTypeId:e.video.typeId,mode:"hover",context:d.context,contextId:d.contextId,moviesAndTv:d.mtv}),a===ct.Below&&i().createElement(mt,Object.assign({},e))))}function vt(e){switch(e.type){case"static":return r.createElement(ht,Object.assign({},e));case"cosmetic":return r.createElement(ht,Object.assign({},e,{hoverToPlay:!1}));case"expandable":return r.createElement(we,Object.assign({},e));case"popout":return r.createElement(Je,Object.assign({},e));default:return}}vt.defaultProps={hideRating:!0,size:"md",hoverToPlay:!0};var yt=n(50072),gt=n(65402),bt={navItem:"GyyRT",active:"aVNhj",navContainer:"uQ6as",navItemHeading:"NjJLh"},wt="libraryRequests.leftNav";function Et(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(s.F,{className:"d-flex py-3 px-3 text-decoration-none ".concat(bt.navItem," ").concat(e.active?bt.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(vt,{video:null!==(n=r.object)&&void 0!==n?n:{},type:"cosmetic",imageOptions:{size:ie.h2.Small},textPosition:ct.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(le.$,{type:"series",video:r.object,analyticsOptions:{location:l.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(bt.navItemHeading)},u))),r.status!==yt.l.Pending&&i().createElement("div",{className:"flex-shrink-0 ms-1"},i().createElement(gt.h,{status:r.status}))),!!o&&i().createElement("div",null,i().createElement(y.x,{namespace:wt,phrase:r.status===yt.l.AutoApproved?"addedBy":"requestedBy",options:{fullName:o}})),i().createElement("div",null,(0,a.WU)(r.dateCreated))))}function St(e){return i().createElement("div",{className:"".concat(bt.navContainer," bg-white rounded overflow-hidden")},i().createElement(o.$B,{hideTracksWhenNotNeeded:!0},e.libraryRequests.map((function(t,n){return i().createElement(Et,{libraryRequest:t,key:n,active:e.selectedId===t.id,appLink:e.appLink,queryParams:e.queryParams})})),(e.nextCursor||e.isFetching)&&i().createElement(v,{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),l=n(49642),s=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){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=u(n))return n;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({},s.D.RecentlyAdded,{name:o.T.getPhrase(d,"recentlyAdded")}),s.D.AtoZ,{name:o.T.getPhrase(d,"atoz")}),s.D.ZtoA,{name:o.T.getPhrase(d,"ztoa")}),s.D.Newest,{name:o.T.getPhrase(d,"newest")}),s.D.Oldest,{name:o.T.getPhrase(d,"oldest")}),s.D.Series,{name:o.T.getPhrase(d,"series")})}));function m(e){var t,n,i=e.sortTypes||(t=e.includeProductionYear,n=p(),t&&(n=Object.assign(f({},s.D.ProductionYear,{name:o.T.getPhrase(d,"productionYear")}),n)),n);return r.createElement("div",{className:"dropdown"},r.createElement("button",{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"},i[e.type].name),r.createElement("ul",{className:"dropdown-menu dropdown-menu-end","aria-labelledby":"sort-select"},Object.keys(i).map((function(t){var n="dropdown-item";return t===e.type&&(n+=" active"),r.createElement("li",{key:t},r.createElement(l.F,{className:n,appLink:e.getSortAppLink(t),analyticsData:{sort:i[t].name},analyticsOptions:e.analyticsOptions},i[t].name))}))))}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function v(e,t,n){return(t=function(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}m.defaultProps={variant:"light"};var y=o.T.encloseNamespace("libraryRequests.sort"),g=function(){return v(v({},s.D.Newest,{name:y("newest")}),s.D.Oldest,{name:y("oldest")})};function b(e){var t=g();return i().createElement(m,{variant:"outline-dark",type:e.queryParams.sort||s.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),l=n(50072),s={svgContainer:"O2Czg"},u=o.T.encloseNamespace("libraryRequests.statusIcon");function f(e){switch(e){case l.l.AutoApproved:return u("autoApproved");case l.l.Approved:return u("approved");case l.l.Closed:return u("closed");case l.l.Rejected:return u("rejected")}return""}function d(e){var t="",n="".concat(s.svgContainer," text-white d-inline-block svg-container rounded-circle ");switch(e.status){case l.l.AutoApproved:t=c.vn.Check,n+="bg-gray-500";break;case l.l.Approved:t=c.vn.Check,n+="bg-success";break;case l.l.Closed:t=c.vn.Minus,n+="bg-gray-500";break;case l.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 v}});var r=n(1024),i=n.n(r),o=n(57857),a=n(52076),c=n(49642),l=n(41087),s=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(l.C,{type:l.g.Count,data:e.tab.count})))}function p(e){var t;return i().createElement("nav",{className:null!==(t=e.className)&&void 0!==t?t:"",ref:e.containerRef},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(s.L,{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 "),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 m=n(50997),h=o.T.encloseNamespace("libraryRequests.tabs");function v(e){var t=[{name:h("pending"),appLink:{application:m.OV.LIBRARY_REQUESTS,action:m.eX.LibraryRequests.PENDING_REQUESTS,args:[""]},active:"pending"===e.active},{name:h("past"),appLink:{application:m.OV.LIBRARY_REQUESTS,action:m.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 l}});var r=n(1024),i=n.n(r),o=n(57857),a=n(89375),c=o.T.encloseNamespace("libraryRequests.libraryRequestTitle");function l(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 l}});var r=n(1024),i=n.n(r),o=n(86120),a=n(94223),c=n(25796);function l(e,t){var n=o.a.useGetFetch(),r=function(n){return c.y.libraryRequests(e,t,n)},l=function(e){return n(r(e))},s=(0,a.P)(r&&function(e){return r(e).key});return i().useEffect((function(){s&&s.shouldInitialFetch&&l()}),[e,t]),Object.assign(Object.assign({},s),{fetchNext:l})}},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 l}});var r=n(1024),i=n.n(r),o=n(31647),a=n(50997),c=n(50072);function l(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 l}});var r=n(1024),i=n.n(r),o=n(48088),a=n(54096),c=n(50997);function l(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 x}});var r=n(48088),i=n(39479),o=n(31647),a=n(52076),c=n(70065),l=n(88483),s=n(2772),u=n(10101),f=n(89167),d=n(57098),p=n(93569),m=n(264),h=n(57e3),v=n(37339),y=n.n(v);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){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(E=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var x=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=function(e,t,n){return t=S(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,E()?Reflect.construct(t,n||[],S(e).constructor):t.apply(e,n))}(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&&k(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 m.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")&&(m.g.hasLite?this.requestViewKey():this.webPlayer||this.renderVideoPreview())}},{key:"renderThumbnail",value:function(){this.showChildView("thumbnail",new s.Z({model:this.model,thumbnailOptions:{size:l.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 h.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:"")+'">\n <div class="thumbnail-region"></div>\n</div>'},useData:!0})}}]);