@gamelearn/arcade-components 3.30.6 → 3.30.7

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.
@@ -271,5 +271,5 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
271
271
  ${l.thinkful?"speech-bubble--italic":""}
272
272
  `,children:[jsxRuntimeExports.jsxs("div",{className:`speech-bubble__header ${l.thinkful?"speech-bubble__header--thinking":""}`,children:[l.thinkful?jsxRuntimeExports.jsx("div",{className:"thinking-icon-wrap",children:jsxRuntimeExports.jsx("div",{className:"icon-bubble-thinkful-black"})}):null,l.avatar?jsxRuntimeExports.jsx("div",{className:"speech-bubble__avatar",children:jsxRuntimeExports.jsx("img",{src:o(),alt:l.name})}):null,l.voiceOver?jsxRuntimeExports.jsx("div",{className:"speech-bubble__avatar",children:jsxRuntimeExports.jsx("div",{className:"icon-narrator"})}):null,jsxRuntimeExports.jsxs("div",{className:"speech-bubble__name",children:[jsxRuntimeExports.jsx("span",{children:l.name}),l.thinkful?jsxRuntimeExports.jsxs("span",{children:["[ ",e("emotion.thinking")," ]"]}):null]})]}),l.text?jsxRuntimeExports.jsx("div",{className:"speech-bubble__text",children:HTMLReactParser$1(l.text)}):null]})}const SpeechBubbleComponent$1=React$2.forwardRef(SpeechBubbleComponent);function BubbleWrapper({currentMessage:l,translate:e}){const n=document.querySelector(".screens--container");return jsxRuntimeExports.jsx("group",{children:jsxRuntimeExports.jsx(arcadeThreeCore.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",onOcclude:()=>null,zIndexRange:[5,5],portal:n?{current:n}:void 0,style:{width:"100%",height:"100%",position:"static"},calculatePosition:()=>[0,0],children:jsxRuntimeExports.jsx(SpeechBubbleComponent$1,{translate:e,message:l})})})}const cache={},loader=new GLTFLoader;function useStateMachine(l){const e=fiber.useThree(R=>R.scene),n=React$2.useMemo(()=>{var y;const R={};for(const E of l)if(E.slots)for(const g of E.slots){if(!g.uid)continue;const v=(y=g.character)==null?void 0:y.resource.animations;v&&(R[g.uid]||(R[g.uid]=Object.keys(v).reduce((b,T)=>(b[T]=v[T].url,b),{})))}return R},[l]),t=React$2.useMemo(()=>{const R=new Set;for(const y of l)if(y.slots)for(const E of y.slots)E.uid&&R.add(E.uid);return Array.from(R)},[l]),a=async R=>{const y=n[R];if(!cache[y.talking]){const{animations:g}=await loader.loadAsync(y.talking);g[0].name="talking",cache[y.talking]=g[0]}},o=()=>{t.forEach(R=>{S(R,"idle")})},d=()=>{t.forEach(R=>{const y=e.getObjectByProperty("uid",R);y&&(delete y.userData._active,S(R,"idle"))})},h=async(R,y,E=!1)=>{const g=getCurrentVisible(R,e);if(cache[R]||(cache[R]={}),!g)return new Promise(b=>b(!1));const v=g.userData.animator;if(y){const b=n[R];let T=cache[b.talking],_=y,w=cache[y];if(!w){const{animations:C}=await loader.loadAsync(y);w=cache[y]=C[0]}if(E&&b.talking!==y&&(T?(w=mixWithTalkingClip(T,w),_+="_talking"):a(R).then(()=>{T=cache[b.talking],w=mixWithTalkingClip(T,w),_+="_talking"})),!g.userData._active||g.userData._active!==_){g.userData._active=_;const C=v.register(_,w);return new Promise(k=>{v.mix(_).then(D=>k(D?C:!1))})}}return new Promise(b=>b(!1))},f=async(R,y)=>{const E=getCurrentVisible(R,e);if(cache[R]||(cache[R]={}),!E)return new Promise(k=>k(!1));const g=E.userData.animator,v=n[R];let b=cache[v.talking];b||(await a(R),b=cache[v.talking]);let T=cache[y];if(!T){const{animations:k}=await loader.loadAsync(y);T=cache[y]=k[0]}const _=y.split("/").pop().replace(".glb",""),w=mixWithTalkingClip(b,T);w.name=`${_}_talking_mixed`;const C=w.name;if(!E.userData._active||E.userData._active!==C){E.userData._active=C;const k=g.register(C,w);return new Promise(D=>{g.mix(C).then(P=>D(P?k:!1))})}return new Promise(k=>k(!1))},u=R=>{const y=getCurrentVisible(R,e);if(!y)return;y.userData.animator;const E=y.userData._active;if(E&&E.includes("_talking")){const g=E.replace("_talking","").replace("_mixed","");y.userData._talkingPaused={wasActive:!0,baseEmotion:g,originalAnimation:E};const b=n[R][g];b&&h(R,b,!1)}},p=async R=>{const y=getCurrentVisible(R,e);if(!y)return;const E=y.userData._talkingPaused;if(E&&E.wasActive){const v=n[R][E.baseEmotion];v&&await h(R,v,!0),delete y.userData._talkingPaused}},S=async(R,y)=>{const E=getCurrentVisible(R,e);if(cache[R]||(cache[R]={}),!E)return new Promise(v=>v(!1));const g=E.userData.animator;if(y==="idle")return g.mix("idle"),g.getAction("idle");{const v=n[R],b=y.split("_")[0],T=v[b],_=y.includes("talking");if(T){const w=`${T}_${_?"talking":"silent"}_${R}`;let C=cache[w];if(!C){let k=cache[T];if(!k){const{animations:D}=await loader.loadAsync(T);k=cache[T]=D[0]}if(_&&y!=="talking"){const D=cache[v.talking];D?C=mixWithTalkingClip(D,k):C=k.clone()}else C=k.clone();cache[w]=C}if(!E.userData._active||E.userData._active!==y){E.userData._active=y;const k=g.register(y,C);return new Promise(D=>{g.mix(y).then(P=>D(P?k:!1))})}}}return new Promise(v=>v(!1))};return{startAnimation:S,startAnimationUrl:h,preloadTalking:a,resetActives:o,unmountActives:d,startOnlyTalkingAnimation:f,shutUp:u,resumeTalking:p}}const characterMs=75,minMs=1400,headSize=2,raycast=new three.Raycaster,animationTarget=new three.Object3D,maxCharacterToSwitch=70;raycast.firstHitOnly=!0;function DialogComponent({keyboardControl:l,emitEvent:e,getEvent:n,lines:t,actors:a,edges:o,soundActions:d,zoomInActor:h,autoPlay:f,autoEnd:u,pause:p,progress:S}){var wt;const R=t.length-1<=(S==null?void 0:S.line)?t.length-1:(S==null?void 0:S.line)||0,[y,E]=React$2.useState(R),[g,v]=React$2.useState(!!f),[b,T]=React$2.useState(!1),[_,w]=React$2.useState(!1),C=fiber.useThree(ge=>ge.scene),k=fiber.useThree(ge=>ge.camera),{start:D,stop:P}=useTimeout(),O=React$2.useRef([]),F=React$2.useMemo(()=>k.clone(),[]),M=React$2.useRef({pos:[0,0,0],child:null}),I=t[y],$=t[y-1],B=React$2.useRef(!1),X=!!o,{voiceOver:re,decision:ae}=I||{},te=React$2.useRef({}),K=(wt=I==null?void 0:I.slots)==null?void 0:wt.find(ge=>ge.talking),ne=React$2.useRef(!1),{startAnimation:ce,startAnimationUrl:me,resetActives:J,preloadTalking:H,unmountActives:W,startOnlyTalkingAnimation:V,shutUp:z}=useStateMachine(t),Y=React$2.useRef(),ie=Object.keys((I==null?void 0:I.audio)||{}).length,le=Object.keys((I==null?void 0:I.voice)||{}).length,fe=re||(I==null?void 0:I.type)==="conversationalNarration",de=ae||(I==null?void 0:I.type)==="conversationalDecision",ve=(I==null?void 0:I.type)==="conversationalCamera",Re=g&&!de&&!ve,[Te,Oe]=React$2.useState({text:"",name:"",inScene:!1,thinkful:!1,voiceOver:!1,avatar:"",show:!1}),Fe=React$2.useRef(null);fiber.useFrame(()=>{var ge;if((ge=At.current)!=null&&ge.node){const Z=At.current.node.weights.sil>.5;Fe.current=Z,Z&&(K!=null&&K.uid)?ft():Ge(K.uid,K.animation.url)}});const Ke=React$2.useMemo(()=>t.reduce((ge,Z)=>(Z.slots&&Z.slots.filter(xe=>xe.uid).forEach(xe=>{ge.includes(xe.uid)||ge.push(xe.uid)}),ge),[]),[t]),lt=React$2.useCallback(ge=>n({type:"translate",payload:ge}),[n]),[Qe,_t]=React$2.useState([]),$e=React$2.useMemo(()=>Qe[Qe.length-1],[Qe]),Ae=React$2.useCallback(()=>{const ge=o.find(he=>he.fromId===$e)||o.find(he=>he.toId===$e),Z=t.find(he=>he.id===(ge==null?void 0:ge.fromId));return!$e&&(S==null?void 0:S.line)>=0?{decision:!0}:Z},[o,t,$e]),Pe=React$2.useCallback(()=>{if(X){const Z=Ae();return Z==null?void 0:Z.decision}const ge=t[y-1]?t[y-1]:{};return y>0&&(ge==null?void 0:ge.decision)},[I,X,t,$e,o]),Ue=React$2.useCallback(()=>{if(X){const Z=Ae();return(Z==null?void 0:Z.type)==="conversationalCamera"}const ge=t[y-1]?t[y-1]:{};return y>0&&(ge==null?void 0:ge.type)==="conversationalCamera"},[I,X,t,$e,o]),Ve=React$2.useCallback(ge=>{var he,xe;const Z=a.find(Se=>(Se==null?void 0:Se.uid)===(ge==null?void 0:ge.uid)?Se:"");return((xe=(he=ge==null?void 0:ge.character)==null?void 0:he.resource)==null?void 0:xe.url)||(Z==null?void 0:Z.completeUrl)||""},[a]),Je=(ge=()=>{})=>{if(ne.current)ne.current&&(ne.current=!1);else{k.updateProjectionMatrix(),k.updateMatrixWorld(!0);const Z=M.current.child?M.current.pos:F.position.toArray();if(animationTarget.position.fromArray(Z),M.current.parent){animationTarget.quaternion.equals(k.quaternion)||animationTarget.applyQuaternion(k.quaternion);const he=M.current.isLeft?-1:1,xe=headSize*he;animationTarget.translateX(-10*he+xe),animationTarget.translateY(-2),animationTarget.translateZ(30)}gsapWithCSS.to(k.position,{duration:.9,ease:"power3.easeInOut",onStart:()=>{ne.current=!0},onUpdate:()=>{O.current.length&&O.current.forEach(he=>{const{object:xe}=he;xe.material.visible=!0})},onComplete:()=>{ge(),raycast.set(k.getWorldPosition(new three.Vector3(0,0,0)),k.getWorldDirection(new three.Vector3));const he=raycast.intersectObjects(C.children,!0);O.current=he.filter(xe=>xe.distance<10),O.current.length&&O.current.forEach(xe=>{const{object:Se}=xe;Se.material.side=0}),ne.current=!1,B.current&&e({type:"success"}),M.current.child||k.copy(F)},...animationTarget.position})}},xt=React$2.useCallback(()=>{M.current.child=null,M.current.parent=null,h&&Je()},[h]),nt=(ge,Z,he,xe=!1)=>{const Se=Z.includes("seated");if(he)me(ge,he.url,Z.includes("talking")).then(ue=>{if(ue&&BASIC_ACTIONS_TYPES_WHITELIST.includes(he.animationId))if(B.current)ce(ge,"idle");else{const be=Y.current===ge?"neutral_talking":"neutral";ce(ge,be)}});else{const ue=xe&&!Se?`${Z}-seated`:Z;ce(ge,ue)}},mt=()=>{if(!(K!=null&&K.uid)||B.current)return;const{emotion:ge,uid:Z,animation:he}=K,xe=getCurrentVisible(Z,C);if(xe){delete xe.userData._active;const{isSeated:Se}=xe;Y.current===Z?(nt(Z,"neutral",null,Se),Y.current=null):nt(Z,ge,he,Se)}},Ge=React$2.useCallback((ge,Z)=>{ge&&Z&&V(ge,Z)},[V,K]),ft=()=>{z()},Be=React$2.useCallback(()=>{B.current=!0,Oe({show:!1}),xt(),J(),h||e({type:"success"})},[k,e,xt,h]);React$2.useEffect(()=>()=>{te.current={},W()},[]);const Ye=ge=>{Oe({show:!1}),E(ge),e({type:"notifyProgress",payload:{line:ge}})},ke=React$2.useCallback((ge=!0)=>{const Z=ge?["fromId","toId"]:["toId","fromId"],he=o.filter(ue=>ue[Z[0]]===I.id),xe=he.length===1?he[0]:he.find(ue=>ue[Z[1]]===$e);if(!(xe!=null&&xe[Z[0]])){Be();return}ge||_t(Qe.slice(0,Qe.length-1));const Se=t.findIndex(ue=>ue.id===xe[Z[1]]);Se>=0?Ye(Se):Be()},[I==null?void 0:I.id,e,o,Be,t]),De=React$2.useCallback((ge,Z)=>{const he=[3,2,1][ge.id],Se=o.filter(be=>be.fromId===(I==null?void 0:I.id)).find(be=>parseInt(be.fromPointIndex)===he),ue=t.findIndex(be=>be.id===(Se==null?void 0:Se.toId));ue>=0?(Se==null?void 0:Se.fromId)===(Se==null?void 0:Se.toId)?Z():Ye(ue):Be()},[I==null?void 0:I.id,o,Be,t]),_e=React$2.useCallback(()=>{if(te.current={...K},w(!1),mt(),X)ke(!1);else if(!Pe()){const ge=y-1;Oe({show:!1}),E(ge),e({type:"notifyProgress",payload:{line:ge}})}},[ke,e,X,$,y,K]),Ne=React$2.useCallback(ge=>{if(X){if(ge){const Z=[3,2,1][ge.id],xe=o.filter(Se=>Se.fromId===I.id).find(Se=>parseInt(Se.fromPointIndex)===Z);if(xe){const Se=t.findIndex(ue=>ue.id===xe.toId);Se>=0&&e({type:"notifyProgress",payload:{line:Se}})}else e({type:"saveNode"})}}else if(y<t.length-1){const Z=y+1;e({type:"notifyProgress",payload:{line:Z}})}else e({type:"saveNode"})},[o,y,t,e,I==null?void 0:I.id,X]),Xe=React$2.useCallback((ge,Z)=>{if(te.current={...K},_t([...Qe,I.id]),w(!1),mt(),X)ge?De(ge,Z):ke();else if(y<t.length-1){const he=y+1;Ye(he)}else(u||de||ve)&&Be()},[e,I==null?void 0:I.id,X,de,ve,y,t.length,De,ke,Be,K]),Ft=()=>{v(!1),_e()},Dt=()=>X?I&&I.type!=="conversationalDecision"&&!o.find(ge=>ge.fromId===I.id):y===t.length-1,Le=()=>{Dt()?Be():(v(!1),Xe())};React$2.useEffect(()=>{if(X&&!b){const ge=S==null?void 0:S.line;if(ge>=0){T(!0),E(ge);return}const Z=t.filter(he=>!o.find(xe=>xe.toId===he.id));if(Z.length){const he=Z[0],xe=t.indexOf(he);xe>=0&&(T(!0),E(xe))}}},[o,X,t,b]);const ht=ge=>{if(te.current.uid===ge.uid||M.current.parent===ge)return;const Z=new three.Object3D,he=ge.getObjectByName("Head_M");he.updateMatrixWorld(!0),Z.applyMatrix4(he.matrixWorld),Z.applyQuaternion(k.quaternion);const xe=h?2.5:2,Se=h?1.2:1.5;Z.translateY(xe),Z.translateX(Se);const ue=new three.Vector3;ue.setFromMatrixPosition(he.matrixWorld);const Ie=ue.project(k).x<0;M.current={pos:Z.position.toArray(),child:he,parent:ge,isLeft:Ie}},Tt=ge=>{e({type:"resetZIndexUIContainer",payload:ge})};React$2.useEffect(()=>{var ge;if(fe)xt(),Oe({text:I==null?void 0:I.text,name:(I==null?void 0:I.alias)||(I==null?void 0:I.name)||`[ ${lt("storylines.misc.voiceOver")} ]`,inScene:!1,voiceOver:!0,thinkful:!1,top:!1,avatar:Ve(K),show:!0});else if(!B.current&&!de&&!ve){const Z=I==null?void 0:I.slots.filter(Se=>Se.uid&&!Se.talking),he=[...Z.map(Se=>Se.uid)||[],K==null?void 0:K.uid];if(Ke.filter(Se=>!he.includes(Se)).forEach(Se=>{ce(Se,"idle")}),Z.forEach(Se=>{const ue=getCurrentVisible(Se.uid,C);if(ue){const{isSeated:be}=ue;nt(Se.uid,Se.emotion,Se.animation,be)}}),K){const Se=getCurrentVisible(K.uid,C),ue=a.find(be=>be.uid===K.uid);Se&&!B.current?setTimeout(()=>{var be,Ie;if(K.uid===Se.uid){ht(Se);const{isSeated:et,userData:ct}=Se,{emotion:Rt,animation:pt}=K;!((be=ct._active)!=null&&be.includes("talking"))&&!((Ie=ct._active)!=null&&Ie.includes(Rt))&&nt(K.uid,Rt,pt,et);const dt=()=>{var kt;Oe({text:K.text,name:K.alias||((kt=K.character)==null?void 0:kt.name),inScene:!0,thinkful:K.emotion.includes("think"),avatar:Ve(K),show:!0})};h?(ne.current=!1,Je(dt)):dt()}},150):(xt(),Oe({text:K.text,name:K.alias||((ge=K.character)==null?void 0:ge.name)||(ue==null?void 0:ue.name),left:!1,top:K.text.length>maxCharacterToSwitch,inScene:!1,thinkful:K.emotion.includes("think"),avatar:Ve(K),show:!0}))}else xt(),Oe({show:!0})}},[a,I,h,C,lt,Ve,xt,de,fe,Ke]);const it=cleanTextOfHtmlTags(Te==null?void 0:Te.text),[At,Ct]=useEkho({audioType:I==null?void 0:I.audioType,volume:I==null?void 0:I.audioVolume,voice:I==null?void 0:I.voice,started:Te.show,text:it,audio:I==null?void 0:I.audio,soundActions:d,getEvent:n,pauseTTS:p,onStart:()=>{},onError:()=>{mt(),w(!0)},onFinish:()=>{mt(),Re&&!p&&Xe()}});React$2.useEffect(()=>(Ct(),()=>{Ct()}),[y,Ct]),React$2.useEffect(()=>{var ge;if(((I==null?void 0:I.audioType)==="none"||_)&&(Te!=null&&Te.show)&&!(K!=null&&K.emotion.includes("think"))){const Z=characterMs*(((ge=Te==null?void 0:Te.text)==null?void 0:ge.length)||0);setTimeout(()=>{mt()},Z<minMs?minMs:Z)}},[_,I==null?void 0:I.audioType,K==null?void 0:K.emotion,Te]),React$2.useEffect(()=>{var ge;if(Re&&Te.show&&((I==null?void 0:I.audioType)==="none"||_)&&!p){const Z=characterMs*(((ge=Te==null?void 0:Te.text)==null?void 0:ge.length)||0);(!Dt()||Dt()&&u)&&D(Xe,Z<minMs?minMs:Z)}return()=>{P()}},[Te,Xe,D,u,P,I==null?void 0:I.audioType,Re,ie,le,_]);const Xt=React$2.useMemo(()=>y===0||Pe()||Ue(),[y,Pe,Ue]),ut=l({disabled:de||!Te.show,repeat:!1,forward:Le,rewind:Xt?null:Ft});React$2.useEffect(()=>ut(),[ut]);const Vt=document.querySelector(".screens--container");if(ve)return jsxRuntimeExports.jsx(ChangeCamera,{...I,emitEvent:e,success:!1,onFinish:Xe},`change-camera-${y}`);if(de){const ge=I.id?t.filter(he=>he.decision).findIndex(he=>he.id===I.id)+1:t.filter(he=>he.decision).findIndex(he=>he===I)+1,Z={...I.payload,decisionNumber:ge,inheritProps:{slots:[],disableBackground:!0},required:!X,branched:X,onAddPoints:Ne,onFinish:Xe,emitEvent:e,getEvent:n,pause:p,soundActions:d,keyboardControl:l};return jsxRuntimeExports.jsx(HtmlWrap,{onMount:()=>{xt(),Tt(!0)},onUnMount:()=>{ne.current=!1,Tt(!1)},children:jsxRuntimeExports.jsx(DecisionComponent,{inScene:!0,...Z})})}return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Te.text?jsxRuntimeExports.jsx(BubbleWrapper,{translate:lt,currentMessage:Te}):null,jsxRuntimeExports.jsx(arcadeThreeCore.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",style:{width:"100%",height:"100%",position:"static"},portal:Vt?{current:Vt}:void 0,zIndexRange:[6,6],onOcclude:()=>{},calculatePosition:()=>[0,0],children:jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"ltr",className:"dialog-component-controls",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:Ft,disabled:Xt||!Te.show,className:`gat--btn__round ${Xt||!Te.show?"disabled":""}`,"aria-label":LangIsRtl()?lt("storylines.misc.forward"):lt("storylines.misc.rewind"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{type:"button",onClick:Le,disabled:!Te.show,className:`gat--btn__round
