@gamelearn/arcade-components 3.42.0 → 3.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ object-assign
41
41
  */var oO,HP;function EY(){if(HP)return oO;HP=1;var u=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function n(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function i(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},l=0;l<10;l++)o["_"+String.fromCharCode(l)]=l;var c=Object.getOwnPropertyNames(o).map(function(f){return o[f]});if(c.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(f){d[f]=f}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return oO=i()?Object.assign:function(s,o){for(var l,c=n(s),d,f=1;f<arguments.length;f++){l=Object(arguments[f]);for(var m in l)t.call(l,m)&&(c[m]=l[m]);if(u){d=u(l);for(var _=0;_<d.length;_++)e.call(l,d[_])&&(c[d[_]]=l[d[_]])}}return c},oO}var lO,GP;function p9(){if(GP)return lO;GP=1;var u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return lO=u,lO}var uO,VP;function TY(){if(VP)return uO;VP=1;var u=function(){};if(process.env.NODE_ENV!=="production"){var t=p9(),e={},n=Function.call.bind(Object.prototype.hasOwnProperty);u=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,l,c,d){if(process.env.NODE_ENV!=="production"){for(var f in s)if(n(s,f)){var m;try{if(typeof s[f]!="function"){var _=Error((c||"React class")+": "+l+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[f]+"`.");throw _.name="Invariant Violation",_}m=s[f](o,f,c,l,null,t)}catch(S){m=S}if(m&&!(m instanceof Error)&&u((c||"React class")+": type specification of "+l+" `"+f+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in e)){e[m.message]=!0;var g=d?d():"";u("Failed "+l+" type: "+m.message+(g??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(e={})},uO=i,uO}var cO,YP;function AY(){if(YP)return cO;YP=1;var u=uF(),t=EY(),e=p9(),n=TY(),i=Function.call.bind(Object.prototype.hasOwnProperty),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(l){var c="Warning: "+l;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function o(){return null}return cO=function(l,c){var d=typeof Symbol=="function"&&Symbol.iterator,f="@@iterator";function m(Q){var tt=Q&&(d&&Q[d]||Q[f]);if(typeof tt=="function")return tt}var _="<<anonymous>>",g={array:T("array"),bool:T("boolean"),func:T("function"),number:T("number"),object:T("object"),string:T("string"),symbol:T("symbol"),any:A(),arrayOf:E,element:C(),elementType:R(),instanceOf:N,node:L(),objectOf:M,oneOf:O,oneOfType:B,shape:F,exact:I};function S(Q,tt){return Q===tt?Q!==0||1/Q===1/tt:Q!==Q&&tt!==tt}function y(Q){this.message=Q,this.stack=""}y.prototype=Error.prototype;function x(Q){if(process.env.NODE_ENV!=="production")var tt={},rt=0;function ut(ot,ht,vt,it,lt,dt,Et){if(it=it||_,dt=dt||vt,Et!==e){if(c){var _t=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw _t.name="Invariant Violation",_t}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pt=it+":"+vt;!tt[pt]&&rt<3&&(s("You are manually calling a React.PropTypes validation function for the `"+dt+"` prop on `"+it+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),tt[pt]=!0,rt++)}}return ht[vt]==null?ot?ht[vt]===null?new y("The "+lt+" `"+dt+"` is marked as required "+("in `"+it+"`, but its value is `null`.")):new y("The "+lt+" `"+dt+"` is marked as required in "+("`"+it+"`, but its value is `undefined`.")):null:Q(ht,vt,it,lt,dt)}var st=ut.bind(null,!1);return st.isRequired=ut.bind(null,!0),st}function T(Q){function tt(rt,ut,st,ot,ht,vt){var it=rt[ut],lt=Z(it);if(lt!==Q){var dt=X(it);return new y("Invalid "+ot+" `"+ht+"` of type "+("`"+dt+"` supplied to `"+st+"`, expected ")+("`"+Q+"`."))}return null}return x(tt)}function A(){return x(o)}function E(Q){function tt(rt,ut,st,ot,ht){if(typeof Q!="function")return new y("Property `"+ht+"` of component `"+st+"` has invalid PropType notation inside arrayOf.");var vt=rt[ut];if(!Array.isArray(vt)){var it=Z(vt);return new y("Invalid "+ot+" `"+ht+"` of type "+("`"+it+"` supplied to `"+st+"`, expected an array."))}for(var lt=0;lt<vt.length;lt++){var dt=Q(vt,lt,st,ot,ht+"["+lt+"]",e);if(dt instanceof Error)return dt}return null}return x(tt)}function C(){function Q(tt,rt,ut,st,ot){var ht=tt[rt];if(!l(ht)){var vt=Z(ht);return new y("Invalid "+st+" `"+ot+"` of type "+("`"+vt+"` supplied to `"+ut+"`, expected a single ReactElement."))}return null}return x(Q)}function R(){function Q(tt,rt,ut,st,ot){var ht=tt[rt];if(!u.isValidElementType(ht)){var vt=Z(ht);return new y("Invalid "+st+" `"+ot+"` of type "+("`"+vt+"` supplied to `"+ut+"`, expected a single ReactElement type."))}return null}return x(Q)}function N(Q){function tt(rt,ut,st,ot,ht){if(!(rt[ut]instanceof Q)){var vt=Q.name||_,it=nt(rt[ut]);return new y("Invalid "+ot+" `"+ht+"` of type "+("`"+it+"` supplied to `"+st+"`, expected ")+("instance of `"+vt+"`."))}return null}return x(tt)}function O(Q){if(!Array.isArray(Q))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function tt(rt,ut,st,ot,ht){for(var vt=rt[ut],it=0;it<Q.length;it++)if(S(vt,Q[it]))return null;var lt=JSON.stringify(Q,function(Et,_t){var pt=X(_t);return pt==="symbol"?String(_t):_t});return new y("Invalid "+ot+" `"+ht+"` of value `"+String(vt)+"` "+("supplied to `"+st+"`, expected one of "+lt+"."))}return x(tt)}function M(Q){function tt(rt,ut,st,ot,ht){if(typeof Q!="function")return new y("Property `"+ht+"` of component `"+st+"` has invalid PropType notation inside objectOf.");var vt=rt[ut],it=Z(vt);if(it!=="object")return new y("Invalid "+ot+" `"+ht+"` of type "+("`"+it+"` supplied to `"+st+"`, expected an object."));for(var lt in vt)if(i(vt,lt)){var dt=Q(vt,lt,st,ot,ht+"."+lt,e);if(dt instanceof Error)return dt}return null}return x(tt)}function B(Q){if(!Array.isArray(Q))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var tt=0;tt<Q.length;tt++){var rt=Q[tt];if(typeof rt!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+$(rt)+" at index "+tt+"."),o}function ut(st,ot,ht,vt,it){for(var lt=0;lt<Q.length;lt++){var dt=Q[lt];if(dt(st,ot,ht,vt,it,e)==null)return null}return new y("Invalid "+vt+" `"+it+"` supplied to "+("`"+ht+"`."))}return x(ut)}function L(){function Q(tt,rt,ut,st,ot){return H(tt[rt])?null:new y("Invalid "+st+" `"+ot+"` supplied to "+("`"+ut+"`, expected a ReactNode."))}return x(Q)}function F(Q){function tt(rt,ut,st,ot,ht){var vt=rt[ut],it=Z(vt);if(it!=="object")return new y("Invalid "+ot+" `"+ht+"` of type `"+it+"` "+("supplied to `"+st+"`, expected `object`."));for(var lt in Q){var dt=Q[lt];if(dt){var Et=dt(vt,lt,st,ot,ht+"."+lt,e);if(Et)return Et}}return null}return x(tt)}function I(Q){function tt(rt,ut,st,ot,ht){var vt=rt[ut],it=Z(vt);if(it!=="object")return new y("Invalid "+ot+" `"+ht+"` of type `"+it+"` "+("supplied to `"+st+"`, expected `object`."));var lt=t({},rt[ut],Q);for(var dt in lt){var Et=Q[dt];if(!Et)return new y("Invalid "+ot+" `"+ht+"` key `"+dt+"` supplied to `"+st+"`.\nBad object: "+JSON.stringify(rt[ut],null," ")+`
42
42
  Valid keys: `+JSON.stringify(Object.keys(Q),null," "));var _t=Et(vt,dt,st,ot,ht+"."+dt,e);if(_t)return _t}return null}return x(tt)}function H(Q){switch(typeof Q){case"number":case"string":case"undefined":return!0;case"boolean":return!Q;case"object":if(Array.isArray(Q))return Q.every(H);if(Q===null||l(Q))return!0;var tt=m(Q);if(tt){var rt=tt.call(Q),ut;if(tt!==Q.entries){for(;!(ut=rt.next()).done;)if(!H(ut.value))return!1}else for(;!(ut=rt.next()).done;){var st=ut.value;if(st&&!H(st[1]))return!1}}else return!1;return!0;default:return!1}}function W(Q,tt){return Q==="symbol"?!0:tt?tt["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&tt instanceof Symbol:!1}function Z(Q){var tt=typeof Q;return Array.isArray(Q)?"array":Q instanceof RegExp?"object":W(tt,Q)?"symbol":tt}function X(Q){if(typeof Q>"u"||Q===null)return""+Q;var tt=Z(Q);if(tt==="object"){if(Q instanceof Date)return"date";if(Q instanceof RegExp)return"regexp"}return tt}function $(Q){var tt=X(Q);switch(tt){case"array":case"object":return"an "+tt;case"boolean":case"date":case"regexp":return"a "+tt;default:return tt}}function nt(Q){return!Q.constructor||!Q.constructor.name?_:Q.constructor.name}return g.checkPropTypes=n,g.resetWarningCache=n.resetWarningCache,g.PropTypes=g,g},cO}var dO,KP;function CY(){if(KP)return dO;KP=1;var u=p9();function t(){}function e(){}return e.resetWarningCache=t,dO=function(){function n(o,l,c,d,f,m){if(m!==u){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}}n.isRequired=n;function i(){return n}var s={array:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:e,resetWarningCache:t};return s.PropTypes=s,s},dO}if(process.env.NODE_ENV!=="production"){var RY=uF(),wY=!0;fN.exports=AY()(RY.isElement,wY)}else fN.exports=CY()();var DY=fN.exports;const $t=ay(DY);function cF({time:u={current:0,duration:0},setTimePoint:t=()=>{},mandatory:e,mandatoryHasBeenViewed:n,viewed:i}){const s=Math.trunc(u.current*1e3/u.duration)/10,o=G.useRef(),[l,c]=G.useState(!1),d=Math.trunc(u.current/60)<10?["0",Math.trunc(u.current/60)].join("").trim():Math.trunc(u.current/60),f=Math.trunc(u.current%60)<10?["0",Math.trunc(u.current%60)].join("").trim():Math.trunc(u.current%60),m=(y,x)=>{c(!0);let T=y.offsetX;y.changedTouches&&(T=y.changedTouches[0].clientX);const A=x.offsetWidth+x.offsetLeft;T<=A&&T>=x.offsetLeft&&t(T,x.offsetWidth,x.offsetLeft)},_=()=>{window.onmousemove=null,window.onmouseup=null,c(!1)},g=y=>{window.onmousemove=x=>m(x,y),window.onmouseup=x=>_()},S=(y,x)=>{(!e||e&&n||i)&&(y.preventDefault(),t(y.clientX,x.offsetWidth,x.offsetLeft),g(x),c(!0))};return P.jsx("div",{id:"buffer",ref:o,className:"video--controls__bar",onMouseDown:y=>{const x=o.current;S(y,x)},onTouchMove:y=>{const x=o.current;m(y,x)},onTouchStart:y=>{const x=o.current;c(!0),t(y.changedTouches[0].clientX,x.offsetWidth,x.offsetLeft)},children:P.jsx("div",{className:"video--controls__progress",style:{width:`${s}%`},children:P.jsx("span",{className:l?"video--controls__handle active":"video--controls__handle",children:l?P.jsxs("div",{className:"video--current__time active",children:[d,":",f]}):null})})})}cF.propTypes={time:$t.shape({current:$t.number,duration:$t.number}),setTimePoint:$t.func};function dF({time:u={current:0,duration:0}}){const t=Math.trunc(u.current/60)<10?["0",Math.trunc(u.current/60)].join("").trim():Math.trunc(u.current/60),e=Math.trunc(u.current%60)<10?["0",Math.trunc(u.current%60)].join("").trim():Math.trunc(u.current%60),n=Math.trunc(u.duration/60)<10?["0",Math.trunc(u.duration/60)].join("").trim():Math.trunc(u.duration/60),i=Math.trunc(u.duration%60)<10?["0",Math.trunc(u.duration%60)].join("").trim():Math.trunc(u.duration%60);return P.jsxs("div",{className:"video--time",children:[P.jsxs("span",{className:"time",children:[t,":",e]}),P.jsxs("span",{className:"duration",children:[n,":",i]})]})}dF.propTypes={time:$t.shape({current:$t.number,duration:$t.number})};function OY({pauseVideo:u=()=>{},paused:t=!1,translate:e}){return P.jsx("div",{className:"video--controls__buttons",children:P.jsx("button",{id:"playPause","aria-label":e(t?"storylines.misc.play":"storylines.misc.pause"),className:t?"unset-button icon-play":"unset-button icon-pause",type:"button",onClick:()=>{u(),document.querySelector("#playPause").blur()}})})}function MY({restart:u=()=>{},translate:t,finished:e=!1}){return P.jsx("div",{className:"video--extra__actions video--extra__actions--widthTransparencyLayer position--absolute z-index1",children:P.jsxs("button",{type:"button",onClick:()=>{u()},className:"gat--btn gat--btn__secondary","aria-label":t("video.replay"),children:[P.jsx("span",{className:"icon-rewind"}),P.jsx("span",{id:"video.replay"})]})})}function NY({play:u=()=>{},finished:t=!1,paused:e=!1}){return t||!e?P.jsx("div",{}):P.jsx("div",{className:"video--extra__actions position--absolute z-index1",children:P.jsx("div",{role:"button",tabIndex:0,"aria-label":"play video",onKeyUp:()=>{},onClick:()=>{u()},className:"play--video__button",children:P.jsx("span",{className:"icon-play-outline"})})})}function LY({viewed:u=!1,mandatory:t=!1,finished:e=!1,skip:n=()=>{},mandatoryHasBeenViewed:i,translate:s}){return P.jsx(P.Fragment,{children:t&&u||!t||e||i?P.jsx("div",{className:"position--absolute right top z-index2",children:P.jsx("button",{className:"gat--btn__round gat--btn__close",type:"button","aria-label":s("storylines.misc.closePiece"),onKeyUp:()=>{},onClick:()=>{n()},children:P.jsx("span",{className:"icon-close"})})}):null})}function hF({volume:u=0,muted:t=!1,setVolume:e=()=>{},mute:n=()=>{}}){const i=G.useRef(),s=t?0:Math.floor(u*100),o=(f,m)=>{const _=m.offsetWidth+m.offsetLeft;let g=f.clientX;f.changedTouches&&(g=f.changedTouches[0].clientX),g<=_&&g>=m.offsetLeft&&e(g,m.offsetWidth,m.offsetLeft)},l=()=>{window.onmousemove=null,window.onmouseup=null},c=f=>{window.onmousemove=m=>o(m,f),window.onmouseup=m=>l()},d=(f,m)=>{f.preventDefault(),e(f.clientX,m.offsetWidth,m.offsetLeft),c(m)};return P.jsxs("div",{className:"video--sound",children:[P.jsx("span",{onClick:()=>n(),className:s===0?"icon-sound-off":"icon-sound"}),P.jsx("div",{ref:i,onMouseDown:f=>{const m=i.current;d(f,m)},onTouchMove:f=>{const m=i.current;o(f,m)},onTouchStart:f=>{const m=i.current;e(f.changedTouches[0].clientX,m.offsetWidth,m.offsetLeft)},id:"volume",className:"video--sound__level",children:P.jsx("span",{style:{width:`${s<10?10:s}%`},className:"video--sound__progress",children:P.jsx("span",{className:"video--handle"})})})]})}hF.propTypes={volume:$t.number,setVolume:$t.func,mute:$t.func,muted:$t.bool};function fF({pause:u=()=>{},mandatory:t=!1,viewed:e=!1,skip:n=()=>{},rewind:i=()=>{},paused:s=!1,time:o={current:0,duration:0},finished:l=!1,restart:c=()=>{},volume:d=0,muted:f=!1,mute:m=()=>{},setVolume:_=()=>{},setTimePoint:g=()=>{},audioAnimation:S=!1,mandatoryHasBeenViewed:y,translate:x,visibility:T,withoutControls:A,documentType:E}){return P.jsxs(P.Fragment,{children:[P.jsx(LY,{mandatory:t,finished:l,viewed:e,skip:n,rewind:i,mandatoryHasBeenViewed:y,translate:x}),A?null:P.jsxs("div",{className:`video--controls-wrap ${T?"video--controls-wrap--hidden":""}`,children:[S?null:P.jsx(NY,{play:u,paused:s,finished:l}),l&&(E==="document"||E==="lesson")?P.jsx(MY,{restart:c,translate:x}):null,P.jsxs("div",{className:"video--controls",children:[P.jsx(cF,{mandatory:t,mandatoryHasBeenViewed:y,time:o,setTimePoint:g,finished:l,viewed:e}),P.jsxs("div",{className:"video--controls__actions",children:[P.jsx(dF,{time:o}),S?P.jsx("div",{className:"audio-animation-wrap",children:P.jsx("div",{className:`audio-animation ${s?"audio-animation--notAnimate ":null}`})}):null,P.jsx(OY,{paused:s,pauseVideo:u,translate:x}),P.jsx(hF,{muted:f,mute:m,volume:d,setVolume:_})]})]})]})]})}fF.propTypes={audioAnimation:$t.bool,paused:$t.bool,mandatory:$t.bool,muted:$t.bool,volume:$t.number,viewed:$t.bool,pause:$t.func,finished:$t.bool,restart:$t.func,skip:$t.func,rewind:$t.func,mute:$t.func,setTimePoint:$t.func,setVolume:$t.func,time:$t.shape({current:$t.number,duration:$t.number})};const XP="https://min.gamelearn.io/css-resources/gamelearn/resources/bgAudioPiece.jpg";function y5({documentType:u="",url:t="",required:e=!1,viewed:n=!1,backgroundImage:i=null,soundActions:s,endVideo:o=()=>{},translate:l,autoPlay:c,withoutControls:d,name:f=""}){const[m,_]=G.useState(!1),[g]=s,[S,y]=G.useState(0),[x,T]=G.useState(0),[A,E]=G.useState(!1),[C,R]=G.useState(!0),[N,O]=G.useState(!1),[M,B]=G.useState(),[L,F]=G.useState(0),[I,H]=G.useState(!1),W=t&&t.match(/\.m3u8(\?.+=.+)*$/i)&&rO.isSupported(),Z=t&&(t.match(/youtube/i)||t.match(/vimeo/i)),X=t&&(t.match(/.mp3/i)||t.match(/.ogg/i)||t.match(/.wav/i)||t.match(/.m4a/i)),$={ref:bt=>{B(bt)},src:t,style:{height:"100%",width:"100%"}},nt=()=>{e&&_(!0),E(!1),M.pause(),R(!0),O(!0),H(!1),u!=="document"&&u!=="lesson"&&o()},Q=()=>{o()},tt=()=>{R(!1),E(!1)},rt=()=>{E(!0)},ut=()=>{E(!1),y(M.duration)};G.useEffect(()=>{let bt;if(M){if(W){bt=new rO;const Tt=`${t}?v=${Math.floor(Math.random()*99999999)}`;bt.loadSource(Tt),bt.attachMedia(M),bt.on(rO.Events.FRAG_LOAD_PROGRESS,(Ct,Ft)=>{const{stats:It}=Ft;T(It.loaded*100/It.total)})}return()=>{bt&&bt.destroy(),bt=null}}},[W,t,M]);const st=()=>{M.currentTime-=15},ot=()=>{g("click-ui"),C?(M.play(),O(!1)):M.pause(),R(!C)},ht=(bt,Tt,Ct)=>{O(!1),M.currentTime=Tt?parseFloat((bt-Ct)/Tt*M.duration):0},vt=()=>{O(!1),M.currentTime=0,ot()},it=()=>{g("click-ui"),M.muted=!M.muted},lt=(bt,Tt,Ct)=>{M.muted=!1;const Ft=bt-Ct>=0?(bt-Ct)/Tt:0;M.volume=Ft*100>10?Ft:0,F(M.volume)};G.useEffect(()=>{let bt;return!I&&!C&&(bt=setTimeout(()=>{H(!0),clearTimeout(bt)},3e3)),()=>clearTimeout(bt)},[I,C]);const dt=()=>{I&&H(!1)},Et=i||XP,_t=Et===XP?"cover":"contain",pt={backgroundImage:`url("${Et}")`,backgroundSize:_t,backgroundRepeat:"no-repeat",backgroundPosition:"center center"};return P.jsx("div",{className:`video ${e&&!m&&!n?"forward-disabled":""}`,style:X?pt:null,children:Z?P.jsxs(P.Fragment,{children:[P.jsx("div",{className:"position--absolute right top z-index2",children:P.jsx("button",{type:"button","aria-label":l("storylines.misc.closePiece"),className:"gat--btn__round gat--btn__close",onClick:()=>{g("click-ui"),o()},children:P.jsx("span",{className:"icon-close"})})}),P.jsx("iframe",{className:"embeddedVideo",title:"title",...$})]}):P.jsxs(P.Fragment,{children:[P.jsx(fF,{documentType:u,visibility:I,mandatoryHasBeenViewed:m,audioAnimation:!!X,skip:o,mandatory:e,viewed:n,volume:M?M.volume:0,mute:it,muted:M?M.muted:!1,paused:C,finished:N,restart:vt,setTimePoint:ht,time:{duration:S,current:M?M.currentTime:0},rewind:st,pause:ot,volumeState:L,setVolume:lt,translate:l,withoutControls:d}),P.jsx("video",{"data-testid":"video-visor-video",autoPlay:c,onMouseMove:()=>dt(),onClick:()=>{dt()},onFocus:()=>{dt()},onCanPlayThrough:ut,onWaiting:rt,onEnded:nt,onError:Q,onPlaying:tt,...$,children:P.jsx("track",{kind:"captions"})}),A?P.jsxs("div",{className:"video-loading-container",style:{top:0,left:0},children:[P.jsx("div",{className:"video-loading-container-bg opacity-wrapper"}),P.jsx("div",{className:"popup-alert warning",children:P.jsx("div",{className:"popup-message",children:P.jsx("p",{children:Math.floor(x)})})})]}):null]})})}function PY({emitEvent:u,getEvent:t,name:e,documentType:n,document:i,documentId_labelId:s,soundActions:o,required:l,viewed:c,visible:d,img:f,imgId_labelId:m,withoutControls:_,autoPlay:g,keyboardControl:S}){const y=C=>t({type:"translate",payload:C}),{url:x}=i,T=G.useMemo(()=>({documentId:s,imgId:m,required:l,name:e,type:"video",viewed:c,documentType:n}),[s,m,l,e,c,n]),A=G.useCallback(()=>{u({type:"finishMedia",payload:T})},[u,T]);G.useEffect(()=>{d||A()},[A,d]);const E=S({disabled:c,forward:A,escape:A});return G.useEffect(()=>E(),[E]),d?P.jsx(y5,{autoPlay:g,withoutControls:_,backgroundImage:f==null?void 0:f.url,url:x,soundActions:o,documentType:n,required:l,viewed:c,endVideo:()=>A(),translate:y}):null}function m9({targetUid:u,emitEvent:t,success:e=!0,onFinish:n=()=>{},transition:i={type:"pan",speed:10}}){const{change:s}=Va.CameraControls.useStore(),o=$h.useThree(c=>c.camera),l=G.useRef();return G.useEffect(()=>{const c=()=>{t({type:"changeCamera",payload:{targetUid:u,transition:i}}),setTimeout(()=>{e&&t({type:"success"}),n()},200)};return o.addEventListener("transitionEnd",c),()=>{o.removeEventListener("transitionEnd",c)}},[o,t,n,e,u,i]),G.useEffect(()=>{s&&l.current!==u&&(s(u,i),l.current=u)},[s,u,i]),null}var pF={},g9={},v9={},T0={},y9={},_9={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.Doctype=u.CDATA=u.Tag=u.Style=u.Script=u.Comment=u.Directive=u.Text=u.Root=u.isTag=u.ElementType=void 0;var t;(function(n){n.Root="root",n.Text="text",n.Directive="directive",n.Comment="comment",n.Script="script",n.Style="style",n.Tag="tag",n.CDATA="cdata",n.Doctype="doctype"})(t=u.ElementType||(u.ElementType={}));function e(n){return n.type===t.Tag||n.type===t.Script||n.type===t.Style}u.isTag=e,u.Root=t.Root,u.Text=t.Text,u.Directive=t.Directive,u.Comment=t.Comment,u.Script=t.Script,u.Style=t.Style,u.Tag=t.Tag,u.CDATA=t.CDATA,u.Doctype=t.Doctype})(_9);var dn={},A0=Ki&&Ki.__extends||function(){var u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},u(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");u(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jE=Ki&&Ki.__assign||function(){return jE=Object.assign||function(u){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(u[i]=t[i])}return u},jE.apply(this,arguments)};Object.defineProperty(dn,"__esModule",{value:!0});dn.cloneNode=dn.hasChildren=dn.isDocument=dn.isDirective=dn.isComment=dn.isText=dn.isCDATA=dn.isTag=dn.Element=dn.Document=dn.CDATA=dn.NodeWithChildren=dn.ProcessingInstruction=dn.Comment=dn.Text=dn.DataNode=dn.Node=void 0;var Zr=_9,b9=function(){function u(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(u.prototype,"parentNode",{get:function(){return this.parent},set:function(t){this.parent=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"previousSibling",{get:function(){return this.prev},set:function(t){this.prev=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"nextSibling",{get:function(){return this.next},set:function(t){this.next=t},enumerable:!1,configurable:!0}),u.prototype.cloneNode=function(t){return t===void 0&&(t=!1),S9(this,t)},u}();dn.Node=b9;var jw=function(u){A0(t,u);function t(e){var n=u.call(this)||this;return n.data=e,n}return Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),t}(b9);dn.DataNode=jw;var mF=function(u){A0(t,u);function t(){var e=u!==null&&u.apply(this,arguments)||this;return e.type=Zr.ElementType.Text,e}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),t}(jw);dn.Text=mF;var gF=function(u){A0(t,u);function t(){var e=u!==null&&u.apply(this,arguments)||this;return e.type=Zr.ElementType.Comment,e}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),t}(jw);dn.Comment=gF;var vF=function(u){A0(t,u);function t(e,n){var i=u.call(this,n)||this;return i.name=e,i.type=Zr.ElementType.Directive,i}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),t}(jw);dn.ProcessingInstruction=vF;var zw=function(u){A0(t,u);function t(e){var n=u.call(this)||this;return n.children=e,n}return Object.defineProperty(t.prototype,"firstChild",{get:function(){var e;return(e=this.children[0])!==null&&e!==void 0?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(b9);dn.NodeWithChildren=zw;var yF=function(u){A0(t,u);function t(){var e=u!==null&&u.apply(this,arguments)||this;return e.type=Zr.ElementType.CDATA,e}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(zw);dn.CDATA=yF;var _F=function(u){A0(t,u);function t(){var e=u!==null&&u.apply(this,arguments)||this;return e.type=Zr.ElementType.Root,e}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(zw);dn.Document=_F;var bF=function(u){A0(t,u);function t(e,n,i,s){i===void 0&&(i=[]),s===void 0&&(s=e==="script"?Zr.ElementType.Script:e==="style"?Zr.ElementType.Style:Zr.ElementType.Tag);var o=u.call(this,i)||this;return o.name=e,o.attribs=n,o.type=s,o}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map(function(n){var i,s;return{name:n,value:e.attribs[n],namespace:(i=e["x-attribsNamespace"])===null||i===void 0?void 0:i[n],prefix:(s=e["x-attribsPrefix"])===null||s===void 0?void 0:s[n]}})},enumerable:!1,configurable:!0}),t}(zw);dn.Element=bF;function SF(u){return(0,Zr.isTag)(u)}dn.isTag=SF;function xF(u){return u.type===Zr.ElementType.CDATA}dn.isCDATA=xF;function EF(u){return u.type===Zr.ElementType.Text}dn.isText=EF;function TF(u){return u.type===Zr.ElementType.Comment}dn.isComment=TF;function AF(u){return u.type===Zr.ElementType.Directive}dn.isDirective=AF;function CF(u){return u.type===Zr.ElementType.Root}dn.isDocument=CF;function jY(u){return Object.prototype.hasOwnProperty.call(u,"children")}dn.hasChildren=jY;function S9(u,t){t===void 0&&(t=!1);var e;if(EF(u))e=new mF(u.data);else if(TF(u))e=new gF(u.data);else if(SF(u)){var n=t?hO(u.children):[],i=new bF(u.name,jE({},u.attribs),n);n.forEach(function(c){return c.parent=i}),u.namespace!=null&&(i.namespace=u.namespace),u["x-attribsNamespace"]&&(i["x-attribsNamespace"]=jE({},u["x-attribsNamespace"])),u["x-attribsPrefix"]&&(i["x-attribsPrefix"]=jE({},u["x-attribsPrefix"])),e=i}else if(xF(u)){var n=t?hO(u.children):[],s=new yF(n);n.forEach(function(d){return d.parent=s}),e=s}else if(CF(u)){var n=t?hO(u.children):[],o=new _F(n);n.forEach(function(d){return d.parent=o}),u["x-mode"]&&(o["x-mode"]=u["x-mode"]),e=o}else if(AF(u)){var l=new vF(u.name,u.data);u["x-name"]!=null&&(l["x-name"]=u["x-name"],l["x-publicId"]=u["x-publicId"],l["x-systemId"]=u["x-systemId"]),e=l}else throw new Error("Not implemented yet: ".concat(u.type));return e.startIndex=u.startIndex,e.endIndex=u.endIndex,u.sourceCodeLocation!=null&&(e.sourceCodeLocation=u.sourceCodeLocation),e}dn.cloneNode=S9;function hO(u){for(var t=u.map(function(n){return S9(n,!0)}),e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}(function(u){var t=Ki&&Ki.__createBinding||(Object.create?function(l,c,d,f){f===void 0&&(f=d);var m=Object.getOwnPropertyDescriptor(c,d);(!m||("get"in m?!c.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return c[d]}}),Object.defineProperty(l,f,m)}:function(l,c,d,f){f===void 0&&(f=d),l[f]=c[d]}),e=Ki&&Ki.__exportStar||function(l,c){for(var d in l)d!=="default"&&!Object.prototype.hasOwnProperty.call(c,d)&&t(c,l,d)};Object.defineProperty(u,"__esModule",{value:!0}),u.DomHandler=void 0;var n=_9,i=dn;e(dn,u);var s={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},o=function(){function l(c,d,f){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof d=="function"&&(f=d,d=s),typeof c=="object"&&(d=c,c=void 0),this.callback=c??null,this.options=d??s,this.elementCB=f??null}return l.prototype.onparserinit=function(c){this.parser=c},l.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},l.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},l.prototype.onerror=function(c){this.handleCallback(c)},l.prototype.onclosetag=function(){this.lastNode=null;var c=this.tagStack.pop();this.options.withEndIndices&&(c.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(c)},l.prototype.onopentag=function(c,d){var f=this.options.xmlMode?n.ElementType.Tag:void 0,m=new i.Element(c,d,void 0,f);this.addNode(m),this.tagStack.push(m)},l.prototype.ontext=function(c){var d=this.lastNode;if(d&&d.type===n.ElementType.Text)d.data+=c,this.options.withEndIndices&&(d.endIndex=this.parser.endIndex);else{var f=new i.Text(c);this.addNode(f),this.lastNode=f}},l.prototype.oncomment=function(c){if(this.lastNode&&this.lastNode.type===n.ElementType.Comment){this.lastNode.data+=c;return}var d=new i.Comment(c);this.addNode(d),this.lastNode=d},l.prototype.oncommentend=function(){this.lastNode=null},l.prototype.oncdatastart=function(){var c=new i.Text(""),d=new i.CDATA([c]);this.addNode(d),c.parent=d,this.lastNode=c},l.prototype.oncdataend=function(){this.lastNode=null},l.prototype.onprocessinginstruction=function(c,d){var f=new i.ProcessingInstruction(c,d);this.addNode(f)},l.prototype.handleCallback=function(c){if(typeof this.callback=="function")this.callback(c,this.dom);else if(c)throw c},l.prototype.addNode=function(c){var d=this.tagStack[this.tagStack.length-1],f=d.children[d.children.length-1];this.options.withStartIndices&&(c.startIndex=this.parser.startIndex),this.options.withEndIndices&&(c.endIndex=this.parser.endIndex),d.children.push(c),f&&(c.prev=f,f.next=c),c.parent=d,this.lastNode=null},l}();u.DomHandler=o,u.default=o})(y9);var RF={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.CARRIAGE_RETURN_PLACEHOLDER_REGEX=u.CARRIAGE_RETURN_PLACEHOLDER=u.CARRIAGE_RETURN_REGEX=u.CARRIAGE_RETURN=u.CASE_SENSITIVE_TAG_NAMES_MAP=u.CASE_SENSITIVE_TAG_NAMES=void 0,u.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],u.CASE_SENSITIVE_TAG_NAMES_MAP=u.CASE_SENSITIVE_TAG_NAMES.reduce(function(t,e){return t[e.toLowerCase()]=e,t},{}),u.CARRIAGE_RETURN="\r",u.CARRIAGE_RETURN_REGEX=new RegExp(u.CARRIAGE_RETURN,"g"),u.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now().toString(),"__"),u.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(u.CARRIAGE_RETURN_PLACEHOLDER,"g")})(RF);Object.defineProperty(T0,"__esModule",{value:!0});T0.formatAttributes=wF;T0.hasOpenTag=kY;T0.escapeSpecialCharacters=FY;T0.revertEscapedCharacters=DF;T0.formatDOM=OF;var nR=y9,qE=RF;function zY(u){return qE.CASE_SENSITIVE_TAG_NAMES_MAP[u]}function wF(u){for(var t={},e=0,n=u.length;e<n;e++){var i=u[e];t[i.name]=i.value}return t}function BY(u){u=u.toLowerCase();var t=zY(u);return t||u}function kY(u,t){var e="<"+t,n=u.toLowerCase().indexOf(e);if(n===-1)return!1;var i=u[n+e.length];return i===">"||i===" "||i===" "||i===`
43
43
  `||i==="\r"||i==="/"}function FY(u){return u.replace(qE.CARRIAGE_RETURN_REGEX,qE.CARRIAGE_RETURN_PLACEHOLDER)}function DF(u){return u.replace(qE.CARRIAGE_RETURN_PLACEHOLDER_REGEX,qE.CARRIAGE_RETURN)}function OF(u,t,e){var n,i,s,o;t===void 0&&(t=null);for(var l=[],c,d=0,f=u.length;d<f;d++){var m=u[d];switch(m.nodeType){case 1:{var _=BY(m.nodeName);c=new nR.Element(_,wF(m.attributes)),c.children=OF(_==="template"?m.content.childNodes:m.childNodes,c);break}case 3:c=new nR.Text(DF((n=m.nodeValue)!==null&&n!==void 0?n:""));break;case 8:c=new nR.Comment((i=m.nodeValue)!==null&&i!==void 0?i:"");break;default:continue}var g=(s=l[d-1])!==null&&s!==void 0?s:null;g&&(g.next=c),c.parent=t,c.prev=g,c.next=null,l.push(c)}return e&&(c=new nR.ProcessingInstruction(e.substring(0,e.indexOf(" ")).toLowerCase(),e),c.next=(o=l[0])!==null&&o!==void 0?o:null,c.parent=t,l.unshift(c),l[1]&&(l[1].prev=l[0])),l}Object.defineProperty(v9,"__esModule",{value:!0});v9.default=GY;var aE=T0,qP="html",iR="head",__="body",IY=/<([a-zA-Z]+[0-9]?)/,_5=function(u,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},pN=function(u,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},QP=typeof window=="object"&&window.DOMParser;if(typeof QP=="function"){var UY=new QP,HY="text/html";pN=function(u,t){return t&&(u="<".concat(t,">").concat(u,"</").concat(t,">")),UY.parseFromString(u,HY)},_5=pN}if(typeof document=="object"&&document.implementation){var aR=document.implementation.createHTMLDocument();_5=function(u,t){if(t){var e=aR.documentElement.querySelector(t);return e&&(e.innerHTML=u),aR}return aR.documentElement.innerHTML=u,aR}}var sR=typeof document=="object"&&document.createElement("template"),mN;sR&&sR.content&&(mN=function(u){return sR.innerHTML=u,sR.content.childNodes});var WP=function(){return document.createDocumentFragment().childNodes};function GY(u){var t,e,n,i,s,o;u=(0,aE.escapeSpecialCharacters)(u);var l=IY.exec(u),c=(t=l==null?void 0:l[1])===null||t===void 0?void 0:t.toLowerCase();switch(c){case qP:{var d=pN(u);if(!(0,aE.hasOpenTag)(u,iR)){var f=d.querySelector(iR);(e=f==null?void 0:f.parentNode)===null||e===void 0||e.removeChild(f)}if(!(0,aE.hasOpenTag)(u,__)){var f=d.querySelector(__);(n=f==null?void 0:f.parentNode)===null||n===void 0||n.removeChild(f)}return d.querySelectorAll(qP)}case iR:case __:{var m=_5(u).querySelectorAll(c);return(0,aE.hasOpenTag)(u,__)&&(0,aE.hasOpenTag)(u,iR)?(s=(i=m[0].parentNode)===null||i===void 0?void 0:i.childNodes)!==null&&s!==void 0?s:WP():m}default:{if(mN)return mN(u);var f=_5(u,__).querySelector(__);return(o=f==null?void 0:f.childNodes)!==null&&o!==void 0?o:WP()}}}var VY=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(g9,"__esModule",{value:!0});g9.default=qY;var YY=VY(v9),KY=T0,XY=/<(![a-zA-Z\s]+)>/;function qY(u){if(typeof u!="string")throw new TypeError("First argument must be a string");if(!u)return[];var t=XY.exec(u),e=t?t[1]:void 0;return(0,KY.formatDOM)((0,YY.default)(u),null,e)}var Bw={},nc={},kw={},QY=0;kw.SAME=QY;var WY=1;kw.CAMELCASE=WY;kw.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1};const MF=0,C0=1,Fw=2,Iw=3,x9=4,NF=5,LF=6;function ZY(u){return Os.hasOwnProperty(u)?Os[u]:null}function Er(u,t,e,n,i,s,o){this.acceptsBooleans=t===Fw||t===Iw||t===x9,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=e,this.propertyName=u,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}const Os={},JY=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];JY.forEach(u=>{Os[u]=new Er(u,MF,!1,u,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([u,t])=>{Os[u]=new Er(u,C0,!1,t,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(u=>{Os[u]=new Er(u,Fw,!1,u.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(u=>{Os[u]=new Er(u,Fw,!1,u,null,!1,!1)});["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(u=>{Os[u]=new Er(u,Iw,!1,u.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(u=>{Os[u]=new Er(u,Iw,!0,u,null,!1,!1)});["capture","download"].forEach(u=>{Os[u]=new Er(u,x9,!1,u,null,!1,!1)});["cols","rows","size","span"].forEach(u=>{Os[u]=new Er(u,LF,!1,u,null,!1,!1)});["rowSpan","start"].forEach(u=>{Os[u]=new Er(u,NF,!1,u.toLowerCase(),null,!1,!1)});const E9=/[\-\:]([a-z])/g,T9=u=>u[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(u=>{const t=u.replace(E9,T9);Os[t]=new Er(t,C0,!1,u,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(u=>{const t=u.replace(E9,T9);Os[t]=new Er(t,C0,!1,u,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(u=>{const t=u.replace(E9,T9);Os[t]=new Er(t,C0,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(u=>{Os[u]=new Er(u,C0,!1,u.toLowerCase(),null,!1,!1)});const $Y="xlinkHref";Os[$Y]=new Er("xlinkHref",C0,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(u=>{Os[u]=new Er(u,C0,!1,u.toLowerCase(),null,!0,!0)});const{CAMELCASE:tK,SAME:eK,possibleStandardNames:ZP}=kw,nK=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",iK=nK+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",aK=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+iK+"]*$")),sK=Object.keys(ZP).reduce((u,t)=>{const e=ZP[t];return e===eK?u[t]=t:e===tK?u[t.toLowerCase()]=t:u[t]=e,u},{});nc.BOOLEAN=Iw;nc.BOOLEANISH_STRING=Fw;nc.NUMERIC=NF;nc.OVERLOADED_BOOLEAN=x9;nc.POSITIVE_NUMERIC=LF;nc.RESERVED=MF;nc.STRING=C0;nc.getPropertyInfo=ZY;nc.isCustomAttribute=aK;nc.possibleStandardNames=sK;var A9={},C9={},JP=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,rK=/\n/g,oK=/^\s*/,lK=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,uK=/^:\s*/,cK=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,dK=/^[;\s]*/,hK=/^\s+|\s+$/g,fK=`
44
- `,$P="/",tj="*",hg="",pK="comment",mK="declaration";function gK(u,t){if(typeof u!="string")throw new TypeError("First argument must be a string");if(!u)return[];t=t||{};var e=1,n=1;function i(S){var y=S.match(rK);y&&(e+=y.length);var x=S.lastIndexOf(fK);n=~x?S.length-x:n+S.length}function s(){var S={line:e,column:n};return function(y){return y.position=new o(S),d(),y}}function o(S){this.start=S,this.end={line:e,column:n},this.source=t.source}o.prototype.content=u;function l(S){var y=new Error(t.source+":"+e+":"+n+": "+S);if(y.reason=S,y.filename=t.source,y.line=e,y.column=n,y.source=u,!t.silent)throw y}function c(S){var y=S.exec(u);if(y){var x=y[0];return i(x),u=u.slice(x.length),y}}function d(){c(oK)}function f(S){var y;for(S=S||[];y=m();)y!==!1&&S.push(y);return S}function m(){var S=s();if(!($P!=u.charAt(0)||tj!=u.charAt(1))){for(var y=2;hg!=u.charAt(y)&&(tj!=u.charAt(y)||$P!=u.charAt(y+1));)++y;if(y+=2,hg===u.charAt(y-1))return l("End of comment missing");var x=u.slice(2,y-2);return n+=2,i(x),u=u.slice(y),n+=2,S({type:pK,comment:x})}}function _(){var S=s(),y=c(lK);if(y){if(m(),!c(uK))return l("property missing ':'");var x=c(cK),T=S({type:mK,property:ej(y[0].replace(JP,hg)),value:x?ej(x[0].replace(JP,hg)):hg});return c(dK),T}}function g(){var S=[];f(S);for(var y;y=_();)y!==!1&&(S.push(y),f(S));return S}return d(),g()}function ej(u){return u?u.replace(hK,hg):hg}var vK=gK,yK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(C9,"__esModule",{value:!0});C9.default=bK;const _K=yK(vK);function bK(u,t){let e=null;if(!u||typeof u!="string")return e;const n=(0,_K.default)(u),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(e=e||{},e[o]=l)}),e}var Uw={};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.camelCase=void 0;var SK=/^--[a-zA-Z0-9_-]+$/,xK=/-([a-z])/g,EK=/^[^-]+$/,TK=/^-(webkit|moz|ms|o|khtml)-/,AK=/^-(ms)-/,CK=function(u){return!u||EK.test(u)||SK.test(u)},RK=function(u,t){return t.toUpperCase()},nj=function(u,t){return"".concat(t,"-")},wK=function(u,t){return t===void 0&&(t={}),CK(u)?u:(u=u.toLowerCase(),t.reactCompat?u=u.replace(AK,nj):u=u.replace(TK,nj),u.replace(xK,RK))};Uw.camelCase=wK;var DK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}},OK=DK(C9),MK=Uw;function gN(u,t){var e={};return!u||typeof u!="string"||(0,OK.default)(u,function(n,i){n&&i&&(e[(0,MK.camelCase)(n,t)]=i)}),e}gN.default=gN;var NK=gN;(function(u){var t=Ki&&Ki.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(u,"__esModule",{value:!0}),u.returnFirstArg=u.canTextBeChildOfNode=u.ELEMENTS_WITH_NO_TEXT_CHILDREN=u.PRESERVE_CUSTOM_ATTRIBUTES=void 0,u.isCustomComponent=s,u.setStyleProp=l;var e=G,n=t(NK),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function s(f,m){return f.includes("-")?!i.has(f):!!(m&&typeof m.is=="string")}var o={reactCompat:!0};function l(f,m){if(typeof f=="string"){if(!f.trim()){m.style={};return}try{m.style=(0,n.default)(f,o)}catch{m.style={}}}}u.PRESERVE_CUSTOM_ATTRIBUTES=Number(e.version.split(".")[0])>=16,u.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var c=function(f){return!u.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(f.name)};u.canTextBeChildOfNode=c;var d=function(f){return f};u.returnFirstArg=d})(A9);Object.defineProperty(Bw,"__esModule",{value:!0});Bw.default=zK;var ME=nc,ij=A9,LK=["checked","value"],PK=["input","select","textarea"],jK={reset:!0,submit:!0};function zK(u,t){u===void 0&&(u={});var e={},n=!!(u.type&&jK[u.type]);for(var i in u){var s=u[i];if((0,ME.isCustomAttribute)(i)){e[i]=s;continue}var o=i.toLowerCase(),l=aj(o);if(l){var c=(0,ME.getPropertyInfo)(l);switch(LK.includes(l)&&PK.includes(t)&&!n&&(l=aj("default"+o)),e[l]=s,c==null?void 0:c.type){case ME.BOOLEAN:e[l]=!0;break;case ME.OVERLOADED_BOOLEAN:s===""&&(e[l]=!0);break}continue}ij.PRESERVE_CUSTOM_ATTRIBUTES&&(e[i]=s)}return(0,ij.setStyleProp)(u.style,e),e}function aj(u){return ME.possibleStandardNames[u]}var R9={},BK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(R9,"__esModule",{value:!0});R9.default=PF;var fO=G,kK=BK(Bw),zE=A9,FK={cloneElement:fO.cloneElement,createElement:fO.createElement,isValidElement:fO.isValidElement};function PF(u,t){var e,n,i,s,o;t===void 0&&(t={});for(var l=[],c=typeof t.replace=="function",d=(e=t.transform)!==null&&e!==void 0?e:zE.returnFirstArg,f=(n=t.library)!==null&&n!==void 0?n:FK,m=f.cloneElement,_=f.createElement,g=f.isValidElement,S=u.length,y=0;y<S;y++){var x=u[y];if(c){var T=(i=t.replace)===null||i===void 0?void 0:i.call(t,x,y);if(g(T)){S>1&&(T=m(T,{key:(s=T.key)!==null&&s!==void 0?s:y})),l.push(d(T,x,y));continue}}if(x.type==="text"){var A=!x.data.trim().length;if(A&&x.parent&&!(0,zE.canTextBeChildOfNode)(x.parent)||t.trim&&A)continue;l.push(d(x.data,x,y));continue}var E=x,C={};IK(E)?((0,zE.setStyleProp)(E.attribs.style,E.attribs),C=E.attribs):E.attribs&&(C=(0,kK.default)(E.attribs,E.name));var R=void 0;switch(x.type){case"script":case"style":x.children[0]&&(C.dangerouslySetInnerHTML={__html:x.children[0].data});break;case"tag":x.name==="textarea"&&x.children[0]?C.defaultValue=x.children[0].data:!((o=x.children)===null||o===void 0)&&o.length&&(R=PF(x.children,t));break;default:continue}S>1&&(C.key=y),l.push(d(_(x.name,C,R),x,y))}return l.length===1?l[0]:l}function IK(u){return zE.PRESERVE_CUSTOM_ATTRIBUTES&&u.type==="tag"&&(0,zE.isCustomComponent)(u.name,u.attribs)}(function(u){var t=Ki&&Ki.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(u,"__esModule",{value:!0}),u.htmlToDOM=u.domToReact=u.attributesToProps=u.Text=u.ProcessingInstruction=u.Element=u.Comment=void 0,u.default=l;var e=t(g9);u.htmlToDOM=e.default;var n=t(Bw);u.attributesToProps=n.default;var i=t(R9);u.domToReact=i.default;var s=y9;Object.defineProperty(u,"Comment",{enumerable:!0,get:function(){return s.Comment}}),Object.defineProperty(u,"Element",{enumerable:!0,get:function(){return s.Element}}),Object.defineProperty(u,"ProcessingInstruction",{enumerable:!0,get:function(){return s.ProcessingInstruction}}),Object.defineProperty(u,"Text",{enumerable:!0,get:function(){return s.Text}});var o={lowerCaseAttributeNames:!1};function l(c,d){var f;if(typeof c!="string")throw new TypeError("First argument must be a string");return c?(0,i.default)((0,e.default)(c,(f=d==null?void 0:d.htmlparser2)!==null&&f!==void 0?f:o),d):[]}})(pF);const sj=ay(pF),bi=sj.default||sj;function UK({goToLecture:u=!1,close:t=()=>{},minutes:e=0,seconds:n=0,btnText:i}){return P.jsx("div",{className:"lectures--buttons",children:u?P.jsx("button",{type:"button",className:"gat--btn__navigation",onClick:()=>t(),"aria-label":i,children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})}):P.jsx("button",{type:"button",className:"gat--btn__count","data-testid":"countdown",children:P.jsxs("span",{children:[e<10?`0${e}`:e,":",n<10?`0${n}`:n]})})})}const rR=()=>{},rj={},sy=({voice:u,text:t,audioType:e,loop:n=!1,started:i=!0,audio:s,soundActions:o,getEvent:l,volume:c=.5,onFinish:d=rR,onMute:f=rR,onError:m=rR,onStart:_=rR,pauseTTS:g})=>{const[S,y,x,T]=o,A=!s&&!u,[E,C]=G.useState(!1),R=G.useRef({url:"",cc:"tts"}),N=G.useCallback(F=>l({type:"translate",payload:F}),[l]),O=G.useCallback(({id:F,type:I="base"})=>{var Z;const H=N("usedVoices"),W=N("gameCharacters");return I==="base"?H==null?void 0:H[F]:I==="character"?(Z=W==null?void 0:W[F])==null?void 0:Z.voiceId:null},[N]),M=G.useCallback((F,I="tts")=>{if(R.current.url!==F)return R.current={url:F,cc:I},S(F,I,n,c,d,_,f,m)},[S,n,c,d,_,f,m]),B=G.useCallback(async F=>{if(E&&F.voiceId&&F.text){let I=rj[`${F.voiceId}_${F.text}`];try{I||(I=await l({type:"getSpeech",payload:F}),I?rj[`${F.voiceId}_${F.text}`]=I:m()),I&&M(I)}catch{m()}}else m()},[l,E,m,M]),L=G.useCallback(()=>{R.current.url&&y(R.current.cc)},[y]);return G.useEffect(()=>(C(!0),()=>{C(!1),L()}),[L]),G.useEffect(()=>{g?x():T()},[x,g,T]),G.useEffect(()=>{A&&L()},[A,L]),G.useEffect(()=>{if(E&&i)if(e==="voice"&&(u!=null&&u.id)){const F=O(u);B({voiceId:F,text:t})}else(e==="file"||!e)&&s?M(s==null?void 0:s.url):m()},[s,e,O,E,m,B,M,i,t,u]),[L]},Hw=u=>{const t=document.createElement("div");return t.innerHTML=u,t.textContent||t.innerText||""},HK=.2;function GK({emitEvent:u=()=>{},getEvent:t,name:e="",name_labelId:n,required:i=!1,text:s="",text_labelId:o,visible:l=!1,documentType:c="",viewed:d=!1,soundActions:f,backgroundImage:m,hideBackgroundImageTheme:_=!1,keyboardControl:g,audio:S,audioType:y,audioVolume:x,voice:T,pause:A,styles:E="",context:C={}}){const[R,N]=G.useState(),[O,M]=G.useState(!1),[B,L]=G.useState(0),F=s,I=Math.trunc(F.split(" ").length*HK),H=!i||i&&B>=I||i&&!l,[W]=f,Z=`${e}. ${Hw(s)}`;sy({audioType:y,voice:T,text:Z,audio:S,soundActions:f,getEvent:t,volume:x,pauseTTS:A});const X=ot=>t({type:"translate",payload:ot}),$=G.useCallback(()=>{H&&(W("click-ui"),u({type:"finishMedia",payload:{name:n,type:"text",text:o,documentType:c}}))},[c,u,H,n,o,W]),nt=g({disabled:d,forward:$,escape:$});G.useEffect(()=>nt(),[nt]),G.useEffect(()=>{if(!l&&!O&&($(),M(!0)),i&&l){const ot=setInterval(()=>{L(ht=>ht+1)},1e3);return N(ot),()=>{clearInterval(ot)}}},[$,i,O,l]),G.useEffect(()=>{B===I&&clearInterval(R)},[R,B,I]);const Q=I-B,tt=Math.floor(Q/60),rt=Q%60,ut=G.useMemo(()=>{let ot="";return d?ot="notes--results":(ot="lectures--container",E&&(ot+=` lectures--container--${E}`),m!=null&&m.url&&(ot+=" lectures--container--with-custom-bg"),E&&_&&(ot+=" disable-background-image")),ot},[m==null?void 0:m.url,_,E,d]),st={backgroundImage:m!=null&&m.url?`url('${m.url}')`:""};return l?P.jsx("div",{className:ut,style:st,children:P.jsx("div",{className:d?"":"lectures__overlay",children:P.jsxs("div",{className:d?"notes--results__text":`lectures lectures--${E}`,children:[P.jsx("div",{className:"lectures--title",children:e}),P.jsxs("div",{className:"lectures--text",dir:"auto",children:[P.jsx("div",{children:F?bi(F):null}),d?null:P.jsx(UK,{goToLecture:H,close:$,minutes:tt,seconds:rt,btnText:X("screens.continue")})]})]})})}):null}function $R({character:u={name:"",url:"",type:"",resource:{resourceId:""}},active:t=!1,slot:e=0,lowQuality:n}){var _;const i=u.type==="image",s=u.type==="character",o=u.type==="object",l=(_=u==null?void 0:u.resource)==null?void 0:_.url,c=()=>i?`url(${l})`:s&&n?`url(${l.replace("character.glb","face.png")})`:o&&n?`url(${l.replace("object.glb","thumbnail.png")})`:"",d=()=>i?"contain":s||o?"auto 95%":"",f=()=>i?"center":s||o?"center bottom":"",m=i||n?{backgroundImage:c(),backgroundRepeat:"no-repeat",backgroundPosition:f(),backgroundSize:d()}:{};return P.jsx("div",{className:`conversation--character__item ${t?"active":""} ${e}`,style:m,children:t&&u.name?P.jsx("span",{className:"conversation--character__name",children:u.name}):null},u.name)}$R.propTypes={character:$t.shape({name:$t.string,url:$t.string,type:$t.string,emotion:$t.string,uid:$t.string,resource:$t.shape({resourceId:$t.string,url:$t.string})}),active:$t.bool,slot:$t.number};const VK=new Oa.Vector3(0,14.63,16),YK=rF(),KK=new _H.GLTFLoader,oj=new Oa.Box3,oR=new Oa.Vector3,lj=new Oa.Vector3;function XK({character:u,ttsStarted:t,active:e,onLoad:n}){var _,g,S;const i=G.useRef(null),s=G.useRef(null),o=u.type==="character",l=G.useRef(),c=G.useMemo(()=>{var y,x,T,A,E,C,R,N;if(o){if(u.animationId&&((y=u.animation)!=null&&y.url))return u.animation;const O=u.emotion==="neutral"?"idle":c;return(A=(T=(x=u==null?void 0:u.resource)==null?void 0:x.animations)==null?void 0:T[O])!=null&&A.url?(C=(E=u==null?void 0:u.resource)==null?void 0:E.animations)==null?void 0:C[O]:(N=(R=u==null?void 0:u.resource)==null?void 0:R.animations)==null?void 0:N.idle}return{}},[u.emotion,u==null?void 0:u.animationId,u==null?void 0:u.animation,(_=u==null?void 0:u.resource)==null?void 0:_.animations,o]),d=G.useCallback(()=>{if(!l.current)return;const y=l.current.animator;if(!y)return;const x=y.getAction("talking");x&&x.setEffectiveWeight(0)},[]),f=G.useCallback(()=>{var R,N,O,M,B,L;const y=l.current;if(!y)return;const x=(O=(N=(R=u==null?void 0:u.resource)==null?void 0:R.animations)==null?void 0:N.talking)==null?void 0:O.url,A=((L=(B=(M=u==null?void 0:u.resource)==null?void 0:M.animations)==null?void 0:B["talking-short"])==null?void 0:L.url)||x,E=y.animator;if(!E)return;const C=E.getAction("talking");C?C.setEffectiveWeight(1):KK.load(A,({animations:F})=>{const I=E.register("talking",F[0]);I.play(),I.setEffectiveWeight(1)})},[(g=u==null?void 0:u.resource)==null?void 0:g.animations]),m=G.useCallback(y=>{if(u.type==="character"){const x=y.getObjectByName("Head_M",!0);x?(x.updateMatrixWorld(!0),oj.setFromObject(y),oj.getSize(lj),x.getWorldPosition(oR),i.current.lookAt(oR)):i.current.position.setY(lj.y-1.5*1.3),i.current.zoom=1.5;const T=()=>{n==null||n(),y.removeEventListener("update_bounds",T)};y.addEventListener("update_bounds",T)}else Mz(y,i.current),i.current.zoom=1;i.current.updateProjectionMatrix()},[u,n]);return $h.useFrame(({gl:y,scene:x})=>{if(t&&e?f():d(),i.current&&s.current){const T=document.querySelectorAll(".conversation--character__item")[u.slot];if(T){const A=T.getBoundingClientRect(),E=T.parentNode.getBoundingClientRect(),[C,R]=[A.right-A.left,A.bottom-A.top];if(i.current.aspect=C/R,i.current.updateProjectionMatrix(),o&&l.current){const M=l.current.getObjectByName("Head_M",!0);M&&(M.getWorldPosition(oR),i.current.lookAt(oR))}const N={top:A.top-E.top,right:A.right-E.right,left:A.left-E.left,bottom:A.bottom-E.bottom},O=YK?24:40;y.isWebGPURenderer?N.bottom+=e?0:O:N.bottom+=e?-O:O,y.setViewport(N.left,N.bottom,C,R),y.setScissor(N.left,N.bottom,C,R),s.current.environment=x.environment,y.render(s.current,i.current)}}},1),!((S=u.resource)!=null&&S.url)||u.type==="image"?null:P.jsxs("scene",{ref:s,children:[P.jsx(Va.SceneResource,{ref:l,name:`char_${u.uid}`,url:u.resource.url,animationStates:{idle:c.url},type:u.type,onRender:m,texturable:!0,interactive:!1,generate:!1,merge:!1}),P.jsx(WN.PerspectiveCamera,{ref:i,fov:35,position:VK,rotation:[0,0,0],onUpdate:y=>{y.layers.enableAll()},manual:!0}),P.jsx(Lz,{})]})}function qK({characters:u,slots:t,ttsStarted:e,flex:n,currentMessage:i,lod:s}){const[o,l]=G.useState(!1);return G.useEffect(()=>{const c=()=>{l(!0)};return Va.ProgressManager.addEventListener("loaded",c),()=>{Va.ProgressManager.removeEventListener("loaded",c)}},[]),$h.useFrame(({gl:c})=>{c.setScissorTest(!1),c.clear(!0,!0),c.setScissorTest(!0)}),P.jsx(Va.QualityManager,{lod:s,active:o,children:t.map((c,d)=>{let f=null;const m=u.findIndex(_=>_&&_.uid===c.uid);if(m>=0){const _=n?m:d;return f={...u[m]},f.slot=_,P.jsx(XK,{character:f,active:i.position===_,ttsStarted:e},`${`${f.uid}_${d}`}`)}return null})})}function QK(u){return u.lowQuality?null:P.jsxs(Va.Renderer,{className:"conversation--canvas",style:{position:"absolute",width:"100%",height:"100%"},gl:{antialias:!0},fullscreen:!1,onCreated:({gl:t})=>{t.setClearColor("white",0)},children:[P.jsx(Va.SettingsController,{current:{animate:u.pause}}),P.jsx(WN.Environment,{files:"https://min.gamelearn.io/statics/envs/envmap_1k.hdr"}),P.jsx(qK,{...u})]})}function w9({characters:u=[],actors:t,lodSettings:e,ttsStarted:n,currentMessage:i={},flex:s=!0,slots:o=[],children:l,pause:c,getEvent:d}){const f=({character:T,active:A,slot:E})=>({character:T,active:A,emotion:A?i.emotion:"neutral",slot:E}),m=G.useMemo(()=>d({type:"currentLod"}),[d]),_=m==="divideby64",g=o.reduce((T,A)=>{var R,N;const E=t==null?void 0:t.find(O=>O.uid===A.uid),C={...A};if(A.character)C.name=A.alias||A.character.name,C.resource=C.character.resource,C.position=C.position>=0?C.position:-1,delete C.character,C.type="character",T.push(C);else if(E){const{resource:O}=E;C.name=A.alias||A.name,C.position=C.position>=0?C.position:-1,C.resource=O,C.type=E.type,T.push(C)}else A.type?(C.name=A.alias||((R=A.character)==null?void 0:R.name)||A.name,C.resource=((N=C.character)==null?void 0:N.resource)||A.resource,C.position=C.position>=0?C.position:-1,delete C.character,C.type=A.type,T.push(C)):s||T.push(null);return T},[]),S=g.length&&g.some(T=>T),y=u.filter(T=>o.find(A=>T.uid===A.uid));function x(){return S?g.map((T,A)=>T?P.jsx($R,{lowQuality:_,...f({character:T,active:i.position===T.position,slot:A})},`${T.uid+A}`):P.jsx("div",{className:`conversation--character__item void ${A}`},`void_${0+A}`)):s?y.map((T,A)=>{const E=i.position===A;return P.jsx($R,{...f({character:T,active:E,slot:A})},`${T.uid+A}`)}):o.length>0?o.map((T,A)=>{const E=u.find(C=>C.uid===T.uid);if(E){const C=i.position===A;return E.name=T.alias||E.name,P.jsx($R,{...f({character:E,active:C,slot:A})},`${E.uid+A}`)}return P.jsx("div",{className:`conversation--character__item void ${A}`},`${0+A}`)}):null}return P.jsxs("div",{className:"conversation--characters",children:[P.jsx(QK,{characters:S?g:y,slots:o,flex:s,currentMessage:i,lodSettings:e,ttsStarted:n,pause:c,lod:m,lowQuality:_}),l||P.jsx(x,{})]})}function uj({inherited:u,options:t,selectedChoice:e,selectChoice:n,showingResults:i,simplifiedOptions:s,required:o}){const[l,c]=G.useState(null),d=m=>{s?(c(m),setTimeout(()=>{n(m),c(null)},1e3)):n(m)},f=m=>!!(i&&(e==null?void 0:e.id)===m.id||(e==null?void 0:e.right)===!0||i&&!o);return t==null?void 0:t.filter(m=>m.text).map(m=>P.jsxs("div",{className:`${u?"conversation--question custom-radio":"custom-radio"}
44
+ `,$P="/",tj="*",hg="",pK="comment",mK="declaration";function gK(u,t){if(typeof u!="string")throw new TypeError("First argument must be a string");if(!u)return[];t=t||{};var e=1,n=1;function i(S){var y=S.match(rK);y&&(e+=y.length);var x=S.lastIndexOf(fK);n=~x?S.length-x:n+S.length}function s(){var S={line:e,column:n};return function(y){return y.position=new o(S),d(),y}}function o(S){this.start=S,this.end={line:e,column:n},this.source=t.source}o.prototype.content=u;function l(S){var y=new Error(t.source+":"+e+":"+n+": "+S);if(y.reason=S,y.filename=t.source,y.line=e,y.column=n,y.source=u,!t.silent)throw y}function c(S){var y=S.exec(u);if(y){var x=y[0];return i(x),u=u.slice(x.length),y}}function d(){c(oK)}function f(S){var y;for(S=S||[];y=m();)y!==!1&&S.push(y);return S}function m(){var S=s();if(!($P!=u.charAt(0)||tj!=u.charAt(1))){for(var y=2;hg!=u.charAt(y)&&(tj!=u.charAt(y)||$P!=u.charAt(y+1));)++y;if(y+=2,hg===u.charAt(y-1))return l("End of comment missing");var x=u.slice(2,y-2);return n+=2,i(x),u=u.slice(y),n+=2,S({type:pK,comment:x})}}function _(){var S=s(),y=c(lK);if(y){if(m(),!c(uK))return l("property missing ':'");var x=c(cK),T=S({type:mK,property:ej(y[0].replace(JP,hg)),value:x?ej(x[0].replace(JP,hg)):hg});return c(dK),T}}function g(){var S=[];f(S);for(var y;y=_();)y!==!1&&(S.push(y),f(S));return S}return d(),g()}function ej(u){return u?u.replace(hK,hg):hg}var vK=gK,yK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(C9,"__esModule",{value:!0});C9.default=bK;const _K=yK(vK);function bK(u,t){let e=null;if(!u||typeof u!="string")return e;const n=(0,_K.default)(u),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(e=e||{},e[o]=l)}),e}var Uw={};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.camelCase=void 0;var SK=/^--[a-zA-Z0-9_-]+$/,xK=/-([a-z])/g,EK=/^[^-]+$/,TK=/^-(webkit|moz|ms|o|khtml)-/,AK=/^-(ms)-/,CK=function(u){return!u||EK.test(u)||SK.test(u)},RK=function(u,t){return t.toUpperCase()},nj=function(u,t){return"".concat(t,"-")},wK=function(u,t){return t===void 0&&(t={}),CK(u)?u:(u=u.toLowerCase(),t.reactCompat?u=u.replace(AK,nj):u=u.replace(TK,nj),u.replace(xK,RK))};Uw.camelCase=wK;var DK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}},OK=DK(C9),MK=Uw;function gN(u,t){var e={};return!u||typeof u!="string"||(0,OK.default)(u,function(n,i){n&&i&&(e[(0,MK.camelCase)(n,t)]=i)}),e}gN.default=gN;var NK=gN;(function(u){var t=Ki&&Ki.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(u,"__esModule",{value:!0}),u.returnFirstArg=u.canTextBeChildOfNode=u.ELEMENTS_WITH_NO_TEXT_CHILDREN=u.PRESERVE_CUSTOM_ATTRIBUTES=void 0,u.isCustomComponent=s,u.setStyleProp=l;var e=G,n=t(NK),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function s(f,m){return f.includes("-")?!i.has(f):!!(m&&typeof m.is=="string")}var o={reactCompat:!0};function l(f,m){if(typeof f=="string"){if(!f.trim()){m.style={};return}try{m.style=(0,n.default)(f,o)}catch{m.style={}}}}u.PRESERVE_CUSTOM_ATTRIBUTES=Number(e.version.split(".")[0])>=16,u.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var c=function(f){return!u.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(f.name)};u.canTextBeChildOfNode=c;var d=function(f){return f};u.returnFirstArg=d})(A9);Object.defineProperty(Bw,"__esModule",{value:!0});Bw.default=zK;var ME=nc,ij=A9,LK=["checked","value"],PK=["input","select","textarea"],jK={reset:!0,submit:!0};function zK(u,t){u===void 0&&(u={});var e={},n=!!(u.type&&jK[u.type]);for(var i in u){var s=u[i];if((0,ME.isCustomAttribute)(i)){e[i]=s;continue}var o=i.toLowerCase(),l=aj(o);if(l){var c=(0,ME.getPropertyInfo)(l);switch(LK.includes(l)&&PK.includes(t)&&!n&&(l=aj("default"+o)),e[l]=s,c==null?void 0:c.type){case ME.BOOLEAN:e[l]=!0;break;case ME.OVERLOADED_BOOLEAN:s===""&&(e[l]=!0);break}continue}ij.PRESERVE_CUSTOM_ATTRIBUTES&&(e[i]=s)}return(0,ij.setStyleProp)(u.style,e),e}function aj(u){return ME.possibleStandardNames[u]}var R9={},BK=Ki&&Ki.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(R9,"__esModule",{value:!0});R9.default=PF;var fO=G,kK=BK(Bw),zE=A9,FK={cloneElement:fO.cloneElement,createElement:fO.createElement,isValidElement:fO.isValidElement};function PF(u,t){var e,n,i,s,o;t===void 0&&(t={});for(var l=[],c=typeof t.replace=="function",d=(e=t.transform)!==null&&e!==void 0?e:zE.returnFirstArg,f=(n=t.library)!==null&&n!==void 0?n:FK,m=f.cloneElement,_=f.createElement,g=f.isValidElement,S=u.length,y=0;y<S;y++){var x=u[y];if(c){var T=(i=t.replace)===null||i===void 0?void 0:i.call(t,x,y);if(g(T)){S>1&&(T=m(T,{key:(s=T.key)!==null&&s!==void 0?s:y})),l.push(d(T,x,y));continue}}if(x.type==="text"){var A=!x.data.trim().length;if(A&&x.parent&&!(0,zE.canTextBeChildOfNode)(x.parent)||t.trim&&A)continue;l.push(d(x.data,x,y));continue}var E=x,C={};IK(E)?((0,zE.setStyleProp)(E.attribs.style,E.attribs),C=E.attribs):E.attribs&&(C=(0,kK.default)(E.attribs,E.name));var R=void 0;switch(x.type){case"script":case"style":x.children[0]&&(C.dangerouslySetInnerHTML={__html:x.children[0].data});break;case"tag":x.name==="textarea"&&x.children[0]?C.defaultValue=x.children[0].data:!((o=x.children)===null||o===void 0)&&o.length&&(R=PF(x.children,t));break;default:continue}S>1&&(C.key=y),l.push(d(_(x.name,C,R),x,y))}return l.length===1?l[0]:l}function IK(u){return zE.PRESERVE_CUSTOM_ATTRIBUTES&&u.type==="tag"&&(0,zE.isCustomComponent)(u.name,u.attribs)}(function(u){var t=Ki&&Ki.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(u,"__esModule",{value:!0}),u.htmlToDOM=u.domToReact=u.attributesToProps=u.Text=u.ProcessingInstruction=u.Element=u.Comment=void 0,u.default=l;var e=t(g9);u.htmlToDOM=e.default;var n=t(Bw);u.attributesToProps=n.default;var i=t(R9);u.domToReact=i.default;var s=y9;Object.defineProperty(u,"Comment",{enumerable:!0,get:function(){return s.Comment}}),Object.defineProperty(u,"Element",{enumerable:!0,get:function(){return s.Element}}),Object.defineProperty(u,"ProcessingInstruction",{enumerable:!0,get:function(){return s.ProcessingInstruction}}),Object.defineProperty(u,"Text",{enumerable:!0,get:function(){return s.Text}});var o={lowerCaseAttributeNames:!1};function l(c,d){var f;if(typeof c!="string")throw new TypeError("First argument must be a string");return c?(0,i.default)((0,e.default)(c,(f=d==null?void 0:d.htmlparser2)!==null&&f!==void 0?f:o),d):[]}})(pF);const sj=ay(pF),bi=sj.default||sj;function UK({goToLecture:u=!1,close:t=()=>{},minutes:e=0,seconds:n=0,btnText:i}){return P.jsx("div",{className:"lectures--buttons",children:u?P.jsx("button",{type:"button",className:"gat--btn__navigation",onClick:()=>t(),"aria-label":i,children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})}):P.jsx("button",{type:"button",className:"gat--btn__count","data-testid":"countdown",children:P.jsxs("span",{children:[e<10?`0${e}`:e,":",n<10?`0${n}`:n]})})})}const rR=()=>{},rj={},sy=({voice:u,text:t,audioType:e,loop:n=!1,started:i=!0,audio:s,soundActions:o,getEvent:l,volume:c=.5,onFinish:d=rR,onMute:f=rR,onError:m=rR,onStart:_=rR,pauseTTS:g})=>{const[S,y,x,T]=o,A=!s&&!u,[E,C]=G.useState(!1),R=G.useRef({url:"",cc:"tts"}),N=G.useCallback(F=>l({type:"translate",payload:F}),[l]),O=G.useCallback(({id:F,type:I="base"})=>{var Z;const H=N("usedVoices"),W=N("gameCharacters");return I==="base"?H==null?void 0:H[F]:I==="character"?(Z=W==null?void 0:W[F])==null?void 0:Z.voiceId:null},[N]),M=G.useCallback((F,I="tts")=>{if(R.current.url!==F)return R.current={url:F,cc:I},S(F,I,n,c,d,_,f,m)},[S,n,c,d,_,f,m]),B=G.useCallback(async F=>{if(E&&F.voiceId&&F.text){let I=rj[`${F.voiceId}_${F.text}`];try{I||(I=await l({type:"getSpeech",payload:F}),I?rj[`${F.voiceId}_${F.text}`]=I:m()),I&&M(I)}catch{m()}}else m()},[l,E,m,M]),L=G.useCallback(()=>{R.current.url&&y(R.current.cc)},[y]);return G.useEffect(()=>(C(!0),()=>{C(!1),L()}),[L]),G.useEffect(()=>{g?x():T()},[x,g,T]),G.useEffect(()=>{A&&L()},[A,L]),G.useEffect(()=>{if(E&&i)if(e==="voice"&&(u!=null&&u.id)){const F=O(u);B({voiceId:F,text:t})}else(e==="file"||!e)&&s?M(s==null?void 0:s.url):m()},[s,e,O,E,m,B,M,i,t,u]),[L]},Hw=u=>{const t=document.createElement("div");return t.innerHTML=u,t.textContent||t.innerText||""},HK=.2;function GK({emitEvent:u=()=>{},getEvent:t,name:e="",name_labelId:n,required:i=!1,text:s="",text_labelId:o,visible:l=!1,documentType:c="",viewed:d=!1,soundActions:f,backgroundImage:m,hideBackgroundImageTheme:_=!1,keyboardControl:g,audio:S,audioType:y,audioVolume:x,voice:T,pause:A,styles:E="",context:C={}}){const[R,N]=G.useState(),[O,M]=G.useState(!1),[B,L]=G.useState(0),F=s,I=Math.trunc(F.split(" ").length*HK),H=!i||i&&B>=I||i&&!l,[W]=f,Z=`${e}. ${Hw(s)}`;sy({audioType:y,voice:T,text:Z,audio:S,soundActions:f,getEvent:t,volume:x,pauseTTS:A});const X=ot=>t({type:"translate",payload:ot}),$=G.useCallback(()=>{H&&(W("click-ui"),u({type:"finishMedia",payload:{name:n,type:"text",text:o,documentType:c}}))},[c,u,H,n,o,W]),nt=g({disabled:d,forward:$,escape:$});G.useEffect(()=>nt(),[nt]),G.useEffect(()=>{if(!l&&!O&&($(),M(!0)),i&&l){const ot=setInterval(()=>{L(ht=>ht+1)},1e3);return N(ot),()=>{clearInterval(ot)}}},[$,i,O,l]),G.useEffect(()=>{B===I&&clearInterval(R)},[R,B,I]);const Q=I-B,tt=Math.floor(Q/60),rt=Q%60,ut=G.useMemo(()=>{let ot="";return d?ot="notes--results":(ot="lectures--container",E&&(ot+=` lectures--container--${E}`),m!=null&&m.url&&(ot+=" lectures--container--with-custom-bg"),E&&_&&(ot+=" disable-background-image")),ot},[m==null?void 0:m.url,_,E,d]),st={backgroundImage:m!=null&&m.url?`url('${m.url}')`:""};return l?P.jsx("div",{className:ut,style:st,children:P.jsx("div",{className:d?"":"lectures__overlay",children:P.jsxs("div",{className:d?"notes--results__text":`lectures lectures--${E}`,children:[P.jsx("div",{className:"lectures--title",children:e}),P.jsxs("div",{className:"lectures--text",dir:"auto",children:[P.jsx("div",{children:F?bi(F):null}),d?null:P.jsx(UK,{goToLecture:H,close:$,minutes:tt,seconds:rt,btnText:X("screens.continue")})]})]})})}):null}function $R({character:u={name:"",url:"",type:"",resource:{resourceId:""}},active:t=!1,slot:e=0,lowQuality:n}){var _;const i=u.type==="image",s=u.type==="character",o=u.type==="object",l=(_=u==null?void 0:u.resource)==null?void 0:_.url,c=()=>i?`url(${l})`:s&&n?`url(${l.replace("character.glb","face.png")})`:o&&n?`url(${l.replace("object.glb","thumbnail.png")})`:"",d=()=>i?"contain":s||o?"auto 95%":"",f=()=>i?"center":s||o?"center bottom":"",m=i||n?{backgroundImage:c(),backgroundRepeat:"no-repeat",backgroundPosition:f(),backgroundSize:d()}:{};return P.jsx("div",{className:`conversation--character__item ${t?"active":""} ${e}`,style:m,children:t&&u.name?P.jsx("span",{className:"conversation--character__name",children:u.name}):null},u.name)}$R.propTypes={character:$t.shape({name:$t.string,url:$t.string,type:$t.string,emotion:$t.string,uid:$t.string,resource:$t.shape({resourceId:$t.string,url:$t.string})}),active:$t.bool,slot:$t.number};const VK=new Oa.Vector3(0,14.63,16),YK=rF(),KK=new _H.GLTFLoader,oj=new Oa.Box3,oR=new Oa.Vector3,lj=new Oa.Vector3;function XK({character:u,ttsStarted:t,active:e,onLoad:n}){var _,g,S;const i=G.useRef(null),s=G.useRef(null),o=u.type==="character",l=G.useRef(),c=G.useMemo(()=>{var y,x,T,A,E,C,R,N;if(o){if(u.animationId&&((y=u.animation)!=null&&y.url))return u.animation;const O=u.emotion==="neutral"?"idle":u.emotion;return(A=(T=(x=u==null?void 0:u.resource)==null?void 0:x.animations)==null?void 0:T[O])!=null&&A.url?(C=(E=u==null?void 0:u.resource)==null?void 0:E.animations)==null?void 0:C[O]:(N=(R=u==null?void 0:u.resource)==null?void 0:R.animations)==null?void 0:N.idle}return{}},[u.emotion,u==null?void 0:u.animationId,u==null?void 0:u.animation,(_=u==null?void 0:u.resource)==null?void 0:_.animations,o]),d=G.useCallback(()=>{if(!l.current)return;const y=l.current.animator;if(!y)return;const x=y.getAction("talking");x&&x.setEffectiveWeight(0)},[]),f=G.useCallback(()=>{var R,N,O,M,B,L;const y=l.current;if(!y)return;const x=(O=(N=(R=u==null?void 0:u.resource)==null?void 0:R.animations)==null?void 0:N.talking)==null?void 0:O.url,A=((L=(B=(M=u==null?void 0:u.resource)==null?void 0:M.animations)==null?void 0:B["talking-short"])==null?void 0:L.url)||x,E=y.animator;if(!E)return;const C=E.getAction("talking");C?C.setEffectiveWeight(1):KK.load(A,({animations:F})=>{const I=E.register("talking",F[0]);I.play(),I.setEffectiveWeight(1)})},[(g=u==null?void 0:u.resource)==null?void 0:g.animations]),m=G.useCallback(y=>{if(u.type==="character"){const x=y.getObjectByName("Head_M",!0);x?(x.updateMatrixWorld(!0),oj.setFromObject(y),oj.getSize(lj),x.getWorldPosition(oR),i.current.lookAt(oR)):i.current.position.setY(lj.y-1.5*1.3),i.current.zoom=1.5;const T=()=>{n==null||n(),y.removeEventListener("update_bounds",T)};y.addEventListener("update_bounds",T)}else Mz(y,i.current),i.current.zoom=1;i.current.updateProjectionMatrix()},[u,n]);return $h.useFrame(({gl:y,scene:x})=>{if(t&&e?f():d(),i.current&&s.current){const T=document.querySelectorAll(".conversation--character__item")[u.slot];if(T){const A=T.getBoundingClientRect(),E=T.parentNode.getBoundingClientRect(),[C,R]=[A.right-A.left,A.bottom-A.top];if(i.current.aspect=C/R,i.current.updateProjectionMatrix(),o&&l.current){const M=l.current.getObjectByName("Head_M",!0);M&&(M.getWorldPosition(oR),i.current.lookAt(oR))}const N={top:A.top-E.top,right:A.right-E.right,left:A.left-E.left,bottom:A.bottom-E.bottom},O=YK?24:40;y.isWebGPURenderer?N.bottom+=e?0:O:N.bottom+=e?-O:O,y.setViewport(N.left,N.bottom,C,R),y.setScissor(N.left,N.bottom,C,R),s.current.environment=x.environment,y.render(s.current,i.current)}}},1),!((S=u.resource)!=null&&S.url)||u.type==="image"?null:P.jsxs("scene",{ref:s,children:[P.jsx(Va.SceneResource,{ref:l,name:`char_${u.uid}`,url:u.resource.url,animationStates:{idle:c.url},type:u.type,onRender:m,texturable:!0,interactive:!1,generate:!1,merge:!1}),P.jsx(WN.PerspectiveCamera,{ref:i,fov:35,position:VK,rotation:[0,0,0],onUpdate:y=>{y.layers.enableAll()},manual:!0}),P.jsx(Lz,{})]})}function qK({characters:u,slots:t,ttsStarted:e,flex:n,currentMessage:i,lod:s}){const[o,l]=G.useState(!1);return G.useEffect(()=>{const c=()=>{l(!0)};return Va.ProgressManager.addEventListener("loaded",c),()=>{Va.ProgressManager.removeEventListener("loaded",c)}},[]),$h.useFrame(({gl:c})=>{c.setScissorTest(!1),c.clear(!0,!0),c.setScissorTest(!0)}),P.jsx(Va.QualityManager,{lod:s,active:o,children:t.map((c,d)=>{let f=null;const m=u.findIndex(_=>_&&_.uid===c.uid);if(m>=0){const _=n?m:d;return f={...u[m]},f.slot=_,P.jsx(XK,{character:f,active:i.position===_,ttsStarted:e},`${`${f.uid}_${d}`}`)}return null})})}function QK(u){return u.lowQuality?null:P.jsxs(Va.Renderer,{className:"conversation--canvas",style:{position:"absolute",width:"100%",height:"100%"},gl:{antialias:!0},fullscreen:!1,onCreated:({gl:t})=>{t.setClearColor("white",0)},children:[P.jsx(Va.SettingsController,{current:{animate:u.pause}}),P.jsx(WN.Environment,{files:"https://min.gamelearn.io/statics/envs/envmap_1k.hdr"}),P.jsx(qK,{...u})]})}function w9({characters:u=[],actors:t,lodSettings:e,ttsStarted:n,currentMessage:i={},flex:s=!0,slots:o=[],children:l,pause:c,getEvent:d}){const f=({character:T,active:A,slot:E})=>({character:T,active:A,emotion:A?i.emotion:"neutral",slot:E}),m=G.useMemo(()=>d({type:"currentLod"}),[d]),_=m==="divideby64",g=o.reduce((T,A)=>{var R,N;const E=t==null?void 0:t.find(O=>O.uid===A.uid),C={...A};if(A.character)C.name=A.alias||A.character.name,C.resource=C.character.resource,C.position=C.position>=0?C.position:-1,delete C.character,C.type="character",T.push(C);else if(E){const{resource:O}=E;C.name=A.alias||A.name,C.position=C.position>=0?C.position:-1,C.resource=O,C.type=E.type,T.push(C)}else A.type?(C.name=A.alias||((R=A.character)==null?void 0:R.name)||A.name,C.resource=((N=C.character)==null?void 0:N.resource)||A.resource,C.position=C.position>=0?C.position:-1,delete C.character,C.type=A.type,T.push(C)):s||T.push(null);return T},[]),S=g.length&&g.some(T=>T),y=u.filter(T=>o.find(A=>T.uid===A.uid));function x(){return S?g.map((T,A)=>T?P.jsx($R,{lowQuality:_,...f({character:T,active:i.position===T.position,slot:A})},`${T.uid+A}`):P.jsx("div",{className:`conversation--character__item void ${A}`},`void_${0+A}`)):s?y.map((T,A)=>{const E=i.position===A;return P.jsx($R,{...f({character:T,active:E,slot:A})},`${T.uid+A}`)}):o.length>0?o.map((T,A)=>{const E=u.find(C=>C.uid===T.uid);if(E){const C=i.position===A;return E.name=T.alias||E.name,P.jsx($R,{...f({character:E,active:C,slot:A})},`${E.uid+A}`)}return P.jsx("div",{className:`conversation--character__item void ${A}`},`${0+A}`)}):null}return P.jsxs("div",{className:"conversation--characters",children:[P.jsx(QK,{characters:S?g:y,slots:o,flex:s,currentMessage:i,lodSettings:e,ttsStarted:n,pause:c,lod:m,lowQuality:_}),l||P.jsx(x,{})]})}function uj({inherited:u,options:t,selectedChoice:e,selectChoice:n,showingResults:i,simplifiedOptions:s,required:o}){const[l,c]=G.useState(null),d=m=>{s?(c(m),setTimeout(()=>{n(m),c(null)},1e3)):n(m)},f=m=>!!(i&&(e==null?void 0:e.id)===m.id||(e==null?void 0:e.right)===!0||i&&!o);return t==null?void 0:t.filter(m=>m.text).map(m=>P.jsxs("div",{className:`${u?"conversation--question custom-radio":"custom-radio"}
45
45
  ${(l==null?void 0:l.id)===m.id?"radio-text-clicked":""}`,children:[P.jsx("input",{onChange:()=>{d(m)},className:"radio",type:"radio",id:m.text_labelId,name:m.id,checked:(e==null?void 0:e.id)===m.id,disabled:f(m)}),P.jsx("label",{className:`${m.right?"radio-text-success":"radio-text-fail"}`,htmlFor:m.text_labelId,children:bi(m.text)})]},`${m.id}_${m.text_labelId}`))}const WK=()=>{};function ZK({children:u,question:t,showingResults:e,selected:n,required:i,failed:s,onNext:o,translate:l,hasRewards:c,options:d}){const[f,m]=G.useState(!1);function _(){(n==null?void 0:n.id)!==void 0&&!f&&(m(!0),o())}return P.jsxs("div",{className:`popup popup__large popup__basicDecision ${e&&(n!=null&&n.feedback)?"popup__feedback":""}`,children:[P.jsx("div",{className:"popup--info",children:e?P.jsxs(P.Fragment,{children:[u,!(n!=null&&n.feedback)&&c.length===0&&P.jsx("span",{className:"popup--info__title",children:t!==""&&P.jsx(P.Fragment,{children:t})}),!(n!=null&&n.feedback)&&c.length>0&&P.jsx("span",{className:"popup--info__title",children:t})]}):P.jsx("span",{className:"popup--info__title",children:t})}),P.jsx("div",{className:"popup__questions",dir:"auto",children:d}),P.jsx("div",{className:"popup--buttons",children:(i?!s:(n==null?void 0:n.id)!==void 0)?P.jsx("button",{"data-testid":"continueButtonDecision",type:"button",className:`gat--btn__navigation ${f||(n==null?void 0:n.id)===void 0?"disabled":""}`,onClick:()=>_(),"aria-label":l("storylines.misc.closePiece"),children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})}):null})]})}function JK({question:u,inScene:t,disabled:e,onNext:n,children:i,simplifiedOptions:s}){return P.jsxs("div",{dir:"auto",className:`conversation--body ${t?"conversation--body--inScene":""}`,children:[P.jsxs("div",{className:"conversation--message",children:[u!==""&&P.jsx("div",{className:"conversation--main__text",children:bi(u)}),i]}),P.jsxs("div",{style:{visibility:s?"hidden":"visible"},className:"conversation--controls conversation--controls--fixedbottom",children:[P.jsx("div",{className:"gat--btn__round disabled",children:P.jsx("span",{className:Pe()?"icon-next":"icon-back"})}),P.jsx("button",{"data-testid":"continueButtonComplexDecision",className:`gat--btn__round ${e?"disabled":""}`,type:"button",onClick:()=>!e&&n(),children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})})]})]})}function cj({options:u,question:t,inherited:e,branched:n,changeOption:i,onNext:s,failed:o,showingResults:l,currentSelectedChoice:c,children:d,translate:f,hasRewards:m,inScene:_,required:g,simplifiedOptions:S}){const y=A=>{l&&o&&i(A),s(A)},x=!l&&(c==null?void 0:c.id)!==void 0||!o,T={inherited:e,selectedChoice:c,selectChoice:(!g||n)&&(c==null?void 0:c.id)!==void 0||g&&!o?WK:y,options:u,showingResults:l,simplifiedOptions:S,required:g};return e?P.jsx(JK,{disabled:!x,question:t,inScene:_,onNext:()=>s(c),simplifiedOptions:S,children:P.jsx(uj,{...T})}):P.jsx(ZK,{question:t,showingResults:l,selected:c,required:g,failed:o,onNext:()=>s(c),translate:f,hasRewards:m,options:P.jsx(uj,{...T}),children:d})}function $K({children:u,inherit:t}){return t?P.jsx("div",{className:"conversation--feedback",children:u}):u}function dj({choice:u,inherited:t,question:e}){return u.feedback?P.jsx($K,{inherit:t,children:u.feedback&&P.jsxs(P.Fragment,{children:[!t&&P.jsx("div",{className:"conversation--feedback__title",children:e}),P.jsxs("div",{className:"conversation--feedback__text",dir:"auto",children:[u.right?P.jsx("span",{className:"icon-check-circle-black color--success"}):P.jsx("span",{className:"icon-error-circle-black color--error"}),P.jsx("div",{className:"conversation--feedback__wysiwyg",children:bi(u.feedback)})]})]})}):null}function D9({emitEvent:u,getEvent:t,soundActions:e,keyboardControl:n,inScene:i,...s}){var I,H;const{inheritProps:o={},decisionNumber:l,required:c,question:d,onAddPoints:f,onFinish:m,branched:_,simplifiedOptions:g}=s,S=Object.keys(o).length>0,[y,x]=G.useState("options"),[T,A]=G.useState({}),[E]=e,C=c&&!(T!=null&&T.right),R=G.useRef(),N=W=>{var Z;(Z=W.audio)!=null&&Z.url&&E(W.audio.url,"audio_file",!1,W.audioVolume)},O={...o,slots:o.slots?o.slots:o.characters,currentMessage:{position:null,emotion:""},emitEvent:u,getEvent:t};o&&o.flex&&O.slots&&(O.characters=O.characters.filter(W=>O.slots.find(Z=>Z.uid===W.uid)));const M=W=>{u({type:"decisionJournal",payload:{choice:W,decisionNumber:l}})},B=W=>{if(!C&&y==="results")E("click-ui"),S?g?m&&(M(W),m(W,()=>{A({}),x("options")})):(f&&f(W),M(W),u({type:"addPoints",payload:W==null?void 0:W.rewards,finish:!1,complex:!0,onFinish:()=>{m?m(W,()=>{A({}),x("options")}):u({type:"success"}),A({}),x("options")}})):(M(W),u({type:"addPoints",payload:W==null?void 0:W.rewards,finish:!0,complex:!0}));else if(Object.keys(W).length>0)if(E("click-ui"),g)if(W!=null&&W.rewards.filter(Z=>Z.type==="var").length){M({...W,simplified:!0});const Z=W==null?void 0:W.rewards.filter(X=>X.type==="var");u({type:"addPoints",payload:Z,finish:!1,complex:!0,onFinish:()=>{m?m(W,()=>{A({}),x("options")}):u({type:"success"}),A({}),x("options")}})}else M({...W,simplified:!0}),m(W,()=>{A({}),x("options")});else W.right?E("score"):(E("fail"),_||(S||c?(M(W),u({type:"addPoints",payload:W==null?void 0:W.rewards,finish:!1,complex:!0})):c||(A({}),x("options")))),A(W),N(W),x("results")},L={...s,selectView:x,selectedView:y,emitEvent:u,inherited:S,branched:_,soundActions:e,showingResults:y==="results",currentSelectedChoice:T,hasRewards:(T==null?void 0:T.rewards)||[],failed:C,inScene:i,required:c,simplifiedOptions:g,changeOption:W=>{E("click-ui"),A(W),x("options")},onNext:B,translate:W=>t({type:"translate",payload:W})},F=n({disabled:y!=="results",repeat:!1,forward:()=>{if(R.current!==T)R.current=T;else return;B(T)}});return G.useEffect(()=>F(),[F]),S?P.jsx("div",{className:`conversation--layer
46
46
  ${T!=null&&T.feedback?"":"conversation--layer__defaultFeedback"}
47
47
  ${y==="results"?"conversation--layer__feedback":""}`,children:P.jsxs("div",{className:`conversation ${i?"conversation--inScene":""}`,style:(I=o.background)!=null&&I.img?{backgroundImage:`url("${(H=o.background.img)==null?void 0:H.url}")`}:null,children:[P.jsx(w9,{...O,children:y==="results"&&(T!=null&&T.feedback)?P.jsx(dj,{question:d,soundActions:e,inherited:S,choice:T,rewards:(T==null?void 0:T.rewards)||[],emitEvent:u}):null}),P.jsx(cj,{...L})]})}):P.jsx("div",{className:"popup--layer popup--layer--transparent",children:P.jsx(cj,{...L,children:P.jsx(dj,{question:d,soundActions:e,inherited:S,choice:T,rewards:(T==null?void 0:T.rewards)||[],emitEvent:u})})})}function tX({emitEvent:u,img:t,imgName:e,documentType:n,visible:i,viewed:s,imgId_labelId:o,soundActions:l,keyboardControl:c,getEvent:d}){const f=T=>d({type:"translate",payload:T}),[m,_]=G.useState(!1),g=t.url,[S]=l,y=G.useCallback(()=>{S("click-ui"),u({type:"finishMedia",payload:{imgId:o,name:e,imgName:e,documentType:n,type:"image"}})},[S,o,e,n,u]),x=c({disabled:s,forward:y,escape:y});return G.useEffect(()=>x(),[x]),G.useEffect(()=>{!i&&!m&&(_(!0),y())},[y,i,m]),i?P.jsx("div",{className:s?"notes--results":"readings--container readings--container--darkopacity",children:P.jsxs("div",{className:s?"notes--results__text":"readings readings--image",children:[g&&P.jsx("img",{src:g,alt:e}),s?null:P.jsx("div",{className:g?"readings--image--closeBtn":"position--absolute top right",children:P.jsx("button",{type:"button",className:"gat--btn__round gat--btn__close",onClick:y,"aria-label":f("storylines.misc.closePiece"),children:P.jsx("span",{className:"icon-close"})})})]})}):null}function eX({name:u}){return P.jsx("div",{className:"conversation--voice__over",children:P.jsx("span",{children:u||"Voice-Over"})})}function nX({text:u}){return P.jsxs("div",{className:"conversation--voice__over",children:[P.jsx("span",{className:"icon-bubble-thinkful-black"}),P.jsxs("span",{children:["[",u,"]"]})]})}function jF({current:u={},translate:t,voiceOver:e=!1}){var i,s;const n=u.text;return P.jsxs("div",{className:`conversation--message ${u.voiceOver||(i=u==null?void 0:u.emotion)!=null&&i.includes("think")?"voice--over":""}`,children:[u.voiceOver?P.jsx(eX,{name:u.name}):null,(s=u==null?void 0:u.emotion)!=null&&s.includes("think")?P.jsx(nX,{text:t("emotion.thinking")}):null,P.jsx("div",{className:"conversation--main__text",children:bi(n)})]})}const iX={width:"100%",height:"100%",position:"static"};function vN(u){const t=document.querySelector(".screens--container");return G.useEffect(()=>(u.onMount&&u.onMount(),()=>{u.onUnMount&&u.onUnMount()}),[]),P.jsx(Va.HtmlPro,{zIndexRange:[6,6],style:iX,portal:t?{current:t}:void 0,onOcclude:()=>{},calculatePosition:()=>[0,0],wrapperClass:"htmlpro-wrap-100-h",children:u.children})}const aX=75,lR=1400;function sX({keyboardControl:u,emitEvent:t=()=>{},getEvent:e,pause:n,lines:i,edges:s,characters:o,actors:l,background:c={},soundActions:d=[()=>{},()=>{}],lodSettings:f,autoPlay:m,autoEnd:_,progress:g}){var te,Ie,Je;const S=i.length-1<=(g==null?void 0:g.line)?i.length-1:(g==null?void 0:g.line)||0,[y,x]=G.useState(!1),[T,A]=G.useState(!0),[E,C]=G.useState(!!m),[R,N]=G.useState(!1),[O,M]=G.useState(S),[B,L]=G.useState(!1),[F]=d,{start:I,stop:H}=Tw(),W=((te=c==null?void 0:c.img)==null?void 0:te.url)||null,Z=i[O],{voiceOver:X,decision:$}=Z;let{flex:nt}=Z,Q=[];const tt=!!s,rt=X||Z.type==="conversationalNarration",ut=$||Z.type==="conversationalDecision",st=Z.type==="conversationalCamera",[ot,ht]=G.useState([]),vt=G.useMemo(()=>ot[ot.length-1],[ot]),it=G.useCallback(()=>{if(tt){const Gt=i.filter(ee=>!s.find(pe=>pe.toId===ee.id));if(Gt.length){const ee=Gt[0],pe=i.indexOf(ee);if(pe>=0)return pe}}return-1},[tt,i,s]),lt=G.useCallback(()=>{const Gt=s.find(pe=>pe.fromId===vt)||s.find(pe=>pe.toId===vt),ee=i.find(pe=>pe.id===(Gt==null?void 0:Gt.fromId));return!vt&&(g==null?void 0:g.line)>=0?{decision:!0}:ee},[s,i,vt,g==null?void 0:g.line]),dt=G.useCallback(()=>{if(tt){const ee=lt();return ee==null?void 0:ee.decision}const Gt=i[O-1]?i[O-1]:{};return O>0&&(Gt==null?void 0:Gt.decision)},[tt,lt,i,O]),Et=G.useCallback(()=>{if(tt){const ee=lt();return(ee==null?void 0:ee.type)==="conversationalCamera"}const Gt=i[O-1]?i[O-1]:{};return O>0&&(Gt==null?void 0:Gt.type)==="conversationalCamera"},[tt,i,O,lt]),_t=G.useCallback(Gt=>e({type:"translate",payload:Gt}),[e]),pt=G.useMemo(()=>{var ee,pe;if(ut)return{};if(rt)return Z;const Gt=(ee=Z==null?void 0:Z.slots)==null?void 0:ee.find(En=>En.uid&&En.talking);return Gt||((pe=Z==null?void 0:Z.slots)==null?void 0:pe.find(En=>En.uid&&En.text))},[Z,rt,ut]),bt=i.slice(0,O+1).reverse().find(Gt=>Gt.slots),Tt=!ut&&((Ie=Z.slots)==null?void 0:Ie.filter(Gt=>Gt.uid).length),Ct=aX*(((Je=pt==null?void 0:pt.text)==null?void 0:Je.length)||0);let Ft=[];Z.slots?Ft=Z.slots:bt&&(Ft=bt.slots);const It=Ft.filter(Gt=>Gt.uid).map(Gt=>{const ee=(o||l||[]).find(pe=>pe.uid===Gt.uid);return ee&&(Gt.resource=ee.resource,Gt.type=ee.type),Gt.resource||(Gt.resource={}),Gt}),Jt={characters:It,lodSettings:f,actors:l,currentMessage:pt||{},slots:rt?Q:Z.slots,flex:nt,pause:n,getEvent:e};if(rt){const Gt=i.slice(O).find(pe=>pe.slots),ee=bt||Gt;ee&&(Q=ee.slots,nt=ee.flex)}else if(!ut&&Tt&&(Z.slots.forEach(Gt=>{const ee=It.findIndex(pe=>pe.uid===Gt.uid);ee>=0&&(It[ee].emotion=Gt.emotion)}),pt&&pt.uid)){const Gt=Z.slots.findIndex(pe=>pe.uid===pt.uid),ee=It.findIndex(pe=>pe.uid===pt.uid);It.forEach(pe=>{pe.uid===pt.uid&&(pe.name=pt.alias)}),pt.position=nt?ee:Gt}const ne=G.useCallback(()=>{t({type:"success"})},[t]),Ae=G.useCallback((Gt,ee)=>{const pe=[3,2,1][Gt.id],ue=s.filter(me=>me.fromId===Z.id).find(me=>parseInt(me.fromPointIndex)===pe);if(ue){const me=i.findIndex(Dn=>Dn.id===ue.toId);ue.fromId===ue.toId?ee():me>=0?(M(me),t({type:"notifyProgress",payload:{line:me}})):ne()}else ne()},[Z.id,s,t,ne,i]),Ze=G.useCallback((Gt=!0)=>{const ee=Gt?["fromId","toId"]:["toId","fromId"],pe=s.filter(me=>me[ee[0]]===Z.id),En=pe.length===1?pe[0]:pe.find(me=>me[ee[1]]===vt);if(!(En!=null&&En[ee[0]])){ne();return}Gt||ht(ot.slice(0,-1));const ue=i.findIndex(me=>me.id===En[ee[1]]);ue>=0?(M(ue),t({type:"notifyProgress",payload:{line:ue}})):ne()},[Z.id,s,ot,t,ne,vt,i]),Re=G.useCallback(Gt=>{if(tt){if(Gt){const ee=[3,2,1][Gt.id],En=s.filter(ue=>ue.fromId===Z.id).find(ue=>parseInt(ue.fromPointIndex)===ee);if(En){const ue=i.findIndex(me=>me.id===En.toId);ue>=0&&t({type:"notifyProgress",payload:{line:ue}})}else t({type:"saveNode"})}}else if(O<i.length-1){const pe=O+1;t({type:"notifyProgress",payload:{line:pe}})}else t({type:"saveNode"})},[s,i,t,O,Z.id,tt]),Ee=G.useCallback((Gt,ee)=>{let pe=!1;if(L(!1),A(!1),N(!1),tt)ht([...ot,Z.id]),Gt?Ae(Gt,ee):Ze();else if(O<i.length-1){const ue=O+1;M(ue),t({type:"notifyProgress",payload:{line:ue}}),ee&&ee()}else _||ut||st?ne():pe=!0;pe||A(!0)},[ot,Z.id,tt,O,i.length,_,ut,st,Ae,Ze,t,ne]),xn=()=>{if(A(!1),L(!1),N(!1),tt)Ze(!1);else if(!dt()){const Gt=O-1;M(Gt),t({type:"notifyProgress",payload:{line:Gt}})}A(!0)},hn=G.useCallback(()=>tt?Z&&Z.type!=="conversationalDecision"&&!s.find(Gt=>Gt.fromId===Z.id):O===i.length-1,[O,Z,s,tt,i.length]),kt=()=>{F("click-ui"),hn()?ne():(C(!1),Ee())},ie=()=>{F("click-ui"),C(!1),xn()},he=E&&!ut&&!n&&!st,Lt=G.useMemo(()=>it()>=0&&ot.length===0&&tt||O===0&&!tt||dt()||Et(),[it,ot.length,tt,O,dt,Et]);sy({audioType:Z==null?void 0:Z.audioType,volume:Z==null?void 0:Z.audioVolume,voice:Z==null?void 0:Z.voice,started:T,slide:O,text:Hw(pt==null?void 0:pt.text),audio:Z==null?void 0:Z.audio,soundActions:d,getEvent:e,pauseTTS:n,onStart:()=>{var Gt;(Gt=pt==null?void 0:pt.emotion)!=null&&Gt.includes("think")||L(!0)},onError:()=>{N(!0)},onFinish:()=>{L(!1),he&&Ee()}}),G.useEffect(()=>{var ee;let Gt;return ut?()=>{}:(((Z==null?void 0:Z.audioType)==="none"||R)&&!((ee=pt==null?void 0:pt.emotion)!=null&&ee.includes("think"))&&(L(!0),Gt=setTimeout(()=>{L(!1)},Ct<lR?lR:Ct)),()=>{Gt&&clearTimeout(Gt)})},[R,Z,pt==null?void 0:pt.emotion,Ct,ut]),G.useEffect(()=>(he&&((Z==null?void 0:Z.audioType)==="none"||R)&&(!hn()||hn()&&_)&&I(Ee,Ct<lR?lR:Ct),()=>{H()}),[pt,I,H,Ee,Z==null?void 0:Z.audioType,he,R,_,i,hn,Ct]),G.useEffect(()=>{if(tt&&!y){const Gt=g==null?void 0:g.line;if(Gt>=0){x(!0),M(Gt);return}const ee=it();ee>=0&&(x(!0),M(ee))}},[s,it,tt,i,y,g==null?void 0:g.line]);const Xt=u({disabled:ut,repeat:!1,forward:kt,rewind:Lt?null:ie});if(G.useEffect(()=>Xt(),[Xt]),st)return P.jsx(m9,{...Z,transition:{type:"none"},emitEvent:t,success:!1,onFinish:Ee},`change-camera-${O}`);if(ut){const Gt=i[O].id?i.filter(pe=>pe.decision).findIndex(pe=>pe.id===i[O].id)+1:i.filter(pe=>pe.decision).findIndex(pe=>pe===i[O])+1,ee={...Z.payload,decisionNumber:Gt,required:!tt,branched:tt,onAddPoints:Re,onFinish:Ee,keyboardControl:u,emitEvent:t,getEvent:e,soundActions:d,inheritProps:{characters:It,background:c,flex:bt?bt.flex:!0,slots:bt?bt.slots:[]}};return P.jsx(vN,{children:P.jsx(D9,{...ee})})}return P.jsx(vN,{children:P.jsx("div",{className:"conversation--layer",children:P.jsxs("div",{"data-testid":"conversational-pro-image",className:"conversation",style:W?{backgroundImage:`url("${W}")`}:null,children:[P.jsx(w9,{...Jt,ttsStarted:B}),P.jsxs("div",{className:"conversation--body",dir:"auto",children:[pt?P.jsx(jF,{current:pt,translate:_t}):null,P.jsxs("div",{className:"conversation--controls",children:[P.jsx("button",{"data-testid":"conversational-pro-button-back",className:`gat--btn__round ${Lt?"disabled":""}`,disabled:Lt?!0:"",type:"button",onClick:ie,"aria-label":Pe()?_t("storylines.misc.forward"):_t("storylines.misc.rewind"),children:P.jsx("span",{className:Pe()?"icon-next":"icon-back"})}),P.jsx("button",{"data-testid":"conversational-pro-button-next",className:`gat--btn__round ${E&&hn()?"glowing-animation":""}`,type:"button",onClick:kt,"aria-label":Pe()?_t("storylines.misc.rewind"):_t("storylines.misc.forward"),children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})})]})]})]})})})}function rX({emitEvent:u,getEvent:t,soundActions:e,messages:n,characters:i,alias:s,background:o,lodSettings:l}){var x;const[c,d]=G.useState(0),[f]=e,m=((x=o==null?void 0:o.img)==null?void 0:x.url)||null,_=n[c],g=i.map((T,A)=>({...T,name:s[A]?s[A]:T.name,uid:A})),S=()=>{const T=n.length-1;f("click-ui"),c+1<=T?d(c+1):u({type:"success"})},y=()=>{c>0&&(d(c-1),f("click-ui"))};return P.jsx("div",{className:"conversation--layer",children:P.jsxs("div",{"data-testid":"conversation-component",className:"conversation",style:m?{backgroundImage:`url("${m}")`}:{},children:[P.jsx(w9,{characters:g,lodSettings:l,currentMessage:_,slots:g,emitEvent:u,getEvent:t,flex:!0}),P.jsxs("div",{className:"conversation--body",children:[_?P.jsx(jF,{current:_,voiceOver:_.emotion===null}):P.jsx("div",{}),P.jsxs("div",{className:"conversation--controls",children:[P.jsx("button",{"data-testid":"conversational-back-button",className:`gat--btn__round ${c>0?"":"visibility--hidden"}`,type:"button",onClick:y,children:P.jsx("span",{className:"icon-back"})}),P.jsx("button",{"data-testid":"conversational-next-button",className:"gat--btn__round",type:"button",onClick:S,children:P.jsx("span",{className:"icon-next"})})]})]})]})})}function oX({vignette:u,alias:t,translate:e,backgroundImageCover:n}){var m;const s=(u.img||{url:"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg"}).url,[o,l]=G.useState(!0),c=_=>{document.querySelector(`#${_}`).focus(),l(!o)},d=/\.(mp4|mov|webm)$/i.test(s),f={src:s,style:n?{minHeight:"100%",minWidth:"100%",position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{height:"100%",width:"100%"}};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{"data-testid":"comic-image",className:`comic-image ${n?"comic-image--cover":""}`,children:[d&&P.jsx("video",{"data-testid":"videoTestId",autoPlay:!0,...f}),s&&!d&&P.jsx("img",{src:s,alt:"comic pic"})]}),(m=u==null?void 0:u.textData)!=null&&m.text?P.jsxs("div",{"data-testid":"comicCollapsable",className:`comic-collapsable ${o?"comic-collapsable--opened":""}`,children:[P.jsx("button",{id:"buttonDown","data-testid":"buttonDown",onClick:()=>c("buttonUp"),type:"button",className:"un-btn comic-collapsable__headertoggle","aria-label":e("comic.toggleText"),children:P.jsx("span",{className:"icon-down-arrow"})}),P.jsxs("div",{className:"comic-collapsable__text",children:[t?P.jsxs("b",{children:[t,": "]}):null,bi(u.textData.text)]})]}):null,P.jsx("button",{id:"buttonUp","data-testid":"buttonUp",tabIndex:o?"-1":"0","aria-hidden":o,className:`unset-button comic-buttonup