273
273
  ${Te.show?"":"disabled"}
274
- ${g&&Dt()?"glowing-animation":""}`,"aria-label":LangIsRtl()?lt("storylines.misc.rewind"):lt("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})}const activeCache=arcadeThreeCore.ProgressManager.request("AssetLoader").cache,assetLoader=new arcadeThreeCore.AssetLoader(void 0,activeCache);function Animation({animation:l,loopTimes:e,onAnimationFinish:n,onAnimationSave:t,resource:a,makeDefault:o}){const[d,h]=React$2.useState(!1),f=fiber.useThree(p=>p.scene),u=React$2.useRef(1);return React$2.useEffect(()=>{h(!1)},[a.uid,l==null?void 0:l.url]),React$2.useEffect(()=>{if(!d){const p=f.getObjectByProperty("uid",a.uid);if(p&&l&&l.url&&p.skeletonId===(l==null?void 0:l.skeletonId))if(o)t({uid:a.uid,animation:l==null?void 0:l.id,index:p.index}),n();else{const S=p.userData.animator,R=()=>{S.getAction(l.url).setLoop(three.LoopRepeat,1/0),u.current=1;function E(){u.current>=e&&(S.mix("idle"),n(),S.removeEventListener("loop",E)),u.current+=1}S.mix(l==null?void 0:l.url).then(g=>{g&&S.addEventListener("loop",E)}),h(!0)};S.getAction(l==null?void 0:l.url)?R():assetLoader.load(l==null?void 0:l.url,y=>{S.register(l==null?void 0:l.url,y.animations[0]),R()},void 0,y=>{console.error(`Asset loader failed with: ${l.url}`,y),n()})}else n()}},[f,l==null?void 0:l.url,e,d,a.uid,o,l,a,n,t]),null}function MultipleAnimation({animations:l=[],enableInteraction:e,emitEvent:n}){const t=l.length,a=React$2.useRef(0),o=()=>{a.current+=1,a.current>=t&&e&&n({type:"success"})},d=h=>{n({type:"saveAnimation",payload:h})};return React$2.useEffect(()=>{a.current=0},[l]),React$2.useEffect(()=>{e||n({type:"success"})},[n,e]),l.map(({animation:h,...f},u)=>{var p;return jsxRuntimeExports.jsx(Animation,{animation:h,...f,onAnimationFinish:o,onAnimationSave:d},(h==null?void 0:h.id)||((p=f.resource)==null?void 0:p.uid)||u)})}function EmailPill({text:l,error:e,handleClick:n}){return jsxRuntimeExports.jsxs("div",{"data-testid":`${e?" pill--error":"pill--ok"}`,className:`email-pill ${e?" email-pill--error":""}`,children:[jsxRuntimeExports.jsx("div",{children:l}),jsxRuntimeExports.jsx("div",{className:"email-pill__delete",children:jsxRuntimeExports.jsx("button",{type:"button",onClick:n,className:"icon-close unset-button","aria-label":"icon click"})})]})}function StepOne({handleContinue:l,handleCancel:e,translate:n,text:t}){const[a,o]=React$2.useState([]),[d,h]=React$2.useState(0),[f,u]=React$2.useState(0),p=React$2.useRef(null),S=(g,v,b)=>{g.stopPropagation(),o(a.filter(T=>T!==a[b])),v.error&&h(d-1),v.isRepeat&&u(f-1)},R=()=>{p.current&&p.current.focus()},y=()=>{[" ",",",";","."].includes(p.current.value)&&(p.current.value="")},E=g=>{const v=p.current.value,b=["Space","Comma","Period","Enter"],T=["Space","Comma","Enter","Tab"];v===""&&(b.includes(g.code)||g.keyCode==="186"||g.key==="Enter"||g.key===" ")?g.preventDefault():p.current.value.length>1&&(T.includes(g.code)||g.type==="blur")&&(g.preventDefault(),/[A-Za-z0-9._%+-]{3,}@[A-Za-z0-9_+-]{2,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})/.test(v)?a.find(w=>w.text===v)?(u(f+1),o([...a,{text:v,error:!0,isRepeat:!0}])):o([...a,{text:v}]):(o([...a,{text:v,error:!0}]),h(d+1)),p.current.value="")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:n("puzzles.referrals.inviter.titleStep1")}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__subtitle",children:t}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__form",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__instructions",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.instructions")}),jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.limit")})]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:R,"aria-labelledby":"list of emails",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[a&&a.map((g,v)=>jsxRuntimeExports.jsx(EmailPill,{text:g.text,error:g.error,handleClick:b=>S(b,g,v),emailPillIndex:v},`${a.indexOf(g)}`)),a.length<=9?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{id:"email",ref:p,className:"referrals-piece__inputemail",onChange:y,onKeyDown:E,onBlur:E,type:"email",autoComplete:"off"}),jsxRuntimeExports.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:jsxRuntimeExports.jsx("span",{children:n("puzzles.referrals.inviter.skipButton")})})]}):null]})}),jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__errormessage",children:[jsxRuntimeExports.jsx("div",{children:f>0?n("puzzles.referrals.inviter.errorEmailRepeat"):null}),jsxRuntimeExports.jsx("div",{children:d>0?n("puzzles.referrals.inviter.errorMessage"):null})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[a.length,"/10"]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__buttons",children:[jsxRuntimeExports.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:e,children:n("puzzles.referrals.inviter.skipButton")}),jsxRuntimeExports.jsx("button",{className:`gat--btn gat--btn__primary ${f>0||d>0||a.length===0?" disabled":""}`,type:"button",disabled:d>0||a.length===0,onClick:()=>l(a),children:n("puzzles.referrals.inviter.inviteButton")})]})]})}function StepTwo({handleFinish:l,translate:e,valid:n,invalid:t}){const[a,o]=React$2.useState(!1),d=()=>{o(!a)},h=n.current===1?"invitationSend":"invitationsSend",f=t===1?"invitationNotSend":"invitationsNotSend";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep2")}),jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__feedback",children:[n.current!==0&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:n.current})," ",e(`puzzles.referrals.inviter.${h}`)]})]}),!!t.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:t.current})," ",e(`puzzles.referrals.inviter.${f}`)]}),jsxRuntimeExports.jsx("button",{className:"un-button",type:"button",onClick:d,children:e("puzzles.referrals.inviter.whyFail")})]})]}),a?jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__failsreasons",children:[jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons1")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons2")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons3")})]}):null]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__buttons",children:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:l,children:e("puzzles.referrals.inviter.continueButton")})})]})}function ReferralComponent({emitEvent:l,getEvent:e,text:n,rewards:t,referrals:a}){const o=y=>e({type:"translate",payload:y}),[d,h]=React$2.useState("step1"),f=React$2.useRef(0),u=React$2.useRef(0),p=async y=>{const E=y.map(v=>v.text),g=await l({type:"sendReferrals",payload:E});f.current=g&&g.data?g.data.valid.length:0,u.current=E.length-f.current,h("step2")};if(!a)return l({type:"success"}),null;const S=()=>{l({type:"success"})},R=()=>{if(f.current){const y=t.map(E=>(E.points*=f.current,E));l({type:"addPoints",complex:!0,finish:!0,payload:y})}else l({type:"success"})};return jsxRuntimeExports.jsx("div",{className:"referrals-piece",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__center",children:[d==="step1"&&jsxRuntimeExports.jsx(StepOne,{translate:o,handleContinue:p,handleCancel:S,text:n}),d==="step2"&&jsxRuntimeExports.jsx(StepTwo,{translate:o,handleFinish:R,valid:f,invalid:u})]})})}function PseudoNoEvaluationEvent({onPass:l}){return React$2.useEffect(()=>{const e=setTimeout(l,0);return()=>clearTimeout(e)},[l]),null}function DragToSceneComponent({itemResolver:l,consume:e,hasComplexNotResolvers:n,hasComplexResolvers:t,resolverObjects:a,feedback:o,emitEvent:d,getEvent:h,soundActions:f,keyboardControl:u,noEvaluation:p}){const[S]=f,[R,y]=React$2.useState(!1),[E,g]=React$2.useState(!1),[v,b]=React$2.useState(!1),T=D=>h({type:"translate",payload:D}),_=React$2.useCallback(()=>{d({type:"addPoints",complex:!0,finish:R.success,onFinish:()=>{R.success?d({type:"success"}):d({type:"closeScreen"})},payload:R.rewards})},[d,R]),w=React$2.useCallback(()=>{if(a.find(P=>P===l.uid)){let P;t?(P=o.resolvers.rights.find(O=>O.uidObject===l.uid),P||(P=o.resolvers.rights[0])):P=o.resolvers.rights[0],e&&d({type:"consumeItem",payload:{uid:l.uid,targetId:l.uid,name:l.name}}),y({...P,success:!0})}else{let P;n?(P=o.notResolvers.wrongs.find(O=>O.uidObject===l.uid),P||(P=o.notResolvers.wrongs[0])):P=o.notResolvers.wrongs[0],y({...P,success:!1})}},[a,l,t,e,o,d,n]),C=React$2.useCallback(()=>{if(a.find(P=>P===(l==null?void 0:l.uid))){let P;t?P=[...o.resolvers.rights.find(M=>M.uidObject===(l==null?void 0:l.uid)).rewards.filter(M=>M.type==="var")]:P=[...o.resolvers.rights[0].rewards.filter(F=>F.type==="var")],e&&d({type:"consumeItem",payload:{uid:l==null?void 0:l.uid,targetId:l==null?void 0:l.uid,name:l==null?void 0:l.name}}),b({varsPoints:[...P],success:!0})}else{let P;n?P=[...o.notResolvers.wrongs.find(M=>M.uidObject===(l==null?void 0:l.uid)).rewards.filter(M=>M.type==="var")]:P=[...o.notResolvers.wrongs[0].rewards.filter(F=>F.type==="var")],b({varsPoints:[...P],success:!1})}},[e,d,o.notResolvers.wrongs,o.resolvers.rights,n,t,l==null?void 0:l.name,l==null?void 0:l.uid,a]),k=React$2.useCallback(()=>{g(!1),d({type:"addPoints",complex:!0,finish:v==null?void 0:v.success,onFinish:()=>{v!=null&&v.success?d({type:"success"}):d({type:"closeScreen"})},payload:v!=null&&v.varsPoints?v==null?void 0:v.varsPoints:[]})},[d,v==null?void 0:v.success,v==null?void 0:v.varsPoints]);return React$2.useEffect(()=>{l?p?C():w():d({type:"closeScreen"})},[w,C,d,l,p]),React$2.useEffect(()=>{v!=null&&v.success&&g(!0)},[v]),E?jsxRuntimeExports.jsx(PseudoNoEvaluationEvent,{onPass:k}):R?jsxRuntimeExports.jsx(FeedbackComponent$1,{text:R.desc,success:R.success,playSound:S,hasTimeout:!R.desc,delay:2e3,translate:T,keyboardControl:u,functionOnClose:_}):null}function MatchItem({item:l,viewMode:e}){var n,t;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[e==="text"&&jsxRuntimeExports.jsx("div",{className:"match-item-text",children:HTMLReactParser$1(l==null?void 0:l.content)}),e==="card"&&jsxRuntimeExports.jsx("div",{className:"match-item-image",children:jsxRuntimeExports.jsxs("figure",{children:[((n=l==null?void 0:l.img)==null?void 0:n.url)&&jsxRuntimeExports.jsx("img",{src:(t=l==null?void 0:l.img)==null?void 0:t.url,alt:l==null?void 0:l.imgName}),(l==null?void 0:l.content)&&jsxRuntimeExports.jsx("figcaption",{children:HTMLReactParser$1(l==null?void 0:l.content)})]})})]})}function CountDownDialog({translate:l,onClose:e,buttonLabel:n}){return jsxRuntimeExports.jsx("div",{className:"timer-dialog",children:jsxRuntimeExports.jsxs("div",{className:"timer-dialog__container",children:[jsxRuntimeExports.jsx("div",{className:"timer-dialog__title",children:l("storylines.misc.ready")}),jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:e,children:jsxRuntimeExports.jsx("span",{children:l(`${n}`)})})]})})}function CountdownTimer({initialSeconds:l=10,isPaused:e,shouldStart:n,shouldReset:t,onTimeOver:a}){const[o,d]=React$2.useState(l),[h,f]=React$2.useState(!1),u=React$2.useRef();React$2.useEffect(()=>{t&&(d(l),f(!1))},[t,l]),React$2.useEffect(()=>{e&&f(!1)},[e]),React$2.useEffect(()=>{n&&f(!0)},[n]),React$2.useEffect(()=>(h&&o>0?u.current=setInterval(()=>{d(S=>S-1),o===1&&a()},1e3):o===0&&(clearInterval(u.current),f(!1)),()=>clearInterval(u.current)),[h,a,o]);const p=S=>{const R=Math.floor(S/60),y=S%60,E=String(R).padStart(2,"0"),g=String(y).padStart(2,"0");return`${E}:${g}`};return jsxRuntimeExports.jsx("div",{className:`count-down ${o<10&&"count-down--finalseconds"}`,children:jsxRuntimeExports.jsx("div",{children:p(o)})})}function MatchPuzzleComponent({emitEvent:l,soundActions:e=[()=>{},()=>{}],getEvent:n,info:t,specificFeedbacks:a,setResolveAction:o,nodeId:d,viewMode:h,title:f,sources:u,destinations:p,correctPairings:S,timer:R=0,keyboardControl:y}){const E=Ae=>n({type:"translate",payload:Ae}),g=`match-puzzle_${d}`,[v,b]=React$2.useState([]),[T,_]=React$2.useState(null),[w,C]=React$2.useState(!1),[k,D]=React$2.useState(!1),[P,O]=React$2.useState(""),[F,M]=React$2.useState(!1),[I,$]=React$2.useState([]),[B]=e;useEkho({soundActions:e});const X=Ae=>{B("click-ui"),_(Ae.id)},re=Ae=>{const Pe={[T]:Ae};return S.some(Ue=>{const Ve=JSON.stringify(Ue),Je=JSON.stringify(Pe);return Ve===Je})},ae=(Ae,Pe)=>{const Ue=new Map(Ae.map(Ve=>[Ve.id,{...Ve}]));return Pe.forEach(Ve=>{Ue.has(Ve.id)?Ue.get(Ve.id).points+=Ve.points:Ue.set(Ve.id,{...Ve})}),Array.from(Ue.values())},te=Ae=>{var Pe,Ue;if(B("click-ui"),re(Ae.id)){const Ve=[...v,{[T]:Ae.id}];if(b(Ve),a.specificCorrectFeedbacks){const Je=a==null?void 0:a.correctFeedbacks.find(mt=>mt.id===`${T}-${Ae.id}`),xt=ae(I,Je.rewards);$([...xt]),K(Ve)&&(lt(),M(!0)),Je.desc&&(O(Je==null?void 0:Je.desc),D(!0),C(!0),lt());const nt=K(Ve);!Je.desc&&nt&&ne(xt)}else if(K(Ve)&&(lt(),M(!0)),K(Ve)){D(!0),t.solution.right.desc&&(lt(),O(t.solution.right.desc)),C(!0),M(!0);const xt=ae(I,t.solution.right.rewards);$([...xt]),t.solution.right.desc===""&&setTimeout(()=>{ne(xt)},3e3)}_(null)}else{const Ve=ae(I,t.solution.wrong.rewards);$([...Ve]),document.querySelector(`#${Ae.id}`).classList.add("match-button--error"),document.querySelector(`#${T}`).classList.add("match-button--error"),setTimeout(()=>{document.querySelector(`#${Ae.id}`).classList.remove("match-button--error"),document.querySelector(`#${T}`).classList.remove("match-button--error"),_(null)},1e3),(Ue=(Pe=t.solution)==null?void 0:Pe.wrong)!=null&&Ue.desc&&(O(t.solution.wrong.desc),C(!0),lt())}},K=Ae=>{if(S.length!==Ae.length)return!1;const Pe=new Set(S.map(Ve=>JSON.stringify(Ve))),Ue=new Set(Ae.map(Ve=>JSON.stringify(Ve)));for(const Ve of Ue)if(!Pe.has(Ve))return!1;return!0},ne=Ae=>{B("score");const Pe=Ae?[...Ae]:[...I];l({type:"addPoints",complex:!0,finish:!0,payload:Pe}),l({type:"passPuzzle"})},ce=()=>{C(!1),D(!1),O(""),ie&&(_t(),V(!0)),!ie&&!F&&Qe(),F&&ne()},me=React$2.useMemo(()=>Object.assign({},...v),[v]),J=(Ae,Pe)=>me[Ae]===Pe;React$2.useEffect(()=>{o(()=>{B("score"),lt(),D(!0),O(t.solution.right.desc);const Ae=[...I,...t.resolve.rewards],Pe=[...S];b(Pe),setTimeout(()=>{D(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:g,rewards:Ae,finish:!0}})},5e3)})},[I,S,l,t.resolve.rewards,t.solution.right.desc,B,g,o]);const H=(Ae,Pe)=>v.findIndex(Ue=>{const Ve=Object.keys(Ue)[0],Je=Object.values(Ue)[0];return Ve===Ae&&Je===Pe}),[W,V]=React$2.useState(!0),[z,Y]=React$2.useState("storylines.misc.start"),[ie,le]=React$2.useState(!1),fe=()=>{Y("storylines.misc.retry"),V(!1),le(!1),Qe()},[de,ve]=React$2.useState(!1),[Re,Te]=React$2.useState(!1),[Oe,Fe]=React$2.useState(!1),Ke=()=>{let Ae=ae(I,t.timerFeedback.rewards);if(a.specificCorrectFeedbacks){const Pe=new Map(Ae.map(Ue=>[Ue.id,{...Ue}]));v.forEach(Ue=>{const Ve=Object.keys(Ue)[0],Je=Ue[Ve],xt=a.correctFeedbacks.find(nt=>nt.id===`${Ve}-${Je}`);xt!=null&&xt.rewards&&xt.rewards.forEach(nt=>{if(Pe.has(nt.id)){const mt=Pe.get(nt.id);mt.points-=nt.points,Pe.set(nt.id,mt)}})}),Ae=Array.from(Pe.values())}$(Ae),b([]),le(!0),O(t.timerFeedback.desc),C(!0)},lt=()=>{ve(!0),Te(!1),Fe(!1)},Qe=()=>{ve(!1),Te(!0),Fe(!1)},_t=()=>{ve(!1),Te(!1),Fe(!0)},$e=React$2.useCallback(()=>{const Ae=document.querySelector('button[id^="source-item"]'),Pe=document.querySelector('button[id^="destination-item"]'),Ue=Ae.getBoundingClientRect().right,Je=Pe.getBoundingClientRect().left+6-Ue;u.items.forEach((xt,nt)=>{if(xt.matchDestinationId!==void 0&&xt.matchDestinationId!==null){const mt=document.querySelector(`#${xt.id}`),Ge=document.querySelector(`#${xt.matchDestinationId}`),ft=mt.getBoundingClientRect().top,Be=Ge.getBoundingClientRect().top,Ye=Be>ft,ke=Math.abs(Be-ft),De=Math.sqrt(Je*Je+ke*ke),_e=mt.querySelector(".match-line__hipotenuse");_e.style.setProperty("width",`${De}px`);const Ne=Math.atan(ke/Je),Xe=Ye?Ne*(180/Math.PI):-Ne*(180/Math.PI);_e.style.setProperty("transform",`rotate(${Xe}deg)`)}})},[u.items]);return React$2.useEffect(()=>($e(),window.addEventListener("resize",$e),()=>{window.removeEventListener("resize",$e)}),[$e]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"match",children:[(f||R>0)&&jsxRuntimeExports.jsxs("header",{className:"match__header",children:[f&&jsxRuntimeExports.jsx("div",{className:"match__title",children:f}),R>0&&jsxRuntimeExports.jsx(CountdownTimer,{initialSeconds:R,isPaused:de,shouldStart:Re,shouldReset:Oe,onTimeOver:Ke})]}),jsxRuntimeExports.jsx("div",{className:"match__columns",children:jsxRuntimeExports.jsxs("div",{className:"match__columns-scroll",children:[jsxRuntimeExports.jsxs("div",{className:"match__column-wrap",children:[u.title&&jsxRuntimeExports.jsx("div",{className:"match__subtitle",children:u.title}),jsxRuntimeExports.jsx("div",{className:"match__column",children:u.items.map((Ae,Pe)=>jsxRuntimeExports.jsxs("button",{id:Ae.id,className:["unset-button match-button",T===Ae.id&&"match-button--marked",J(Ae.id,Ae.matchDestinationId)&&"match-button--success",H(Ae.id,Ae.matchDestinationId)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${H(Ae.id,Ae.matchDestinationId)+1})`},disabled:J(Ae.id,Ae.matchDestinationId),type:"button",onClick:()=>X(Ae),children:[jsxRuntimeExports.jsx(MatchItem,{item:Ae,viewMode:h}),jsxRuntimeExports.jsx("div",{className:"icon-check-circle-black color--success"}),jsxRuntimeExports.jsx("div",{className:"icon-error-circle-black color--error"}),jsxRuntimeExports.jsx("div",{className:"match-line__hipotenuse"})]},Ae.id))})]}),jsxRuntimeExports.jsxs("div",{className:"match__column-wrap",children:[p.title&&jsxRuntimeExports.jsx("div",{className:"match__subtitle",children:p.title}),jsxRuntimeExports.jsx("div",{className:"match__column",children:p.items.map((Ae,Pe)=>jsxRuntimeExports.jsxs("button",{id:Ae.id,className:["unset-button match-button",T===Ae.id&&"match-button--marked",J(Ae.matchSourceId,Ae.id)&&"match-button--success",H(Ae.matchSourceId,Ae.id)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${H(Ae.matchSourceId,Ae.id)+1})`},disabled:J(Ae.matchSourceId,Ae.id)||T===null&&!J(Ae.matchSourceId,Ae.id),type:"button",onClick:()=>te(Ae),children:[jsxRuntimeExports.jsx(MatchItem,{item:Ae,viewMode:h}),jsxRuntimeExports.jsx("div",{className:"icon-check-circle-black color--success"}),jsxRuntimeExports.jsx("div",{className:"icon-error-circle-black color--error"})]},Ae.id))})]})]})})]}),R>0&&W&&jsxRuntimeExports.jsx(CountDownDialog,{buttonLabel:z,translate:E,onClose:fe}),w&&jsxRuntimeExports.jsx(FeedbackComponent$1,{success:k,text:P,hasTimeout:!P,translate:E,timeExpired:ie,functionOnClose:ce,keyboardControl:y})]})}exports.AnimationComponent=MultipleAnimation;exports.AutoEvaluationComponent=AutoEvaluation;exports.CardsSelectorPuzzleComponent=CardsSelectorPuzzleComponent;exports.CartelComponent=CartelComponent;exports.ChainedImageClickPuzzleComponent=ChainedImageClickPuzzleComponent;exports.ChangeCamera=ChangeCamera;exports.ComicComponent=ComicComponent;exports.ConversationalComponent=ConversationalComponent;exports.ConversationalProComponent=ConversationalProComponent;exports.CrackerPuzzleComponent=CrackerPuzzleComponent;exports.DecisionComponent=DecisionComponent;exports.DialogComponent=DialogComponent;exports.DragItemPuzzleComponent=DragItemPuzzleComponent;exports.DragToSceneComponent=DragToSceneComponent;exports.FrameImageClickComponent=FrameImageClickComponent;exports.HackerPuzzleComponent=HackerPuzzleComponent;exports.HangedPuzzleComponent=HangedPuzzleComponent;exports.ImageClickPuzzleComponent=ImageClickPuzzleComponent;exports.ImageComponent=ImageComponent;exports.InventoryItem=InventoryItem;exports.KeyboardPuzzleComponent=KeyboardPuzzleComponent;exports.LecturesComponent=LecturesComponent;exports.LoginPuzzleComponent=LoginPuzzleComponent;exports.MatchPuzzleComponent=MatchPuzzleComponent;exports.NoticeComponent=NoticeComponent;exports.PatternComponent=PatternComponent;exports.PdfComponent=PdfComponent;exports.PdfVisor=PdfVisor;exports.ReferralComponent=ReferralComponent;exports.SurveyComponent=SurveyComponent;exports.TerminalPuzzleComponent=TerminalPuzzleComponent;exports.TestComponent=TestComponent;exports.TextClickPuzzleComponent=TextClickPuzzleComponent;exports.UrlComponent=UrlComponent;exports.VideoComponent=VideoComponent;exports.VideoVisor=VideoVisor;exports.WebBuilderPuzzleComponent=WebBuilderPuzzleComponent;exports.WriterPuzzleComponent=WriterPuzzleComponent;
274
+ ${g&&Dt()?"glowing-animation":""}`,"aria-label":LangIsRtl()?lt("storylines.misc.rewind"):lt("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})}const activeCache=arcadeThreeCore.ProgressManager.request("AssetLoader").cache,assetLoader=new arcadeThreeCore.AssetLoader(void 0,activeCache);function Animation({animation:l,loopTimes:e,onAnimationFinish:n,onAnimationSave:t,resource:a,makeDefault:o}){const[d,h]=React$2.useState(!1),f=fiber.useThree(p=>p.scene),u=React$2.useRef(1);return React$2.useEffect(()=>{h(!1)},[a.uid,l==null?void 0:l.url]),React$2.useEffect(()=>{if(!d){const p=f.getObjectByProperty("uid",a.uid);if(p&&l&&l.url&&p.skeletonId===(l==null?void 0:l.skeletonId))if(o)t({uid:a.uid,animation:l==null?void 0:l.id,index:p.index}),n();else{const S=p.userData.animator,R=()=>{S.getAction(l.url).setLoop(three.LoopRepeat,1/0),u.current=1;function E(){u.current>=e&&(S.mix("idle"),n(),S.removeEventListener("loop",E)),u.current+=1}S.mix(l==null?void 0:l.url).then(g=>{g&&S.addEventListener("loop",E)}),h(!0)};S.getAction(l==null?void 0:l.url)?R():assetLoader.load(l==null?void 0:l.url,y=>{S.register(l==null?void 0:l.url,y.animations[0]),R()},void 0,y=>{console.error(`Asset loader failed with: ${l.url}`,y),n()})}else n()}},[f,l==null?void 0:l.url,e,d,a.uid,o,l,a,n,t]),null}function MultipleAnimation({animations:l=[],enableInteraction:e,emitEvent:n}){const t=l.length,a=React$2.useRef(0),o=()=>{a.current+=1,a.current>=t&&e&&n({type:"success"})},d=h=>{n({type:"saveAnimation",payload:h})};return React$2.useEffect(()=>{a.current=0},[l]),React$2.useEffect(()=>{e||n({type:"success"})},[n,e]),l.map(({animation:h,...f},u)=>{var p;return jsxRuntimeExports.jsx(Animation,{animation:h,...f,onAnimationFinish:o,onAnimationSave:d},(h==null?void 0:h.id)||((p=f.resource)==null?void 0:p.uid)||u)})}function EmailPill({text:l,error:e,handleClick:n}){return jsxRuntimeExports.jsxs("div",{"data-testid":`${e?" pill--error":"pill--ok"}`,className:`email-pill ${e?" email-pill--error":""}`,children:[jsxRuntimeExports.jsx("div",{children:l}),jsxRuntimeExports.jsx("div",{className:"email-pill__delete",children:jsxRuntimeExports.jsx("button",{type:"button",onClick:n,className:"icon-close unset-button","aria-label":"icon click"})})]})}function StepOne({handleContinue:l,handleCancel:e,translate:n,text:t}){const[a,o]=React$2.useState([]),[d,h]=React$2.useState(0),[f,u]=React$2.useState(0),p=React$2.useRef(null),S=(g,v,b)=>{g.stopPropagation(),o(a.filter(T=>T!==a[b])),v.error&&h(d-1),v.isRepeat&&u(f-1)},R=()=>{p.current&&p.current.focus()},y=()=>{[" ",",",";","."].includes(p.current.value)&&(p.current.value="")},E=g=>{const v=p.current.value,b=["Space","Comma","Period","Enter"],T=["Space","Comma","Enter","Tab"];v===""&&(b.includes(g.code)||g.keyCode==="186"||g.key==="Enter"||g.key===" ")?g.preventDefault():p.current.value.length>1&&(T.includes(g.code)||g.type==="blur")&&(g.preventDefault(),/[A-Za-z0-9._%+-]{3,}@[A-Za-z0-9_+-]{2,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})/.test(v)?a.find(w=>w.text===v)?(u(f+1),o([...a,{text:v,error:!0,isRepeat:!0}])):o([...a,{text:v}]):(o([...a,{text:v,error:!0}]),h(d+1)),p.current.value="")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:n("puzzles.referrals.inviter.titleStep1")}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__subtitle",children:t}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__form",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__instructions",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.instructions")}),jsxRuntimeExports.jsx("div",{dir:"auto",children:n("puzzles.referrals.inviter.limit")})]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:R,"aria-labelledby":"list of emails",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[a&&a.map((g,v)=>jsxRuntimeExports.jsx(EmailPill,{text:g.text,error:g.error,handleClick:b=>S(b,g,v),emailPillIndex:v},`${a.indexOf(g)}`)),a.length<=9?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{id:"email",ref:p,className:"referrals-piece__inputemail",onChange:y,onKeyDown:E,onBlur:E,type:"email",autoComplete:"off"}),jsxRuntimeExports.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:jsxRuntimeExports.jsx("span",{children:n("puzzles.referrals.inviter.skipButton")})})]}):null]})}),jsxRuntimeExports.jsxs("div",{dir:LangIsRtl()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__errormessage",children:[jsxRuntimeExports.jsx("div",{children:f>0?n("puzzles.referrals.inviter.errorEmailRepeat"):null}),jsxRuntimeExports.jsx("div",{children:d>0?n("puzzles.referrals.inviter.errorMessage"):null})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[a.length,"/10"]})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"referrals-piece__buttons",children:[jsxRuntimeExports.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:e,children:n("puzzles.referrals.inviter.skipButton")}),jsxRuntimeExports.jsx("button",{className:`gat--btn gat--btn__primary ${f>0||d>0||a.length===0?" disabled":""}`,type:"button",disabled:d>0||a.length===0,onClick:()=>l(a),children:n("puzzles.referrals.inviter.inviteButton")})]})]})}function StepTwo({handleFinish:l,translate:e,valid:n,invalid:t}){const[a,o]=React$2.useState(!1),d=()=>{o(!a)},h=n.current===1?"invitationSend":"invitationsSend",f=t===1?"invitationNotSend":"invitationsNotSend";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep2")}),jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__feedback",children:[n.current!==0&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:n.current})," ",e(`puzzles.referrals.inviter.${h}`)]})]}),!!t.current&&jsxRuntimeExports.jsxs("li",{children:[jsxRuntimeExports.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("strong",{children:t.current})," ",e(`puzzles.referrals.inviter.${f}`)]}),jsxRuntimeExports.jsx("button",{className:"un-button",type:"button",onClick:d,children:e("puzzles.referrals.inviter.whyFail")})]})]}),a?jsxRuntimeExports.jsxs("ul",{className:"referrals-piece__failsreasons",children:[jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons1")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons2")}),jsxRuntimeExports.jsx("li",{children:e("puzzles.referrals.inviter.failReasons3")})]}):null]}),jsxRuntimeExports.jsx("div",{className:"referrals-piece__buttons",children:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:l,children:e("puzzles.referrals.inviter.continueButton")})})]})}function ReferralComponent({emitEvent:l,getEvent:e,text:n,rewards:t,referrals:a}){const o=y=>e({type:"translate",payload:y}),[d,h]=React$2.useState("step1"),f=React$2.useRef(0),u=React$2.useRef(0),p=async y=>{const E=y.map(v=>v.text),g=await l({type:"sendReferrals",payload:E});f.current=g&&g.data?g.data.valid.length:0,u.current=E.length-f.current,h("step2")};if(!a)return l({type:"success"}),null;const S=()=>{l({type:"success"})},R=()=>{if(f.current){const y=t.map(E=>(E.points*=f.current,E));l({type:"addPoints",complex:!0,finish:!0,payload:y})}else l({type:"success"})};return jsxRuntimeExports.jsx("div",{className:"referrals-piece",children:jsxRuntimeExports.jsxs("div",{className:"referrals-piece__center",children:[d==="step1"&&jsxRuntimeExports.jsx(StepOne,{translate:o,handleContinue:p,handleCancel:S,text:n}),d==="step2"&&jsxRuntimeExports.jsx(StepTwo,{translate:o,handleFinish:R,valid:f,invalid:u})]})})}function PseudoNoEvaluationEvent({onPass:l}){return React$2.useEffect(()=>{const e=setTimeout(l,0);return()=>clearTimeout(e)},[l]),null}function DragToSceneComponent({itemResolver:l,consume:e,hasComplexNotResolvers:n,hasComplexResolvers:t,resolverObjects:a,feedback:o,emitEvent:d,getEvent:h,soundActions:f,keyboardControl:u,noEvaluation:p}){const[S]=f,[R,y]=React$2.useState(!1),[E,g]=React$2.useState(!1),[v,b]=React$2.useState(!1),T=D=>h({type:"translate",payload:D}),_=React$2.useCallback(()=>{d({type:"addPoints",complex:!0,finish:R.success,onFinish:()=>{R.success?d({type:"success"}):d({type:"closeScreen"})},payload:R.rewards})},[d,R]),w=React$2.useCallback(()=>{if(a.find(P=>P===l.uid)){let P;t?(P=o.resolvers.rights.find(O=>O.uidObject===l.uid),P||(P=o.resolvers.rights[0])):P=o.resolvers.rights[0],e&&d({type:"consumeItem",payload:{uid:l.uid,targetId:l.uid,name:l.name}}),y({...P,success:!0})}else{let P;n?(P=o.notResolvers.wrongs.find(O=>O.uidObject===l.uid),P||(P=o.notResolvers.wrongs[0])):P=o.notResolvers.wrongs[0],y({...P,success:!1})}},[a,l,t,e,o,d,n]),C=React$2.useCallback(()=>{if(a.find(P=>P===(l==null?void 0:l.uid))){let P;t?P=[...o.resolvers.rights.find(M=>M.uidObject===(l==null?void 0:l.uid)).rewards.filter(M=>M.type==="var")]:P=[...o.resolvers.rights[0].rewards.filter(F=>F.type==="var")],e&&d({type:"consumeItem",payload:{uid:l==null?void 0:l.uid,targetId:l==null?void 0:l.uid,name:l==null?void 0:l.name}}),b({varsPoints:[...P],success:!0})}else{let P;n?P=[...o.notResolvers.wrongs.find(M=>M.uidObject===(l==null?void 0:l.uid)).rewards.filter(M=>M.type==="var")]:P=[...o.notResolvers.wrongs[0].rewards.filter(F=>F.type==="var")],b({varsPoints:[...P],success:!1})}},[e,d,o.notResolvers.wrongs,o.resolvers.rights,n,t,l==null?void 0:l.name,l==null?void 0:l.uid,a]),k=React$2.useCallback(()=>{g(!1),d({type:"addPoints",complex:!0,finish:v==null?void 0:v.success,onFinish:()=>{v!=null&&v.success?d({type:"success"}):d({type:"closeScreen"})},payload:v!=null&&v.varsPoints?v==null?void 0:v.varsPoints:[]})},[d,v==null?void 0:v.success,v==null?void 0:v.varsPoints]);return React$2.useEffect(()=>{l?p?C():w():d({type:"closeScreen"})},[w,C,d,l,p]),React$2.useEffect(()=>{v!=null&&v.success&&g(!0)},[v]),E?jsxRuntimeExports.jsx(PseudoNoEvaluationEvent,{onPass:k}):R?jsxRuntimeExports.jsx(FeedbackComponent$1,{text:R.desc,success:R.success,playSound:S,hasTimeout:!R.desc,delay:2e3,translate:T,keyboardControl:u,functionOnClose:_}):null}function MatchItem({item:l,viewMode:e}){var n,t;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[e==="text"&&jsxRuntimeExports.jsx("div",{className:"match-item-text",children:HTMLReactParser$1(l==null?void 0:l.content)}),e==="card"&&jsxRuntimeExports.jsx("div",{className:"match-item-image",children:jsxRuntimeExports.jsxs("figure",{children:[((n=l==null?void 0:l.img)==null?void 0:n.url)&&jsxRuntimeExports.jsx("img",{src:(t=l==null?void 0:l.img)==null?void 0:t.url,alt:l==null?void 0:l.imgName}),(l==null?void 0:l.content)&&jsxRuntimeExports.jsx("figcaption",{children:HTMLReactParser$1(l==null?void 0:l.content)})]})})]})}function CountDownDialog({translate:l,onClose:e,buttonLabel:n}){return jsxRuntimeExports.jsx("div",{className:"timer-dialog",children:jsxRuntimeExports.jsxs("div",{className:"timer-dialog__container",children:[jsxRuntimeExports.jsx("div",{className:"timer-dialog__title",children:l("storylines.misc.ready")}),jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:e,children:jsxRuntimeExports.jsx("span",{children:l(`${n}`)})})]})})}function CountdownTimer({initialSeconds:l=10,isPaused:e,shouldStart:n,shouldReset:t,onTimeOver:a}){const[o,d]=React$2.useState(l),[h,f]=React$2.useState(!1),u=React$2.useRef();React$2.useEffect(()=>{t&&(d(l),f(!1))},[t,l]),React$2.useEffect(()=>{e&&f(!1)},[e]),React$2.useEffect(()=>{n&&f(!0)},[n]),React$2.useEffect(()=>(h&&o>0?u.current=setInterval(()=>{d(S=>S-1),o===1&&a()},1e3):o===0&&(clearInterval(u.current),f(!1)),()=>clearInterval(u.current)),[h,a,o]);const p=S=>{const R=Math.floor(S/60),y=S%60,E=String(R).padStart(2,"0"),g=String(y).padStart(2,"0");return`${E}:${g}`};return jsxRuntimeExports.jsx("div",{className:`count-down ${o<10&&"count-down--finalseconds"}`,children:jsxRuntimeExports.jsx("div",{children:p(o)})})}function MatchPuzzleComponent({emitEvent:l,soundActions:e=[()=>{},()=>{}],getEvent:n,info:t,specificFeedbacks:a,setResolveAction:o,nodeId:d,viewMode:h,title:f,sources:u,destinations:p,correctPairings:S,timer:R=0,keyboardControl:y}){const E=Ae=>n({type:"translate",payload:Ae}),g=`match-puzzle_${d}`,[v,b]=React$2.useState([]),[T,_]=React$2.useState(null),[w,C]=React$2.useState(!1),[k,D]=React$2.useState(!1),[P,O]=React$2.useState(""),[F,M]=React$2.useState(!1),[I,$]=React$2.useState([]),[B]=e;useEkho({soundActions:e});const X=Ae=>{B("click-ui"),_(Ae.id)},re=Ae=>{const Pe={[T]:Ae};return S.some(Ue=>{const Ve=JSON.stringify(Ue),Je=JSON.stringify(Pe);return Ve===Je})},ae=(Ae,Pe)=>{const Ue=new Map(Ae.map(Ve=>[Ve.id,{...Ve}]));return Pe.forEach(Ve=>{Ue.has(Ve.id)?Ue.get(Ve.id).points+=Ve.points:Ue.set(Ve.id,{...Ve})}),Array.from(Ue.values())},te=Ae=>{var Pe,Ue;if(B("click-ui"),re(Ae.id)){const Ve=[...v,{[T]:Ae.id}];if(b(Ve),a.specificCorrectFeedbacks){const Je=a==null?void 0:a.correctFeedbacks.find(mt=>mt.id===`${T}-${Ae.id}`),xt=ae(I,Je.rewards);$([...xt]),K(Ve)&&(lt(),M(!0)),Je.desc&&(O(Je==null?void 0:Je.desc),D(!0),C(!0),lt());const nt=K(Ve);!Je.desc&&nt&&ne(xt)}else if(K(Ve)&&(lt(),M(!0)),K(Ve)){D(!0),t.solution.right.desc&&(lt(),O(t.solution.right.desc)),C(!0),M(!0);const xt=ae(I,t.solution.right.rewards);$([...xt]),t.solution.right.desc===""&&setTimeout(()=>{ne(xt)},3e3)}_(null)}else{const Ve=ae(I,t.solution.wrong.rewards);$([...Ve]),document.querySelector(`#${Ae.id}`).classList.add("match-button--error"),document.querySelector(`#${T}`).classList.add("match-button--error"),setTimeout(()=>{document.querySelector(`#${Ae.id}`).classList.remove("match-button--error"),document.querySelector(`#${T}`).classList.remove("match-button--error"),_(null)},1e3),(Ue=(Pe=t.solution)==null?void 0:Pe.wrong)!=null&&Ue.desc&&(O(t.solution.wrong.desc),C(!0),lt())}},K=Ae=>{if(S.length!==Ae.length)return!1;const Pe=new Set(S.map(Ve=>JSON.stringify(Ve))),Ue=new Set(Ae.map(Ve=>JSON.stringify(Ve)));for(const Ve of Ue)if(!Pe.has(Ve))return!1;return!0},ne=Ae=>{B("score");const Pe=Ae?[...Ae]:[...I];l({type:"addPoints",complex:!0,finish:!0,payload:Pe}),l({type:"passPuzzle"})},ce=()=>{C(!1),D(!1),O(""),ie&&(_t(),V(!0)),!ie&&!F&&Qe(),F&&ne()},me=React$2.useMemo(()=>Object.assign({},...v),[v]),J=(Ae,Pe)=>me[Ae]===Pe;React$2.useEffect(()=>{o(()=>{B("score"),lt(),D(!0),O(t.solution.right.desc);const Ae=[...I,...t.resolve.rewards],Pe=[...S];b(Pe),setTimeout(()=>{D(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:g,rewards:Ae,finish:!0}})},5e3)})},[I,S,l,t.resolve.rewards,t.solution.right.desc,B,g,o]);const H=(Ae,Pe)=>v.findIndex(Ue=>{const Ve=Object.keys(Ue)[0],Je=Object.values(Ue)[0];return Ve===Ae&&Je===Pe}),[W,V]=React$2.useState(!0),[z,Y]=React$2.useState("storylines.misc.start"),[ie,le]=React$2.useState(!1),fe=()=>{Y("storylines.misc.retry"),V(!1),le(!1),Qe()},[de,ve]=React$2.useState(!1),[Re,Te]=React$2.useState(!1),[Oe,Fe]=React$2.useState(!1),Ke=()=>{let Ae=ae(I,t.timerFeedback.rewards);if(a.specificCorrectFeedbacks){const Pe=new Map(Ae.map(Ue=>[Ue.id,{...Ue}]));v.forEach(Ue=>{const Ve=Object.keys(Ue)[0],Je=Ue[Ve],xt=a.correctFeedbacks.find(nt=>nt.id===`${Ve}-${Je}`);xt!=null&&xt.rewards&&xt.rewards.forEach(nt=>{if(Pe.has(nt.id)){const mt=Pe.get(nt.id);mt.points-=nt.points,Pe.set(nt.id,mt)}})}),Ae=Array.from(Pe.values())}$(Ae),b([]),le(!0),O(t.timerFeedback.desc),C(!0)},lt=()=>{ve(!0),Te(!1),Fe(!1)},Qe=()=>{ve(!1),Te(!0),Fe(!1)},_t=()=>{ve(!1),Te(!1),Fe(!0)},$e=React$2.useCallback(()=>{const Ae=document.querySelector('button[id^="source-item"]'),Pe=document.querySelector('button[id^="destination-item"]'),Ue=Ae.getBoundingClientRect().right,Je=Pe.getBoundingClientRect().left+6-Ue;u.items.forEach((xt,nt)=>{if(xt.matchDestinationId!==void 0&&xt.matchDestinationId!==null){const mt=document.querySelector(`#${xt.id}`),Ge=document.querySelector(`#${xt.matchDestinationId}`),ft=mt.getBoundingClientRect().top,Be=Ge.getBoundingClientRect().top,Ye=Be>ft,ke=Math.abs(Be-ft),De=Math.sqrt(Je*Je+ke*ke),_e=mt.querySelector(".match-line__hipotenuse");_e.style.setProperty("width",`${De}px`);const Ne=Math.atan(ke/Je),Xe=Ye?Ne*(180/Math.PI):-Ne*(180/Math.PI);_e.style.setProperty("transform",`rotate(${Xe}deg)`)}})},[u.items]);return React$2.useEffect(()=>($e(),window.addEventListener("resize",$e),()=>{window.removeEventListener("resize",$e)}),[$e]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"match",children:[(f||R>0)&&jsxRuntimeExports.jsxs("header",{className:"match__header",children:[f&&jsxRuntimeExports.jsx("div",{className:"match__title","data-testid":"match__title",children:f}),R>0&&jsxRuntimeExports.jsx(CountdownTimer,{initialSeconds:R,isPaused:de,shouldStart:Re,shouldReset:Oe,onTimeOver:Ke})]}),jsxRuntimeExports.jsx("div",{className:"match__columns",children:jsxRuntimeExports.jsxs("div",{className:"match__columns-scroll",children:[jsxRuntimeExports.jsxs("div",{className:"match__column-wrap",children:[u.title&&jsxRuntimeExports.jsx("div",{className:"match__subtitle",children:u.title}),jsxRuntimeExports.jsx("div",{className:"match__column",children:u.items.map((Ae,Pe)=>jsxRuntimeExports.jsxs("button",{id:Ae.id,"data-testid":Ae.id,className:["unset-button match-button",T===Ae.id&&"match-button--marked",J(Ae.id,Ae.matchDestinationId)&&"match-button--success",H(Ae.id,Ae.matchDestinationId)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${H(Ae.id,Ae.matchDestinationId)+1})`},disabled:J(Ae.id,Ae.matchDestinationId),type:"button",onClick:()=>X(Ae),children:[jsxRuntimeExports.jsx(MatchItem,{item:Ae,viewMode:h}),jsxRuntimeExports.jsx("div",{className:"icon-check-circle-black color--success"}),jsxRuntimeExports.jsx("div",{className:"icon-error-circle-black color--error"}),jsxRuntimeExports.jsx("div",{className:"match-line__hipotenuse"})]},Ae.id))})]}),jsxRuntimeExports.jsxs("div",{className:"match__column-wrap",children:[p.title&&jsxRuntimeExports.jsx("div",{className:"match__subtitle",children:p.title}),jsxRuntimeExports.jsx("div",{className:"match__column",children:p.items.map((Ae,Pe)=>jsxRuntimeExports.jsxs("button",{id:Ae.id,"data-testid":Ae.id,className:["unset-button match-button",T===Ae.id&&"match-button--marked",J(Ae.matchSourceId,Ae.id)&&"match-button--success",H(Ae.matchSourceId,Ae.id)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${H(Ae.matchSourceId,Ae.id)+1})`},disabled:J(Ae.matchSourceId,Ae.id)||T===null&&!J(Ae.matchSourceId,Ae.id),type:"button",onClick:()=>te(Ae),children:[jsxRuntimeExports.jsx(MatchItem,{item:Ae,viewMode:h}),jsxRuntimeExports.jsx("div",{className:"icon-check-circle-black color--success"}),jsxRuntimeExports.jsx("div",{className:"icon-error-circle-black color--error"})]},Ae.id))})]})]})})]}),R>0&&W&&jsxRuntimeExports.jsx(CountDownDialog,{buttonLabel:z,translate:E,onClose:fe}),w&&jsxRuntimeExports.jsx(FeedbackComponent$1,{success:k,text:P,hasTimeout:!P,translate:E,timeExpired:ie,functionOnClose:ce,keyboardControl:y})]})}exports.AnimationComponent=MultipleAnimation;exports.AutoEvaluationComponent=AutoEvaluation;exports.CardsSelectorPuzzleComponent=CardsSelectorPuzzleComponent;exports.CartelComponent=CartelComponent;exports.ChainedImageClickPuzzleComponent=ChainedImageClickPuzzleComponent;exports.ChangeCamera=ChangeCamera;exports.ComicComponent=ComicComponent;exports.ConversationalComponent=ConversationalComponent;exports.ConversationalProComponent=ConversationalProComponent;exports.CrackerPuzzleComponent=CrackerPuzzleComponent;exports.DecisionComponent=DecisionComponent;exports.DialogComponent=DialogComponent;exports.DragItemPuzzleComponent=DragItemPuzzleComponent;exports.DragToSceneComponent=DragToSceneComponent;exports.FrameImageClickComponent=FrameImageClickComponent;exports.HackerPuzzleComponent=HackerPuzzleComponent;exports.HangedPuzzleComponent=HangedPuzzleComponent;exports.ImageClickPuzzleComponent=ImageClickPuzzleComponent;exports.ImageComponent=ImageComponent;exports.InventoryItem=InventoryItem;exports.KeyboardPuzzleComponent=KeyboardPuzzleComponent;exports.LecturesComponent=LecturesComponent;exports.LoginPuzzleComponent=LoginPuzzleComponent;exports.MatchPuzzleComponent=MatchPuzzleComponent;exports.NoticeComponent=NoticeComponent;exports.PatternComponent=PatternComponent;exports.PdfComponent=PdfComponent;exports.PdfVisor=PdfVisor;exports.ReferralComponent=ReferralComponent;exports.SurveyComponent=SurveyComponent;exports.TerminalPuzzleComponent=TerminalPuzzleComponent;exports.TestComponent=TestComponent;exports.TextClickPuzzleComponent=TextClickPuzzleComponent;exports.UrlComponent=UrlComponent;exports.VideoComponent=VideoComponent;exports.VideoVisor=VideoVisor;exports.WebBuilderPuzzleComponent=WebBuilderPuzzleComponent;exports.WriterPuzzleComponent=WriterPuzzleComponent;
275
275
  //# sourceMappingURL=arcade-components.cjs.map