@gamelearn/arcade-components 3.45.1 → 3.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -331,5 +331,5 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
331
331
  ${u.thinkful?"speech-bubble--italic":""}
332
332
  `,children:[P.jsxs("div",{className:`speech-bubble__header ${u.thinkful?"speech-bubble__header--thinking":""}`,children:[u.thinkful?P.jsx("div",{className:"thinking-icon-wrap",children:P.jsx("div",{className:"icon-bubble-thinkful-black"})}):null,u.avatar?P.jsx("div",{className:"speech-bubble__avatar",children:P.jsx("img",{src:r(),alt:u.name})}):null,u.voiceOver?P.jsx("div",{className:"speech-bubble__avatar",children:P.jsx("div",{className:"icon-narrator"})}):null,P.jsxs("div",{className:"speech-bubble__name",children:[P.jsx("span",{children:u.name}),u.thinkful?P.jsxs("span",{children:["[ ",t("emotion.thinking")," ]"]}):null]})]}),u.text?P.jsx("div",{className:"speech-bubble__text",children:bi(u.text)}):null]})}const ent=G.forwardRef(tnt);function nnt({currentMessage:u,translate:t}){const e=document.querySelector(".screens--container");return P.jsx("group",{children:P.jsx(Va.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",onOcclude:()=>null,zIndexRange:[5,5],portal:e?{current:e}:void 0,style:{width:"100%",height:"100%",position:"static"},calculatePosition:()=>[0,0],children:P.jsx(ent,{translate:t,message:u})})})}const wo={},kM=new AH.GLTFLoader,IM=.25,int=.01;function ant(u){const t=v0.useThree(m=>m.scene),e=G.useRef({root:null,howl:null});v0.useFrame((m,_)=>{var y;const g=e.current.root,S=(y=e.current.howl)==null?void 0:y.node;if(g&&S){const x=g.animator;if(!x)return;const T=x.getAction("tts");if(!T)return;S.volume>int?Va.ThreeUtils.setWeight(T,1):Va.ThreeUtils.setWeight(T,0)}});const n=G.useMemo(()=>{var _;const m={};for(const g of u)if(g.slots)for(const S of g.slots){if(!S.uid)continue;const y=(_=S.character)==null?void 0:_.resource.animations;y&&(m[S.uid]||(m[S.uid]=Object.keys(y).reduce((x,T)=>(x[T]=y[T].url,x),{})))}return m},[u]),i=G.useMemo(()=>{const m=new Set;for(const _ of u)if(_.slots)for(const g of _.slots)g.uid&&m.add(g.uid);return Array.from(m)},[u]),r=async(m,_)=>{if(m&&!wo[m]){const{animations:g}=await kM.loadAsync(m);g[0].name=_,wo[m]=g[0]}},o=async(m,_)=>{const g=n[m],S=g.talking,y=g["talking-short"];await Promise.all([r(y,"talking-short"),r(S,"talking")]);const x=gg(m,t);if(!x)return!1;const T=x.animator;if(!T)return!1;const A=g["talking-short"]||g.talking,E=wo[A],C=OH(E),R=T.register("tts",C,x);R.setEffectiveTimeScale(2),_?e.current={root:x,howl:_}:Va.ThreeUtils.setWeight(R,1)},l=async m=>{const _=gg(m,t);if(!_)return!1;const g=_.animator;if(!g)return!1;const S=g.getAction("tts");S&&Va.ThreeUtils.setWeight(S,0),e.current={root:null,howl:null}},c=()=>{i.forEach(m=>{const _=t.getObjectByProperty("uid",m);if(_){const g=_.animator;if(!g)return;const S=g.getAction("tts");S&&Va.ThreeUtils.setWeight(S,0),delete _.userData._active,f(m,"idle")}})},d=async(m,_,g=!1)=>{const S=gg(m,t);if(wo[m]||(wo[m]={}),!S)return new Promise(x=>x(!1));const y=S.animator;if(!y)return!1;if(_){const x=_;let T=wo[_];if(!T){const{animations:A}=await kM.loadAsync(_);T=wo[_]=A[0]}if(!S.userData._active||S.userData._active!==x){S.userData._active=x;const A=y.register(x,iP(T),S);return new Promise(E=>{g&&A.reset(),y.mix(x,IM,g).then(C=>E(C?A:!1))})}}return new Promise(x=>x(!1))},f=async(m,_)=>{const g=gg(m,t);if(wo[m]||(wo[m]={}),!g)return new Promise(y=>y(!1));const S=g.animator;if(!S)return!1;if(_==="idle")return S.mix("idle",IM),S.getAction("idle");{const y=n[m],x=_.split("_")[0],T=y[x];if(T){const A=T;let E=wo[A];if(!E){let C=wo[T];if(!C){const{animations:R}=await kM.loadAsync(T);C=wo[T]=R[0],C.name=x}E=C,wo[A]=E}if(!g.userData._active||g.userData._active!==_){g.userData._active=_;const C=S.register(_,iP(E),g);return new Promise(R=>{S.mix(_,IM).then(N=>R(N?C:!1))})}}}return new Promise(y=>y(!1))};return{startEmotionUrl:d,startEmotion:f,startSpeech:o,stopSpeech:l,resetActives:c}}const Rz=75,_R=1400,rnt=2,QN=new Ma.Raycaster,og=new Ma.Object3D,snt=70;QN.firstHitOnly=!0;function ont({keyboardControl:u,emitEvent:t,getEvent:e,lines:n,actors:i,edges:r,soundActions:o,zoomInActor:l,autoPlay:c,autoEnd:d,pause:f,progress:m}){var _e;const _=n.length-1<=(m==null?void 0:m.line)?n.length-1:(m==null?void 0:m.line)||0,[g,S]=G.useState(_),[y,x]=G.useState(!!c),[T,A]=G.useState(!1),[E,C]=G.useState(!1),R=v0.useThree(Pt=>Pt.scene),N=v0.useThree(Pt=>Pt.camera),{start:M,stop:O}=Tw(),B=G.useRef([]),L=G.useMemo(()=>N.clone(),[]),k=G.useRef({pos:[0,0,0],child:null}),I=n[g],H=n[g-1],W=G.useRef(!1),Z=!!r,{voiceOver:X,decision:tt}=I||{},nt=G.useRef({}),Q=(_e=I==null?void 0:I.slots)==null?void 0:_e.find(Pt=>Pt.talking),$=G.useRef(!1),{startEmotion:rt,startEmotionUrl:ut,resetActives:st,stopSpeech:ot,startSpeech:ht}=ant(n);G.useRef();const vt=Object.keys((I==null?void 0:I.audio)||{}).length,it=Object.keys((I==null?void 0:I.voice)||{}).length,dt=X||(I==null?void 0:I.type)==="conversationalNarration",lt=tt||(I==null?void 0:I.type)==="conversationalDecision",xt=(I==null?void 0:I.type)==="conversationalCamera",yt=y&&!lt&&!xt,[pt,bt]=G.useState({text:"",name:"",inScene:!1,thinkful:!1,voiceOver:!1,avatar:"",show:!1}),Tt=G.useMemo(()=>n.reduce((Pt,Yt)=>(Yt.slots&&Yt.slots.filter(we=>we.uid).forEach(we=>{Pt.includes(we.uid)||Pt.push(we.uid)}),Pt),[]),[n]),Ct=G.useCallback(Pt=>e({type:"translate",payload:Pt}),[e]),[kt,It]=G.useState([]),Jt=G.useMemo(()=>kt[kt.length-1],[kt]),ie=G.useCallback(()=>{const Pt=r.find(Zt=>Zt.fromId===Jt)||r.find(Zt=>Zt.toId===Jt),Yt=n.find(Zt=>Zt.id===(Pt==null?void 0:Pt.fromId));return!Jt&&(m==null?void 0:m.line)>=0?{decision:!0}:Yt},[r,n,Jt]),Ae=G.useCallback(()=>{if(Z){const Pt=n.filter(Yt=>!r.find(Zt=>Zt.toId===Yt.id));if(Pt.length){const Yt=Pt[0],Zt=n.indexOf(Yt);if(Zt>=0)return Zt}}return-1},[Z,n,r]),Ze=G.useCallback(()=>{if(Z){const Yt=ie();return Yt==null?void 0:Yt.decision}const Pt=n[g-1]?n[g-1]:{};return g>0&&(Pt==null?void 0:Pt.decision)},[I,Z,n,Jt,r]),Re=G.useCallback(()=>{if(Z){const Yt=ie();return(Yt==null?void 0:Yt.type)==="conversationalCamera"}const Pt=n[g-1]?n[g-1]:{};return g>0&&(Pt==null?void 0:Pt.type)==="conversationalCamera"},[I,Z,n,Jt,r]),Ee=G.useCallback(Pt=>{var Zt,we;const Yt=i.find(ce=>(ce==null?void 0:ce.uid)===(Pt==null?void 0:Pt.uid)?ce:"");return((we=(Zt=Pt==null?void 0:Pt.character)==null?void 0:Zt.resource)==null?void 0:we.url)||(Yt==null?void 0:Yt.completeUrl)||""},[i]),xn=(Pt=()=>{})=>{if($.current)$.current&&($.current=!1);else{N.updateProjectionMatrix(),N.updateMatrixWorld(!0);const Yt=k.current.child?k.current.pos:L.position.toArray();if(og.position.fromArray(Yt),k.current.parent){og.quaternion.equals(N.quaternion)||og.applyQuaternion(N.quaternion);const Zt=k.current.isLeft?-1:1,we=rnt*Zt;og.translateX(-10*Zt+we),og.translateY(-2),og.translateZ(30)}WU.to(N.position,{duration:.9,ease:"power3.easeInOut",onStart:()=>{$.current=!0},onUpdate:()=>{B.current.length&&B.current.forEach(Zt=>{const{object:we}=Zt;we.material.visible=!0})},onComplete:()=>{Pt(),QN.set(N.getWorldPosition(new Ma.Vector3(0,0,0)),N.getWorldDirection(new Ma.Vector3));const Zt=QN.intersectObjects(R.children,!0);B.current=Zt.filter(we=>we.distance<10),B.current.length&&B.current.forEach(we=>{const{object:ce}=we;ce.material.side=0}),$.current=!1,W.current&&t({type:"success"}),k.current.child||N.copy(L)},...og.position})}},hn=G.useCallback(()=>{k.current.child=null,k.current.parent=null,l&&xn()},[l]),Ft=(Pt,Yt,Zt,we=!1)=>{const ce=Yt.includes("seated");let fn=Yt;if(Yt==="neutral"&&!Zt&&(fn="idle"),we&&!ce&&(fn+="-seated"),Zt){const xi=DH.includes(Zt.animationId);ut(Pt,Zt.url,xi).then($n=>{$n&&xi&&rt(Pt,"idle")})}else rt(Pt,fn)},ne=Pt=>{if(!(Q!=null&&Q.uid)||!(Q!=null&&Q.emotion)||W.current)return;const{emotion:Yt,uid:Zt,animation:we}=Q;gg(Zt,R)&&ht(Zt,Pt)},he=()=>{!(Q!=null&&Q.uid)||W.current||ot(Q==null?void 0:Q.uid)},Lt=G.useCallback(()=>{W.current=!0,bt({show:!1}),hn(),st(),l||t({type:"success"})},[N,t,hn,l]);G.useEffect(()=>()=>{nt.current={},st()},[]);const qt=Pt=>{bt({show:!1}),S(Pt),t({type:"notifyProgress",payload:{line:Pt}})},te=G.useCallback((Pt=!0)=>{const Yt=Pt?["fromId","toId"]:["toId","fromId"],Zt=r.filter(fn=>fn[Yt[0]]===I.id),we=Zt.length===1?Zt[0]:Zt.find(fn=>fn[Yt[1]]===Jt);if(!(we!=null&&we[Yt[0]])){Lt();return}Pt||It(kt.slice(0,kt.length-1));const ce=n.findIndex(fn=>fn.id===we[Yt[1]]);ce>=0?qt(ce):Lt()},[I==null?void 0:I.id,t,r,Lt,n]),Ie=G.useCallback((Pt,Yt)=>{const Zt=[3,2,1][Pt.id],ce=r.filter(xi=>xi.fromId===(I==null?void 0:I.id)).find(xi=>parseInt(xi.fromPointIndex)===Zt),fn=n.findIndex(xi=>xi.id===(ce==null?void 0:ce.toId));fn>=0?(ce==null?void 0:ce.fromId)===(ce==null?void 0:ce.toId)?Yt():qt(fn):Lt()},[I==null?void 0:I.id,r,Lt,n]),Je=G.useCallback(()=>{if(nt.current={...Q},C(!1),he(),Z)te(!1);else if(!Ze()){const Pt=g-1;bt({show:!1}),S(Pt),t({type:"notifyProgress",payload:{line:Pt}})}},[te,t,Z,H,g,Q]),Gt=G.useCallback(Pt=>{if(Z){if(Pt){const Yt=[3,2,1][Pt.id],we=r.filter(ce=>ce.fromId===I.id).find(ce=>parseInt(ce.fromPointIndex)===Yt);if(we){const ce=n.findIndex(fn=>fn.id===we.toId);ce>=0&&t({type:"notifyProgress",payload:{line:ce}})}else t({type:"saveNode"})}}else if(g<n.length-1){const Yt=g+1;t({type:"notifyProgress",payload:{line:Yt}})}else t({type:"saveNode"})},[r,g,n,t,I==null?void 0:I.id,Z]),ee=G.useCallback((Pt,Yt)=>{if(nt.current={...Q},C(!1),he(),Z)It([...kt,I.id]),Pt?Ie(Pt,Yt):te();else if(g<n.length-1){const Zt=g+1;qt(Zt)}else(d||lt||xt)&&Lt()},[t,I==null?void 0:I.id,Z,lt,xt,g,n.length,Ie,te,Lt,Q]),pe=()=>{x(!1),Je()},En=()=>Z?I&&I.type!=="conversationalDecision"&&!r.find(Pt=>Pt.fromId===I.id):g===n.length-1,ue=()=>{En()?Lt():(x(!1),ee())};G.useEffect(()=>{if(Z&&!T){const Pt=m==null?void 0:m.line;if(Pt>=0){A(!0),S(Pt);return}const Yt=Ae();Yt>=0&&(A(!0),S(Yt))}},[r,Z,n,T,Ae]);const me=Pt=>{if(nt.current.uid===Pt.uid||k.current.parent===Pt)return;const Yt=new Ma.Object3D,Zt=Pt.getObjectByName("Head_M");Zt.updateMatrixWorld(!0),Yt.applyMatrix4(Zt.matrixWorld),Yt.applyQuaternion(N.quaternion);const we=l?2.5:2,ce=l?1.2:1.5;Yt.translateY(we),Yt.translateX(ce);const fn=new Ma.Vector3;fn.setFromMatrixPosition(Zt.matrixWorld);const $n=fn.project(N).x<0;k.current={pos:Yt.position.toArray(),child:Zt,parent:Pt,isLeft:$n}},Dn=Pt=>{t({type:"resetZIndexUIContainer",payload:Pt})};G.useEffect(()=>{var Pt;if(dt)hn(),bt({text:I==null?void 0:I.text,name:(I==null?void 0:I.alias)||(I==null?void 0:I.name)||`[ ${Ct("storylines.misc.voiceOver")} ]`,inScene:!1,voiceOver:!0,thinkful:!1,top:!1,avatar:Ee(Q),show:!0});else if(!W.current&&!lt&&!xt){const Yt=I==null?void 0:I.slots.filter(ce=>ce.uid&&!ce.talking),Zt=[...Yt.map(ce=>ce.uid)||[],Q==null?void 0:Q.uid];if(Tt.filter(ce=>!Zt.includes(ce)).forEach(ce=>{rt(ce,"idle")}),Yt.forEach(ce=>{const fn=gg(ce.uid,R);if(fn){const{isSeated:xi}=fn;Ft(ce.uid,ce.emotion,ce.animation,xi)}}),Q){const ce=gg(Q.uid,R),fn=i.find(xi=>xi.uid===Q.uid);ce&&!W.current?setTimeout(()=>{var xi,$n;if(Q.uid===ce.uid){me(ce);const{isSeated:is,userData:Ts}=ce,{emotion:io,animation:ac}=Q;!((xi=Ts._active)!=null&&xi.includes("talking"))&&!(($n=Ts._active)!=null&&$n.includes(io))&&Ft(Q.uid,io,ac,is);const il=()=>{var rc;bt({text:Q.text,name:Q.alias||((rc=Q.character)==null?void 0:rc.name),inScene:!0,thinkful:Q.emotion.includes("think"),avatar:Ee(Q),show:!0})};l?($.current=!1,xn(il)):il()}},150):(hn(),bt({text:Q.text,name:Q.alias||((Pt=Q.character)==null?void 0:Pt.name)||(fn==null?void 0:fn.name),left:!1,top:Q.text.length>snt,inScene:!1,thinkful:Q.emotion.includes("think"),avatar:Ee(Q),show:!0}))}else hn(),bt({show:!0})}},[i,I,l,R,Ct,Ee,hn,lt,dt,Tt]);const jn=Hw(pt==null?void 0:pt.text),[Si]=ry({audioType:I==null?void 0:I.audioType,volume:I==null?void 0:I.audioVolume,voice:I==null?void 0:I.voice,started:pt.show,text:jn,audio:I==null?void 0:I.audio,soundActions:o,getEvent:e,pauseTTS:f,onStart:(Pt,Yt)=>{var Zt;(Zt=Q==null?void 0:Q.emotion)!=null&&Zt.includes("think")||ne(Yt)},onError:()=>{C(!0)},onFinish:()=>{he(),yt&&!f&&ee()}});G.useEffect(()=>(Si(),()=>{Si()}),[g,Si]),G.useEffect(()=>{var Pt;if(((I==null?void 0:I.audioType)==="none"||E)&&(pt!=null&&pt.show)&&!(Q!=null&&Q.emotion.includes("think"))){ne();const Yt=Rz*(((Pt=pt==null?void 0:pt.text)==null?void 0:Pt.length)||0);setTimeout(()=>{he()},Yt<_R?_R:Yt)}},[E,I==null?void 0:I.audioType,he,ne,Q==null?void 0:Q.emotion,pt]),G.useEffect(()=>{var Pt;if(yt&&pt.show&&((I==null?void 0:I.audioType)==="none"||E)&&!f){const Yt=Rz*(((Pt=pt==null?void 0:pt.text)==null?void 0:Pt.length)||0);(!En()||En()&&d)&&M(ee,Yt<_R?_R:Yt)}return()=>{O()}},[pt,ee,M,d,O,I==null?void 0:I.audioType,yt,vt,it,E]);const zt=G.useMemo(()=>Ae()>=0&&kt.length===0&&Z||!Z&&g===0||Ze()||Re(),[g,Ze,Re,Ae,kt]),Wt=u({disabled:lt||!pt.show,repeat:!1,forward:ue,rewind:zt?null:pe});G.useEffect(()=>Wt(),[Wt]);const fe=document.querySelector(".screens--container");if(xt)return P.jsx(g9,{...I,emitEvent:t,success:!1,onFinish:ee},`change-camera-${g}`);if(lt){const Pt=I.id?n.filter(Zt=>Zt.decision).findIndex(Zt=>Zt.id===I.id)+1:n.filter(Zt=>Zt.decision).findIndex(Zt=>Zt===I)+1,Yt={...I.payload,decisionNumber:Pt,inheritProps:{slots:[],disableBackground:!0},required:!Z,branched:Z,onAddPoints:Gt,onFinish:ee,emitEvent:t,getEvent:e,pause:f,soundActions:o,keyboardControl:u};return P.jsx(vN,{onMount:()=>{hn(),Dn(!0)},onUnMount:()=>{$.current=!1,Dn(!1)},children:P.jsx(M9,{inScene:!0,...Yt})})}return P.jsxs(P.Fragment,{children:[pt.text?P.jsx(nnt,{translate:Ct,currentMessage:pt}):null,P.jsx(Va.HtmlPro,{wrapperClass:"htmlpro-wrap-100-h",style:{width:"100%",height:"100%",position:"static"},portal:fe?{current:fe}:void 0,zIndexRange:[6,6],onOcclude:()=>{},calculatePosition:()=>[0,0],children:P.jsxs("div",{dir:Pe()?"rtl":"ltr",className:"dialog-component-controls",children:[P.jsx("button",{type:"button",onClick:pe,disabled:zt||!pt.show,className:`gat--btn__round ${zt||!pt.show?"disabled":""}`,"aria-label":Pe()?Ct("storylines.misc.forward"):Ct("storylines.misc.rewind"),children:P.jsx("span",{className:Pe()?"icon-next":"icon-back"})}),P.jsx("button",{type:"button",onClick:ue,disabled:!pt.show,className:`gat--btn__round
333
333
  ${pt.show?"":"disabled"}
334
- ${y&&En()?"glowing-animation":""}`,"aria-label":Pe()?Ct("storylines.misc.rewind"):Ct("storylines.misc.forward"),children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})})]})})]})}const lnt=Va.ProgressManager.request("AssetLoader").cache,unt=new Va.AssetLoader(void 0,lnt);function cnt({animation:u,loopTimes:t,onAnimationFinish:e,onAnimationSave:n,resource:i,makeDefault:r}){const[o,l]=G.useState(!1),c=v0.useThree(f=>f.scene),d=G.useRef(0);return G.useEffect(()=>{l(!1)},[i.uid,u==null?void 0:u.url]),G.useEffect(()=>{if(!o){const f=c.getObjectByProperty("uid",i.uid);if(f&&u&&u.url&&f.skeletonId===(u==null?void 0:u.skeletonId))if(r)n({uid:i.uid,animation:u==null?void 0:u.id,index:f.index}),e();else{const m=f.animator;m||console.error("[Animation]: Current Object ",i.uid," does not have an animator.");const _=()=>{const g=m==null?void 0:m.getAction(u.url);g.setLoop(Ma.LoopRepeat,1/0),g.reset();function S(){d.current+=1,d.current>=t&&y()}function y(){m.mix("idle"),e(),m.removeEventListener("loop",S)}m.mix(u==null?void 0:u.url).then(x=>{x&&(d.current=1,d.current>=t?y():m.addEventListener("loop",S))}),l(!0)};m!=null&&m.getAction(u==null?void 0:u.url)?(m.setTime(0),_()):unt.load(u==null?void 0:u.url,g=>{m.register(u==null?void 0:u.url,g.animations[0]),m.setTime(0),_()},void 0,g=>{console.error(`Asset loader failed with: ${u.url}`,g),e()})}else e()}},[c,u==null?void 0:u.url,t,o,i.uid,r,u,i,e,n]),null}function dnt({animations:u=[],enableInteraction:t,emitEvent:e}){const n=u.length,i=G.useRef(0),r=()=>{i.current+=1,i.current>=n&&t&&e({type:"success"})},o=l=>{e({type:"saveAnimation",payload:l})};return G.useEffect(()=>{i.current=0},[u]),G.useEffect(()=>{t||e({type:"success"})},[e,t]),u.map(({animation:l,...c},d)=>{var f;return P.jsx(cnt,{animation:l,...c,onAnimationFinish:r,onAnimationSave:o},(l==null?void 0:l.id)||((f=c.resource)==null?void 0:f.uid)||d)})}function hnt({text:u,error:t,handleClick:e}){return P.jsxs("div",{"data-testid":`${t?" pill--error":"pill--ok"}`,className:`email-pill ${t?" email-pill--error":""}`,children:[P.jsx("div",{children:u}),P.jsx("div",{className:"email-pill__delete",children:P.jsx("button",{type:"button",onClick:e,className:"icon-close unset-button","aria-label":"icon click"})})]})}function fnt({handleContinue:u,handleCancel:t,translate:e,text:n}){const[i,r]=G.useState([]),[o,l]=G.useState(0),[c,d]=G.useState(0),f=G.useRef(null),m=(y,x,T)=>{y.stopPropagation(),r(i.filter(A=>A!==i[T])),x.error&&l(o-1),x.isRepeat&&d(c-1)},_=()=>{f.current&&f.current.focus()},g=()=>{[" ",",",";","."].includes(f.current.value)&&(f.current.value="")},S=y=>{const x=f.current.value,T=["Space","Comma","Period","Enter"],A=["Space","Comma","Enter","Tab"];x===""&&(T.includes(y.code)||y.keyCode==="186"||y.key==="Enter"||y.key===" ")?y.preventDefault():f.current.value.length>1&&(A.includes(y.code)||y.type==="blur")&&(y.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(x)?i.find(C=>C.text===x)?(d(c+1),r([...i,{text:x,error:!0,isRepeat:!0}])):r([...i,{text:x}]):(r([...i,{text:x,error:!0}]),l(o+1)),f.current.value="")};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"referrals-piece__body",children:[P.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep1")}),P.jsx("div",{className:"referrals-piece__subtitle",children:n}),P.jsxs("div",{className:"referrals-piece__form",children:[P.jsxs("div",{className:"referrals-piece__instructions",children:[P.jsx("div",{dir:"auto",children:e("puzzles.referrals.inviter.instructions")}),P.jsx("div",{dir:"auto",children:e("puzzles.referrals.inviter.limit")})]}),P.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:_,"aria-labelledby":"list of emails",children:P.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[i&&i.map((y,x)=>P.jsx(hnt,{text:y.text,error:y.error,handleClick:T=>m(T,y,x),emailPillIndex:x},`${i.indexOf(y)}`)),i.length<=9?P.jsxs(P.Fragment,{children:[P.jsx("input",{id:"email",ref:f,className:"referrals-piece__inputemail",onChange:g,onKeyDown:S,onBlur:S,type:"email",autoComplete:"off"}),P.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:P.jsx("span",{children:e("puzzles.referrals.inviter.skipButton")})})]}):null]})}),P.jsxs("div",{dir:Pe()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[P.jsxs("div",{className:"referrals-piece__errormessage",children:[P.jsx("div",{children:c>0?e("puzzles.referrals.inviter.errorEmailRepeat"):null}),P.jsx("div",{children:o>0?e("puzzles.referrals.inviter.errorMessage"):null})]}),P.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[i.length,"/10"]})]})]})]}),P.jsxs("div",{className:"referrals-piece__buttons",children:[P.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:t,children:e("puzzles.referrals.inviter.skipButton")}),P.jsx("button",{className:`gat--btn gat--btn__primary ${c>0||o>0||i.length===0?" disabled":""}`,type:"button",disabled:o>0||i.length===0,onClick:()=>u(i),children:e("puzzles.referrals.inviter.inviteButton")})]})]})}function pnt({handleFinish:u,translate:t,valid:e,invalid:n}){const[i,r]=G.useState(!1),o=()=>{r(!i)},l=e.current===1?"invitationSend":"invitationsSend",c=n===1?"invitationNotSend":"invitationsNotSend";return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[P.jsx("div",{className:"referrals-piece__title",children:t("puzzles.referrals.inviter.titleStep2")}),P.jsxs("ul",{className:"referrals-piece__feedback",children:[e.current!==0&&P.jsxs("li",{children:[P.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),P.jsxs("div",{children:[P.jsx("strong",{children:e.current})," ",t(`puzzles.referrals.inviter.${l}`)]})]}),!!n.current&&P.jsxs("li",{children:[P.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),P.jsxs("div",{children:[P.jsx("strong",{children:n.current})," ",t(`puzzles.referrals.inviter.${c}`)]}),P.jsx("button",{className:"un-button",type:"button",onClick:o,children:t("puzzles.referrals.inviter.whyFail")})]})]}),i?P.jsxs("ul",{className:"referrals-piece__failsreasons",children:[P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons1")}),P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons2")}),P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons3")})]}):null]}),P.jsx("div",{className:"referrals-piece__buttons",children:P.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:u,children:t("puzzles.referrals.inviter.continueButton")})})]})}function mnt({emitEvent:u,getEvent:t,text:e,rewards:n,referrals:i}){const r=g=>t({type:"translate",payload:g}),[o,l]=G.useState("step1"),c=G.useRef(0),d=G.useRef(0),f=async g=>{const S=g.map(x=>x.text),y=await u({type:"sendReferrals",payload:S});c.current=y&&y.data?y.data.valid.length:0,d.current=S.length-c.current,l("step2")};if(!i)return u({type:"success"}),null;const m=()=>{u({type:"success"})},_=()=>{if(c.current){const g=n.map(S=>(S.points*=c.current,S));u({type:"addPoints",complex:!0,finish:!0,payload:g})}else u({type:"success"})};return P.jsx("div",{className:"referrals-piece",children:P.jsxs("div",{className:"referrals-piece__center",children:[o==="step1"&&P.jsx(fnt,{translate:r,handleContinue:f,handleCancel:m,text:e}),o==="step2"&&P.jsx(pnt,{translate:r,handleFinish:_,valid:c,invalid:d})]})})}function gnt({onPass:u}){return G.useEffect(()=>{const t=setTimeout(u,0);return()=>clearTimeout(t)},[u]),null}function vnt({itemResolver:u,consume:t,hasComplexNotResolvers:e,hasComplexResolvers:n,resolverObjects:i,feedback:r,emitEvent:o,getEvent:l,soundActions:c,keyboardControl:d,noEvaluation:f}){const[m]=c,[_,g]=G.useState(!1),[S,y]=G.useState(!1),[x,T]=G.useState(!1),A=M=>l({type:"translate",payload:M}),E=G.useCallback(()=>{o({type:"addPoints",complex:!0,finish:_.success,onFinish:()=>{_.success?o({type:"success"}):o({type:"closeScreen"})},payload:_.rewards})},[o,_]),C=G.useCallback(()=>{if(i.find(O=>O===u.uid)){let O;n?(O=r.resolvers.rights.find(B=>B.uidObject===u.uid),O||(O=r.resolvers.rights[0])):O=r.resolvers.rights[0],t&&o({type:"consumeItem",payload:{uid:u.uid,targetId:u.uid,name:u.name}}),g({...O,success:!0})}else{let O;e?(O=r.notResolvers.wrongs.find(B=>B.uidObject===u.uid),O||(O=r.notResolvers.wrongs[0])):O=r.notResolvers.wrongs[0],g({...O,success:!1})}},[i,u,n,t,r,o,e]),R=G.useCallback(()=>{if(i.find(O=>O===(u==null?void 0:u.uid))){let O;n?O=[...r.resolvers.rights.find(k=>k.uidObject===(u==null?void 0:u.uid)).rewards.filter(k=>k.type==="var")]:O=[...r.resolvers.rights[0].rewards.filter(L=>L.type==="var")],t&&o({type:"consumeItem",payload:{uid:u==null?void 0:u.uid,targetId:u==null?void 0:u.uid,name:u==null?void 0:u.name}}),T({varsPoints:[...O],success:!0})}else{let O;e?O=[...r.notResolvers.wrongs.find(k=>k.uidObject===(u==null?void 0:u.uid)).rewards.filter(k=>k.type==="var")]:O=[...r.notResolvers.wrongs[0].rewards.filter(L=>L.type==="var")],T({varsPoints:[...O],success:!1})}},[t,o,r.notResolvers.wrongs,r.resolvers.rights,e,n,u==null?void 0:u.name,u==null?void 0:u.uid,i]),N=G.useCallback(()=>{o({type:"addPoints",complex:!0,finish:x==null?void 0:x.success,onFinish:()=>{x!=null&&x.success?o({type:"success"}):o({type:"closeScreen"})},payload:x!=null&&x.varsPoints?x==null?void 0:x.varsPoints:[]}),y(!1)},[o,x==null?void 0:x.success,x==null?void 0:x.varsPoints]);return G.useEffect(()=>{u?f?R():C():o({type:"closeScreen"})},[C,R,o,u,f]),G.useEffect(()=>{x&&(x!=null&&x.success?y(!0):o({type:"closeScreen"}))},[o,x]),S?P.jsx(gnt,{onPass:N}):_?P.jsx(fd,{text:_.desc,success:_.success,playSound:m,translate:A,keyboardControl:d,functionOnClose:E}):null}function wz({item:u,viewMode:t}){var e,n;return P.jsxs(P.Fragment,{children:[t==="text"&&P.jsx("div",{className:"match-item-text",children:bi(u==null?void 0:u.content)}),t==="card"&&P.jsx("div",{className:"match-item-image",children:P.jsxs("figure",{children:[((e=u==null?void 0:u.img)==null?void 0:e.url)&&P.jsx("img",{src:(n=u==null?void 0:u.img)==null?void 0:n.url,alt:u==null?void 0:u.imgName}),(u==null?void 0:u.content)&&P.jsx("figcaption",{children:bi(u==null?void 0:u.content)})]})})]})}function ZU({translate:u,onClose:t,buttonLabel:e}){return P.jsx("div",{className:"timer-dialog",children:P.jsxs("div",{className:"timer-dialog__container",children:[P.jsx("div",{className:"timer-dialog__title",children:u("storylines.misc.ready")}),P.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:t,children:P.jsx("span",{children:u(`${e}`)})})]})})}function JU({topRight:u=!1,initialSeconds:t=10,isPaused:e,shouldStart:n,shouldReset:i,onTimeOver:r}){const[o,l]=G.useState(t),[c,d]=G.useState(!1),f=G.useRef();G.useEffect(()=>{i&&(l(t),d(!1))},[i,t]),G.useEffect(()=>{e&&d(!1)},[e]),G.useEffect(()=>{n&&d(!0)},[n]),G.useEffect(()=>(c&&o>0?f.current=setInterval(()=>{l(_=>_-1),o===1&&r()},1e3):o===0&&(clearInterval(f.current),d(!1)),()=>clearInterval(f.current)),[c,r,o]);const m=_=>{const g=Math.floor(_/60),S=_%60,y=String(g).padStart(2,"0"),x=String(S).padStart(2,"0");return`${y}:${x}`};return P.jsx("div",{className:["count-down",o<10&&"count-down--finalseconds",u&&"count-down--top-right"].filter(Boolean).join(" "),children:P.jsx("div",{children:m(o)})})}function ynt({emitEvent:u,soundActions:t=[()=>{},()=>{}],getEvent:e,info:n,specificFeedbacks:i,setResolveAction:r,nodeId:o,viewMode:l,title:c,sources:d,destinations:f,correctPairings:m,timer:_=0,keyboardControl:g,backgroundImage:S}){const y=Ft=>e({type:"translate",payload:Ft}),x=`match-puzzle_${o}`,[T,A]=G.useState([]),[E,C]=G.useState(null),[R,N]=G.useState(!1),[M,O]=G.useState(!1),[B,L]=G.useState(""),[k,I]=G.useState(!1),[H,W]=G.useState([]),[Z]=t;ry({soundActions:t});const X=Ft=>{Z("click-ui");const ne=Je=>Je==null?void 0:Je.startsWith("source-item"),he=Je=>Je==null?void 0:Je.startsWith("destination-item");if(Ft.id===E){C(null);return}const Lt=ne(Ft.id),qt=ne(E),te=he(Ft.id),Ie=he(E);if(Lt&&Ie||te&&qt){Q(Ft);return}C(Ft.id)},tt=Ft=>{let ne;return Ft.startsWith("destination-item")?ne={[E]:Ft}:ne={[Ft]:E},m.some(he=>{const Lt=JSON.stringify(he),qt=JSON.stringify(ne);return Lt===qt})},nt=(Ft,ne)=>{const he=new Map(Ft.map(Lt=>[Lt.id,{...Lt}]));return ne.forEach(Lt=>{he.has(Lt.id)?he.get(Lt.id).points+=Lt.points:he.set(Lt.id,{...Lt})}),Array.from(he.values())},Q=Ft=>{var ne,he;if(Z("click-ui"),tt(Ft.id)){const Lt=Ft.id.startsWith("source-item")?Ft.id:E,qt=Ft.id.startsWith("destination-item")?Ft.id:E,te=[...T,{[Lt]:qt}];if(A(te),i.specificCorrectFeedbacks){const Ie=i==null?void 0:i.correctFeedbacks.find(ee=>ee.id===`${Lt}-${qt}`),Je=nt(H,Ie.rewards);W([...Je]),$(te)&&(Ae(),I(!0)),Ie.desc&&(L(Ie==null?void 0:Ie.desc),O(!0),N(!0),Ae());const Gt=$(te);!Ie.desc&&Gt&&rt(Je)}else if($(te)&&(Ae(),I(!0)),$(te)){O(!0),n.solution.right.desc&&(Ae(),L(n.solution.right.desc)),N(!0),I(!0);const Je=nt(H,n.solution.right.rewards);W([...Je])}C(null)}else if(document.querySelector(`#${Ft.id}`).classList.add("match-button--error"),document.querySelector(`#${E}`).classList.add("match-button--error"),setTimeout(()=>{document.querySelector(`#${Ft.id}`).classList.remove("match-button--error"),document.querySelector(`#${E}`).classList.remove("match-button--error"),C(null)},1e3),i.specificWrongFeedbacks){const Lt=Ft.id.startsWith("destination-item")?Ft.id:E,qt=i==null?void 0:i.wrongFeedbacks.find(Ie=>Ie.id===Lt),te=nt(H,qt.rewards);W([...te]),qt!=null&&qt.desc&&(L(qt.desc),O(!1),N(!0),Ae())}else{const Lt=nt(H,n.solution.wrong.rewards);W([...Lt]),(he=(ne=n.solution)==null?void 0:ne.wrong)!=null&&he.desc&&(L(n.solution.wrong.desc),N(!0),Ae())}},$=Ft=>{if(m.length!==Ft.length)return!1;const ne=new Set(m.map(Lt=>JSON.stringify(Lt))),he=new Set(Ft.map(Lt=>JSON.stringify(Lt)));for(const Lt of he)if(!ne.has(Lt))return!1;return!0},rt=G.useCallback(Ft=>{Z("score");const ne=Ft?[...Ft]:[...H];u({type:"addPoints",complex:!0,finish:!0,payload:ne}),u({type:"passPuzzle"})},[H,u,Z]),ut=()=>{N(!1),O(!1),L(""),xt&&(Re(),it(!0)),!xt&&!k&&Ze(),k&&rt()},st=G.useMemo(()=>Object.assign({},...T),[T]),ot=(Ft,ne)=>st[Ft]===ne;G.useEffect(()=>{r(()=>{Z("score"),Ae(),O(!0),L(n.solution.right.desc);const Ft=[...H,...n.resolve.rewards],ne=[...m];A(ne),setTimeout(()=>{O(!1),N(!1),u({type:"hidePuzzleButtons",payload:!1}),u({type:"puzzleAction",action:"resolve",payload:{element:x,rewards:Ft,finish:!0}})},5e3)})},[H,m,u,n.resolve.rewards,n.solution.right.desc,Z,x,r]);const ht=(Ft,ne)=>T.findIndex(he=>{const Lt=Object.keys(he)[0],qt=Object.values(he)[0];return Lt===Ft&&qt===ne}),[vt,it]=G.useState(!0),[dt,lt]=G.useState("storylines.misc.start"),[xt,yt]=G.useState(!1),pt=()=>{lt("storylines.misc.retry"),it(!1),yt(!1),Ze()},[bt,Tt]=G.useState(!1),[Ct,kt]=G.useState(!1),[It,Jt]=G.useState(!1),ie=()=>{let Ft=nt(H,n.timerFeedback.rewards);if(i.specificCorrectFeedbacks){const ne=new Map(Ft.map(he=>[he.id,{...he}]));T.forEach(he=>{const Lt=Object.keys(he)[0],qt=he[Lt],te=i.correctFeedbacks.find(Ie=>Ie.id===`${Lt}-${qt}`);te!=null&&te.rewards&&te.rewards.forEach(Ie=>{if(ne.has(Ie.id)){const Je=ne.get(Ie.id);Je.points-=Ie.points,ne.set(Ie.id,Je)}})}),Ft=Array.from(ne.values())}W(Ft),A([]),yt(!0),L(n.timerFeedback.desc),N(!0),Z("fail")},Ae=()=>{Tt(!0),kt(!1),Jt(!1)},Ze=()=>{Tt(!1),kt(!0),Jt(!1)},Re=()=>{Tt(!1),kt(!1),Jt(!0)},Ee=G.useCallback(()=>{const Ft=document.querySelector('button[id^="source-item"]'),ne=document.querySelector('button[id^="destination-item"]'),he=Ft.getBoundingClientRect().right,qt=ne.getBoundingClientRect().left+6-he;d.items.forEach((te,Ie)=>{if(te.matchDestinationId!==void 0&&te.matchDestinationId!==null){const Je=document.querySelector(`#${te.id}`),Gt=document.querySelector(`#${te.matchDestinationId}`),ee=Je.getBoundingClientRect().top,pe=Gt.getBoundingClientRect().top,En=pe>ee,ue=Math.abs(pe-ee),me=Math.sqrt(qt*qt+ue*ue),Dn=Je.querySelector(".match-line__hipotenuse");Dn.style.setProperty("width",`${me}px`);const jn=Math.atan(ue/qt),Si=En?jn*(180/Math.PI):-jn*(180/Math.PI);Dn.style.setProperty("transform",`rotate(${Si}deg)`)}})},[d.items]);G.useEffect(()=>(Ee(),window.addEventListener("resize",Ee),()=>{window.removeEventListener("resize",Ee)}),[Ee]);const xn=G.useMemo(()=>{let Ft="";return Ft="match ",S!=null&&S.url&&(Ft+="match--with-custom-bg"),Ft},[S==null?void 0:S.url]),hn={backgroundImage:S!=null&&S.url?`url('${S.url}')`:""};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:xn,style:hn,children:[(c||_>0)&&P.jsxs("header",{className:"match__header",children:[P.jsx("div",{}),c&&P.jsx("div",{className:"match__title","data-testid":"match__title",children:bi(c)}),_>0&&P.jsx(JU,{topRight:!0,initialSeconds:_,isPaused:bt,shouldStart:Ct,shouldReset:It,onTimeOver:ie})]}),P.jsx("div",{className:"match__columns",children:P.jsxs("div",{className:"match__columns-scroll scroll-shadow-container",children:[P.jsxs("div",{className:"match__column-wrap",children:[d.title&&P.jsx("div",{className:"match__subtitle",children:bi(d.title)}),P.jsx("div",{className:"match__column",children:d.items.map(Ft=>P.jsxs("button",{id:Ft.id,"data-testid":Ft.id,className:["unset-button match-button",E===Ft.id&&"match-button--marked",ot(Ft.id,Ft.matchDestinationId)&&"match-button--success",ht(Ft.id,Ft.matchDestinationId)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${ht(Ft.id,Ft.matchDestinationId)+1})`},disabled:ot(Ft.id,Ft.matchDestinationId),type:"button",onClick:()=>X(Ft),children:[P.jsx(wz,{item:Ft,viewMode:l}),P.jsx("div",{className:"icon-check-circle-black color--success"}),P.jsx("div",{className:"icon-error-circle-black color--error"}),P.jsx("div",{className:"match-line__hipotenuse"})]},Ft.id))})]}),P.jsxs("div",{className:"match__column-wrap",children:[f.title&&P.jsx("div",{className:"match__subtitle",children:bi(f.title)}),P.jsx("div",{className:"match__column",children:f.items.map(Ft=>P.jsxs("button",{id:Ft.id,"data-testid":Ft.id,className:["unset-button match-button",E===Ft.id&&"match-button--marked",ot(Ft.matchSourceId,Ft.id)&&"match-button--success",ht(Ft.matchSourceId,Ft.id)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${ht(Ft.matchSourceId,Ft.id)+1})`},disabled:ot(Ft.matchSourceId,Ft.id),type:"button",onClick:()=>X(Ft),children:[P.jsx(wz,{item:Ft,viewMode:l}),P.jsx("div",{className:"icon-check-circle-black color--success"}),P.jsx("div",{className:"icon-error-circle-black color--error"})]},Ft.id))})]})]})})]}),_>0&&vt&&P.jsx(ZU,{buttonLabel:dt,translate:y,onClose:pt}),R&&P.jsx(fd,{success:M,text:B,translate:y,timeExpired:xt,functionOnClose:ut,keyboardControl:g,delay:3e3})]})}function _nt({emitEvent:u,soundActions:t=[()=>{},()=>{}],getEvent:e,info:n,specificFeedbacks:i,setResolveAction:r,nodeId:o,destinationAreas:l,draggableItems:c,noDraggableItems:d,background:f,showDestinationAreas:m,timer:_,viewMode:g,keyboardControl:S}){var jn,Si;const y=zt=>e({type:"translate",payload:zt}),x=`sort-puzzle_${o}`,[T,A]=G.useState(!1),[E,C]=G.useState(!1),[R,N]=G.useState(""),[M,O]=G.useState(!1),[B,L]=G.useState([]),[k]=t;ry({soundActions:t});const I=G.useRef({}),H=G.useRef({}),[W,Z]=G.useState(!0),[X,tt]=G.useState("storylines.misc.start"),[nt,Q]=G.useState(!1),[$,rt]=G.useState(!1),[ut,st]=G.useState(!1),[ot,ht]=G.useState(!1),vt=()=>{const zt=i.specificCorrectFeedbacks?[]:B,Wt=Ae(zt,n.timerFeedback.rewards);g==="matchMode"&&Tt.current.forEach(fe=>{fe.acceptedItems=[]}),L(Wt),Q(!0),Ee(n.timerFeedback.desc,!1),k("fail")},it=G.useCallback(()=>{rt(!0),st(!1),ht(!1)},[]),dt=()=>{rt(!1),st(!0),ht(!1)},lt=()=>{rt(!1),st(!1),ht(!0)},xt=()=>{tt("storylines.misc.retry"),Z(!1),Q(!1),dt()},yt=(zt,Wt)=>{const fe=Yt=>Yt.current.flatMap(we=>{const ce=we.acceptedItems;return ce||[]}).sort(),_e=fe(zt),Pt=fe(Wt);return _e.length!==Pt.length?!1:_e.join(",")===Pt.join(",")},pt=G.useRef(0),bt=G.useRef([]),Tt=G.useRef([]);G.useEffect(()=>{g==="matchMode"&&!pt.current&&l.forEach(zt=>{pt.current+=1,bt.current.push({id:zt.id,acceptedItems:zt.acceptedItems}),Tt.current.push({id:zt.id,acceptedItems:[]})})},[l,g]);const Ct=G.useRef(null),kt=G.useRef(null),It=G.useCallback(()=>{const zt=Ct.current.clientHeight,Wt=kt.current.clientHeight;kt.current.style.transform=`scale(${zt/Wt})`},[]);G.useEffect(()=>(It(),window.addEventListener("resize",It),()=>{window.removeEventListener("resize",It)}),[It]);const Jt=G.useRef([]),ie=G.useCallback(()=>{Jt.current=Object.values(H.current).filter(Boolean).map(zt=>{const Wt=zt.getBoundingClientRect();return{id:zt.id,top:Wt.top,left:Wt.left,right:Wt.right,bottom:Wt.bottom}})},[]);G.useEffect(()=>(ie(),window.addEventListener("resize",ie),()=>{window.removeEventListener("resize",ie)}),[ie]);const Ae=(zt,Wt)=>{const fe=new Map(zt.map(_e=>[_e.id,{..._e}]));return Wt.forEach(_e=>{fe.has(_e.id)?fe.get(_e.id).points+=_e.points:fe.set(_e.id,{..._e})}),Array.from(fe.values())},Ze=G.useCallback(zt=>{k("score");const Wt=zt?[...zt]:[...B];u({type:"addPoints",complex:!0,finish:!0,payload:Wt}),u({type:"passPuzzle"})},[B,u,k]),Re=G.useCallback(()=>{N(""),C(!1),A(!1),u({type:"hidePuzzleButtons",payload:!1})},[u]),Ee=G.useCallback((zt,Wt=!1)=>{zt&&N(zt),Wt&&C(!0),A(!0),u({type:"hidePuzzleButtons",payload:!0}),it()},[u,it]),xn=G.useCallback(()=>{n.solution.right.desc&&(it(),N(n.solution.right.desc));const zt=Ae(B,n.solution.right.rewards);L([...zt]),Ee(null,!0)},[B,n.solution.right.desc,n.solution.right.rewards,it,Ee]),hn=G.useCallback((zt,Wt)=>{const fe=i==null?void 0:i.correctFeedbacks.find(Pt=>Pt.id===zt.id),_e=Ae(B,fe.rewards);L([..._e]),fe.desc&&Ee(fe.desc,!0),!fe.desc&&Wt&&Ee(null,!0)},[B,Ee,i==null?void 0:i.correctFeedbacks]),Ft=G.useCallback(()=>{var Wt;const zt=Ae(B,n.solution.wrong.rewards);L([...zt]),n.solution.wrong.desc&&Ee((Wt=n.solution.wrong)==null?void 0:Wt.desc,!1)},[B,n.solution.wrong.desc,n.solution.wrong.rewards,Ee]),ne=(zt,Wt)=>{setTimeout(()=>{Wt.classList.remove("sort-draggable-item--error"),Wt.classList.add("sort-draggable-item--resetting"),Wt.style.setProperty("transform",zt.transform),setTimeout(()=>Wt.classList.remove("sort-draggable-item--resetting"),1e3)},1e3)},he=zt=>{if(zt==="none")return{x:0,y:0};const fe=zt.replace("matrix(","").replace("matrix3d(","").replace(")","").split(", ");return fe.length===6?{x:parseFloat(fe[4]),y:parseFloat(fe[5])}:fe.length===16?{x:parseFloat(fe[12]),y:parseFloat(fe[13])}:{x:0,y:0}},Lt=G.useRef(),qt=G.useRef(),te=G.useRef(),Ie=G.useRef(),Je=(zt,Wt)=>{Lt.current=Wt;const fe=zt.currentTarget;fe.classList.add("sort-draggable-item--dragging");const _e=zt.touches?zt.touches[0].clientX:zt.clientX,Pt=zt.touches?zt.touches[0].clientY:zt.clientY;qt.current=_e,te.current=Pt;const Yt=window.getComputedStyle(fe).getPropertyValue("transform");Ie.current=he(Yt)},Gt=G.useCallback((zt,Wt)=>{if(Lt.current&&Lt.current===Wt){const fe=Ct.current.clientHeight/kt.current.clientHeight,_e=I.current[Wt],Pt=_e.getBoundingClientRect(),Zt=_e.parentElement.getBoundingClientRect(),we=(zt.touches?zt.touches[0].clientX:zt.clientX)-qt.current,ce=(zt.touches?zt.touches[0].clientY:zt.clientY)-te.current,fn=(Zt.width-Pt.width)/fe,xi=(Zt.height-Pt.height)/fe,$n=Math.min(Math.max(Ie.current.x+we/fe,0),fn),is=Math.min(Math.max(Ie.current.y+ce/fe,0),xi);_e.style.transform=`translate(${$n}px, ${is}px)`}},[]),ee=(zt,Wt)=>{const _e=I.current[zt].getBoundingClientRect(),Pt=Jt.current.find(Zt=>Zt.id===Wt&&!(_e.left>=Zt.right||_e.right<=Zt.left||_e.top>=Zt.bottom||_e.bottom<=Zt.top)),Yt=Jt.current.find(Zt=>Zt.id!==Wt&&!(_e.left>=Zt.right||_e.right<=Zt.left||_e.top>=Zt.bottom||_e.bottom<=Zt.top));return Pt?"correctArea":Yt?"incorrectArea":"neutral"},pe=G.useCallback(zt=>{if(Lt.current&&Lt.current===zt){k("click-ui");const Wt=I.current[zt],fe=c.find(_e=>zt===_e.id);if(qt.current=null,te.current=null,Wt.classList.remove("sort-draggable-item--dragging"),Lt.current=null,g!=="resolveMode"){const _e=ee(zt,fe.destination.id);if(_e==="correctArea"){if(g==="anyItemResolver"){k("score"),it(),Wt.classList.add("sort-draggable-item--success");const Pt=!0;O(Pt),i.specificCorrectFeedbacks?hn(fe,Pt):xn()}if(g==="matchMode")if(k("score"),Wt.classList.add("sort-draggable-item--success"),Tt.current.find(Yt=>Yt.id===fe.destination.id).acceptedItems.push(fe.id),i.specificCorrectFeedbacks){const Yt=yt(Tt,bt);Yt&&O(!0),hn(fe,Yt)}else yt(Tt,bt)&&(O(!0),xn())}else if(_e==="incorrectArea"&&(g==="anyItemResolver"||g==="matchMode")){if(k("fail"),Wt.classList.add("sort-draggable-item--error"),i.specificWrongFeedbacks){const Pt=i==null?void 0:i.wrongFeedbacks.find(Zt=>Zt.id===fe.id),Yt=Ae(B,Pt.rewards);L([...Yt]),Pt.desc&&Ee(Pt.desc,!1)}else Ft();ne(fe,Wt)}}}},[B,c,xn,Ft,hn,it,k,Ee,i.specificCorrectFeedbacks,i.specificWrongFeedbacks,i==null?void 0:i.wrongFeedbacks,g]),En=()=>{let zt=!1;it(),c.forEach(Wt=>{const fe=I.current[Wt.id];if(Wt.destination.id)ee(Wt.id,Wt.destination.id)!=="correctArea"?(zt=!0,fe.classList.add("sort-draggable-item--error"),ne(Wt,fe)):fe.classList.add("sort-draggable-item--success");else{const _e=fe.getBoundingClientRect();Jt.current.find(Yt=>!(_e.left>=Yt.right||_e.right<=Yt.left||_e.top>=Yt.bottom||_e.bottom<=Yt.top))&&(zt=!0,fe.classList.add("sort-draggable-item--error"),ne(Wt,fe))}}),zt?(k("fail"),Ft()):(k("score"),O(!0),xn())},ue=()=>{c.forEach(zt=>{const Wt=I.current[zt.id];Wt.classList.remove("sort-draggable-item--error"),Wt.classList.remove("sort-draggable-item--success"),Wt.classList.add("sort-draggable-item--resetting"),Wt.style.setProperty("transform",zt.transform),setTimeout(()=>Wt.classList.remove("sort-draggable-item--resetting"),1e3)})},me=()=>{Re(),nt&&(lt(),ue(),Z(!0)),!nt&&!M&&dt(),M&&Ze()};G.useEffect(()=>{r(()=>{k("score"),it(),C(!0),N(n.solution.right.desc);const zt=[...B,...n.resolve.rewards];Re(),u({type:"puzzleAction",action:"resolve",payload:{element:x,rewards:zt,finish:!0}})})},[B,u,n.resolve.rewards,n.solution.right.desc,it,k,x,Re,r]),G.useEffect(()=>{if(!Ct.current||!kt.current)return;const zt=fe=>Gt(fe,Lt.current),Wt=()=>pe(Lt.current);return document.addEventListener("mousemove",zt),document.addEventListener("mouseup",Wt),document.addEventListener("touchmove",zt,{passive:!1}),document.addEventListener("touchend",Wt),()=>{document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",Wt),document.removeEventListener("touchmove",zt),document.removeEventListener("touchend",Wt)}},[pe,Gt]);const Dn={backgroundImage:(jn=f==null?void 0:f.img)!=null&&jn.url?`url('${(Si=f==null?void 0:f.img)==null?void 0:Si.url}')`:""};return P.jsxs("div",{ref:Ct,className:"sort-wrapper",children:[P.jsxs("div",{ref:kt,className:"sort-puzzle",style:Dn,children:[d.map(zt=>P.jsxs("div",{id:`${zt.id}`,className:"sort-no-draggable-item",style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`,"--backgroundColor":`${zt.backgroundColor}`,borderRadius:`${zt.borderRadius}`},children:[zt.imgId&&P.jsx("img",{src:zt.img.url,alt:zt.img.name}),zt.text&&bi(zt.text)]},zt.id)),l.map(zt=>P.jsx("div",{ref:Wt=>{H.current[zt.id]=Wt},id:zt.id,className:`sort-destination-area ${m?"sort-destination-area--revelable":""}`,style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`}},zt.id)),c.map(zt=>P.jsxs("div",{ref:Wt=>{I.current[zt.id]=Wt},id:`${zt.id}`,className:"sort-draggable-item",onMouseDown:Wt=>Je(Wt,zt.id),onTouchStart:Wt=>Je(Wt,zt.id),style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`,"--backgroundColor":`${zt.backgroundColor}`,borderRadius:`${zt.borderRadius}`},children:[zt.imgId&&P.jsx("img",{src:zt.img.url,alt:zt.img.name}),zt.text&&bi(zt.text)]},zt.id))]}),g==="resolveMode"&&P.jsx("button",{type:"button",onClick:()=>{En()},className:"gat--btn gat--btn__primary sort-resolve-button",children:P.jsx("span",{children:y("storylines.misc.check")})}),_>0&&W&&P.jsx(ZU,{buttonLabel:X,translate:y,onClose:xt}),T&&P.jsx(fd,{success:E,text:R,translate:y,timeExpired:nt,functionOnClose:me,keyboardControl:S}),_>0&&P.jsx(JU,{topRight:!0,initialSeconds:_,isPaused:$,shouldStart:ut,shouldReset:ot,onTimeOver:vt})]})}exports.AnimationComponent=dnt;exports.AutoEvaluationComponent=jtt;exports.CameraChangeContext=m9;exports.CameraChangeProvider=FY;exports.CardsSelectorPuzzleComponent=att;exports.CartelComponent=gX;exports.ChainedImageClickPuzzleComponent=R$;exports.ChangeCamera=g9;exports.ComicComponent=pX;exports.ConversationalComponent=cX;exports.ConversationalProComponent=uX;exports.CrackerPuzzleComponent=v$;exports.DecisionComponent=M9;exports.DialogComponent=ont;exports.DragItemPuzzleComponent=btt;exports.DragToSceneComponent=vnt;exports.FrameImageClickComponent=O$;exports.HackerPuzzleComponent=SX;exports.HangedPuzzleComponent=A$;exports.ImageClickPuzzleComponent=s$;exports.ImageComponent=aX;exports.InventoryItem=PH;exports.KeyboardPuzzleComponent=TX;exports.LecturesComponent=XK;exports.LoginPuzzleComponent=EX;exports.MatchPuzzleComponent=ynt;exports.NoticeComponent=RH;exports.PatternComponent=ztt;exports.PdfComponent=SY;exports.PdfVisor=v5;exports.ProgressRing=WI;exports.ReferralComponent=mnt;exports.SortPuzzleComponent=_nt;exports.SurveyComponent=Ntt;exports.TerminalPuzzleComponent=_tt;exports.TestComponent=Ctt;exports.TextClickPuzzleComponent=Btt;exports.UrlComponent=xY;exports.VideoComponent=BY;exports.VideoVisor=y5;exports.WebBuilderPuzzleComponent=W$;exports.WriterPuzzleComponent=ftt;exports.useCameraChange=mk;
334
+ ${y&&En()?"glowing-animation":""}`,"aria-label":Pe()?Ct("storylines.misc.rewind"):Ct("storylines.misc.forward"),children:P.jsx("span",{className:Pe()?"icon-back":"icon-next"})})]})})]})}const lnt=Va.ProgressManager.request("AssetLoader").cache,unt=new Va.AssetLoader(void 0,lnt);function cnt({animation:u,loopTimes:t,onAnimationFinish:e,onAnimationSave:n,resource:i,makeDefault:r}){const[o,l]=G.useState(!1),c=v0.useThree(f=>f.scene),d=G.useRef(0);return G.useEffect(()=>{l(!1)},[i.uid,u==null?void 0:u.url]),G.useEffect(()=>{if(!o){const f=c.getObjectByProperty("uid",i.uid);if(f&&u&&u.url&&f.skeletonId===(u==null?void 0:u.skeletonId))if(r)n({uid:i.uid,animation:u==null?void 0:u.id,index:f.index}),e();else{const m=f.animator;m||console.error("[Animation]: Current Object ",i.uid," does not have an animator.");const _=()=>{const g=m==null?void 0:m.getAction(u.url);m.setTime(0),g.setLoop(Ma.LoopRepeat,1/0),g.reset();function S(){d.current+=1,d.current>=t&&y()}function y(){m.mix("idle"),e(),m.removeEventListener("loop",S)}m.mix(u==null?void 0:u.url).then(x=>{x&&(d.current=1,d.current>=t?y():m.addEventListener("loop",S))}),l(!0)};m!=null&&m.getAction(u==null?void 0:u.url)?_():unt.load(u==null?void 0:u.url,g=>{m.register(u==null?void 0:u.url,g.animations[0]),_()},void 0,g=>{console.error(`Asset loader failed with: ${u.url}`,g),e()})}else e()}},[c,u==null?void 0:u.url,t,o,i.uid,r,u,i,e,n]),null}function dnt({animations:u=[],enableInteraction:t,emitEvent:e}){const n=u.length,i=G.useRef(0),r=()=>{i.current+=1,i.current>=n&&t&&e({type:"success"})},o=l=>{e({type:"saveAnimation",payload:l})};return G.useEffect(()=>{i.current=0},[u]),G.useEffect(()=>{t||e({type:"success"})},[e,t]),u.map(({animation:l,...c},d)=>{var f;return P.jsx(cnt,{animation:l,...c,onAnimationFinish:r,onAnimationSave:o},(l==null?void 0:l.id)||((f=c.resource)==null?void 0:f.uid)||d)})}function hnt({text:u,error:t,handleClick:e}){return P.jsxs("div",{"data-testid":`${t?" pill--error":"pill--ok"}`,className:`email-pill ${t?" email-pill--error":""}`,children:[P.jsx("div",{children:u}),P.jsx("div",{className:"email-pill__delete",children:P.jsx("button",{type:"button",onClick:e,className:"icon-close unset-button","aria-label":"icon click"})})]})}function fnt({handleContinue:u,handleCancel:t,translate:e,text:n}){const[i,r]=G.useState([]),[o,l]=G.useState(0),[c,d]=G.useState(0),f=G.useRef(null),m=(y,x,T)=>{y.stopPropagation(),r(i.filter(A=>A!==i[T])),x.error&&l(o-1),x.isRepeat&&d(c-1)},_=()=>{f.current&&f.current.focus()},g=()=>{[" ",",",";","."].includes(f.current.value)&&(f.current.value="")},S=y=>{const x=f.current.value,T=["Space","Comma","Period","Enter"],A=["Space","Comma","Enter","Tab"];x===""&&(T.includes(y.code)||y.keyCode==="186"||y.key==="Enter"||y.key===" ")?y.preventDefault():f.current.value.length>1&&(A.includes(y.code)||y.type==="blur")&&(y.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(x)?i.find(C=>C.text===x)?(d(c+1),r([...i,{text:x,error:!0,isRepeat:!0}])):r([...i,{text:x}]):(r([...i,{text:x,error:!0}]),l(o+1)),f.current.value="")};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"referrals-piece__body",children:[P.jsx("div",{className:"referrals-piece__title",children:e("puzzles.referrals.inviter.titleStep1")}),P.jsx("div",{className:"referrals-piece__subtitle",children:n}),P.jsxs("div",{className:"referrals-piece__form",children:[P.jsxs("div",{className:"referrals-piece__instructions",children:[P.jsx("div",{dir:"auto",children:e("puzzles.referrals.inviter.instructions")}),P.jsx("div",{dir:"auto",children:e("puzzles.referrals.inviter.limit")})]}),P.jsx("div",{className:"referrals-piece__faketextarea",onKeyUp:()=>{},role:"button",tabIndex:"-1",onClick:_,"aria-labelledby":"list of emails",children:P.jsxs("div",{className:"referrals-piece__scrollarea",id:"list of emails",children:[i&&i.map((y,x)=>P.jsx(hnt,{text:y.text,error:y.error,handleClick:T=>m(T,y,x),emailPillIndex:x},`${i.indexOf(y)}`)),i.length<=9?P.jsxs(P.Fragment,{children:[P.jsx("input",{id:"email",ref:f,className:"referrals-piece__inputemail",onChange:g,onKeyDown:S,onBlur:S,type:"email",autoComplete:"off"}),P.jsx("label",{className:"referrals-piece__emaillabel",htmlFor:"email",children:P.jsx("span",{children:e("puzzles.referrals.inviter.skipButton")})})]}):null]})}),P.jsxs("div",{dir:Pe()?"rtl":"auto",className:"referrals-piece__footervalidation",children:[P.jsxs("div",{className:"referrals-piece__errormessage",children:[P.jsx("div",{children:c>0?e("puzzles.referrals.inviter.errorEmailRepeat"):null}),P.jsx("div",{children:o>0?e("puzzles.referrals.inviter.errorMessage"):null})]}),P.jsxs("div",{className:"referrals-piece__counter","data-testid":"pillcounter",children:[i.length,"/10"]})]})]})]}),P.jsxs("div",{className:"referrals-piece__buttons",children:[P.jsx("button",{"data-testid":"cancelButton",className:"gat--btn gat--btn__secondary",type:"button",onClick:t,children:e("puzzles.referrals.inviter.skipButton")}),P.jsx("button",{className:`gat--btn gat--btn__primary ${c>0||o>0||i.length===0?" disabled":""}`,type:"button",disabled:o>0||i.length===0,onClick:()=>u(i),children:e("puzzles.referrals.inviter.inviteButton")})]})]})}function pnt({handleFinish:u,translate:t,valid:e,invalid:n}){const[i,r]=G.useState(!1),o=()=>{r(!i)},l=e.current===1?"invitationSend":"invitationsSend",c=n===1?"invitationNotSend":"invitationsNotSend";return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"referrals-piece__body",dir:"auto",children:[P.jsx("div",{className:"referrals-piece__title",children:t("puzzles.referrals.inviter.titleStep2")}),P.jsxs("ul",{className:"referrals-piece__feedback",children:[e.current!==0&&P.jsxs("li",{children:[P.jsx("div",{className:"referrals-piece__feedbackicon icon-check-circle-black color--success"}),P.jsxs("div",{children:[P.jsx("strong",{children:e.current})," ",t(`puzzles.referrals.inviter.${l}`)]})]}),!!n.current&&P.jsxs("li",{children:[P.jsx("div",{className:"referrals-piece__feedbackicon icon-error-circle-black color--error"}),P.jsxs("div",{children:[P.jsx("strong",{children:n.current})," ",t(`puzzles.referrals.inviter.${c}`)]}),P.jsx("button",{className:"un-button",type:"button",onClick:o,children:t("puzzles.referrals.inviter.whyFail")})]})]}),i?P.jsxs("ul",{className:"referrals-piece__failsreasons",children:[P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons1")}),P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons2")}),P.jsx("li",{children:t("puzzles.referrals.inviter.failReasons3")})]}):null]}),P.jsx("div",{className:"referrals-piece__buttons",children:P.jsx("button",{className:"gat--btn gat--btn__primary",type:"button",onClick:u,children:t("puzzles.referrals.inviter.continueButton")})})]})}function mnt({emitEvent:u,getEvent:t,text:e,rewards:n,referrals:i}){const r=g=>t({type:"translate",payload:g}),[o,l]=G.useState("step1"),c=G.useRef(0),d=G.useRef(0),f=async g=>{const S=g.map(x=>x.text),y=await u({type:"sendReferrals",payload:S});c.current=y&&y.data?y.data.valid.length:0,d.current=S.length-c.current,l("step2")};if(!i)return u({type:"success"}),null;const m=()=>{u({type:"success"})},_=()=>{if(c.current){const g=n.map(S=>(S.points*=c.current,S));u({type:"addPoints",complex:!0,finish:!0,payload:g})}else u({type:"success"})};return P.jsx("div",{className:"referrals-piece",children:P.jsxs("div",{className:"referrals-piece__center",children:[o==="step1"&&P.jsx(fnt,{translate:r,handleContinue:f,handleCancel:m,text:e}),o==="step2"&&P.jsx(pnt,{translate:r,handleFinish:_,valid:c,invalid:d})]})})}function gnt({onPass:u}){return G.useEffect(()=>{const t=setTimeout(u,0);return()=>clearTimeout(t)},[u]),null}function vnt({itemResolver:u,consume:t,hasComplexNotResolvers:e,hasComplexResolvers:n,resolverObjects:i,feedback:r,emitEvent:o,getEvent:l,soundActions:c,keyboardControl:d,noEvaluation:f}){const[m]=c,[_,g]=G.useState(!1),[S,y]=G.useState(!1),[x,T]=G.useState(!1),A=M=>l({type:"translate",payload:M}),E=G.useCallback(()=>{o({type:"addPoints",complex:!0,finish:_.success,onFinish:()=>{_.success?o({type:"success"}):o({type:"closeScreen"})},payload:_.rewards})},[o,_]),C=G.useCallback(()=>{if(i.find(O=>O===u.uid)){let O;n?(O=r.resolvers.rights.find(B=>B.uidObject===u.uid),O||(O=r.resolvers.rights[0])):O=r.resolvers.rights[0],t&&o({type:"consumeItem",payload:{uid:u.uid,targetId:u.uid,name:u.name}}),g({...O,success:!0})}else{let O;e?(O=r.notResolvers.wrongs.find(B=>B.uidObject===u.uid),O||(O=r.notResolvers.wrongs[0])):O=r.notResolvers.wrongs[0],g({...O,success:!1})}},[i,u,n,t,r,o,e]),R=G.useCallback(()=>{if(i.find(O=>O===(u==null?void 0:u.uid))){let O;n?O=[...r.resolvers.rights.find(k=>k.uidObject===(u==null?void 0:u.uid)).rewards.filter(k=>k.type==="var")]:O=[...r.resolvers.rights[0].rewards.filter(L=>L.type==="var")],t&&o({type:"consumeItem",payload:{uid:u==null?void 0:u.uid,targetId:u==null?void 0:u.uid,name:u==null?void 0:u.name}}),T({varsPoints:[...O],success:!0})}else{let O;e?O=[...r.notResolvers.wrongs.find(k=>k.uidObject===(u==null?void 0:u.uid)).rewards.filter(k=>k.type==="var")]:O=[...r.notResolvers.wrongs[0].rewards.filter(L=>L.type==="var")],T({varsPoints:[...O],success:!1})}},[t,o,r.notResolvers.wrongs,r.resolvers.rights,e,n,u==null?void 0:u.name,u==null?void 0:u.uid,i]),N=G.useCallback(()=>{o({type:"addPoints",complex:!0,finish:x==null?void 0:x.success,onFinish:()=>{x!=null&&x.success?o({type:"success"}):o({type:"closeScreen"})},payload:x!=null&&x.varsPoints?x==null?void 0:x.varsPoints:[]}),y(!1)},[o,x==null?void 0:x.success,x==null?void 0:x.varsPoints]);return G.useEffect(()=>{u?f?R():C():o({type:"closeScreen"})},[C,R,o,u,f]),G.useEffect(()=>{x&&(x!=null&&x.success?y(!0):o({type:"closeScreen"}))},[o,x]),S?P.jsx(gnt,{onPass:N}):_?P.jsx(fd,{text:_.desc,success:_.success,playSound:m,translate:A,keyboardControl:d,functionOnClose:E}):null}function wz({item:u,viewMode:t}){var e,n;return P.jsxs(P.Fragment,{children:[t==="text"&&P.jsx("div",{className:"match-item-text",children:bi(u==null?void 0:u.content)}),t==="card"&&P.jsx("div",{className:"match-item-image",children:P.jsxs("figure",{children:[((e=u==null?void 0:u.img)==null?void 0:e.url)&&P.jsx("img",{src:(n=u==null?void 0:u.img)==null?void 0:n.url,alt:u==null?void 0:u.imgName}),(u==null?void 0:u.content)&&P.jsx("figcaption",{children:bi(u==null?void 0:u.content)})]})})]})}function ZU({translate:u,onClose:t,buttonLabel:e}){return P.jsx("div",{className:"timer-dialog",children:P.jsxs("div",{className:"timer-dialog__container",children:[P.jsx("div",{className:"timer-dialog__title",children:u("storylines.misc.ready")}),P.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:t,children:P.jsx("span",{children:u(`${e}`)})})]})})}function JU({topRight:u=!1,initialSeconds:t=10,isPaused:e,shouldStart:n,shouldReset:i,onTimeOver:r}){const[o,l]=G.useState(t),[c,d]=G.useState(!1),f=G.useRef();G.useEffect(()=>{i&&(l(t),d(!1))},[i,t]),G.useEffect(()=>{e&&d(!1)},[e]),G.useEffect(()=>{n&&d(!0)},[n]),G.useEffect(()=>(c&&o>0?f.current=setInterval(()=>{l(_=>_-1),o===1&&r()},1e3):o===0&&(clearInterval(f.current),d(!1)),()=>clearInterval(f.current)),[c,r,o]);const m=_=>{const g=Math.floor(_/60),S=_%60,y=String(g).padStart(2,"0"),x=String(S).padStart(2,"0");return`${y}:${x}`};return P.jsx("div",{className:["count-down",o<10&&"count-down--finalseconds",u&&"count-down--top-right"].filter(Boolean).join(" "),children:P.jsx("div",{children:m(o)})})}function ynt({emitEvent:u,soundActions:t=[()=>{},()=>{}],getEvent:e,info:n,specificFeedbacks:i,setResolveAction:r,nodeId:o,viewMode:l,title:c,sources:d,destinations:f,correctPairings:m,timer:_=0,keyboardControl:g,backgroundImage:S}){const y=Ft=>e({type:"translate",payload:Ft}),x=`match-puzzle_${o}`,[T,A]=G.useState([]),[E,C]=G.useState(null),[R,N]=G.useState(!1),[M,O]=G.useState(!1),[B,L]=G.useState(""),[k,I]=G.useState(!1),[H,W]=G.useState([]),[Z]=t;ry({soundActions:t});const X=Ft=>{Z("click-ui");const ne=Je=>Je==null?void 0:Je.startsWith("source-item"),he=Je=>Je==null?void 0:Je.startsWith("destination-item");if(Ft.id===E){C(null);return}const Lt=ne(Ft.id),qt=ne(E),te=he(Ft.id),Ie=he(E);if(Lt&&Ie||te&&qt){Q(Ft);return}C(Ft.id)},tt=Ft=>{let ne;return Ft.startsWith("destination-item")?ne={[E]:Ft}:ne={[Ft]:E},m.some(he=>{const Lt=JSON.stringify(he),qt=JSON.stringify(ne);return Lt===qt})},nt=(Ft,ne)=>{const he=new Map(Ft.map(Lt=>[Lt.id,{...Lt}]));return ne.forEach(Lt=>{he.has(Lt.id)?he.get(Lt.id).points+=Lt.points:he.set(Lt.id,{...Lt})}),Array.from(he.values())},Q=Ft=>{var ne,he;if(Z("click-ui"),tt(Ft.id)){const Lt=Ft.id.startsWith("source-item")?Ft.id:E,qt=Ft.id.startsWith("destination-item")?Ft.id:E,te=[...T,{[Lt]:qt}];if(A(te),i.specificCorrectFeedbacks){const Ie=i==null?void 0:i.correctFeedbacks.find(ee=>ee.id===`${Lt}-${qt}`),Je=nt(H,Ie.rewards);W([...Je]),$(te)&&(Ae(),I(!0)),Ie.desc&&(L(Ie==null?void 0:Ie.desc),O(!0),N(!0),Ae());const Gt=$(te);!Ie.desc&&Gt&&rt(Je)}else if($(te)&&(Ae(),I(!0)),$(te)){O(!0),n.solution.right.desc&&(Ae(),L(n.solution.right.desc)),N(!0),I(!0);const Je=nt(H,n.solution.right.rewards);W([...Je])}C(null)}else if(document.querySelector(`#${Ft.id}`).classList.add("match-button--error"),document.querySelector(`#${E}`).classList.add("match-button--error"),setTimeout(()=>{document.querySelector(`#${Ft.id}`).classList.remove("match-button--error"),document.querySelector(`#${E}`).classList.remove("match-button--error"),C(null)},1e3),i.specificWrongFeedbacks){const Lt=Ft.id.startsWith("destination-item")?Ft.id:E,qt=i==null?void 0:i.wrongFeedbacks.find(Ie=>Ie.id===Lt),te=nt(H,qt.rewards);W([...te]),qt!=null&&qt.desc&&(L(qt.desc),O(!1),N(!0),Ae())}else{const Lt=nt(H,n.solution.wrong.rewards);W([...Lt]),(he=(ne=n.solution)==null?void 0:ne.wrong)!=null&&he.desc&&(L(n.solution.wrong.desc),N(!0),Ae())}},$=Ft=>{if(m.length!==Ft.length)return!1;const ne=new Set(m.map(Lt=>JSON.stringify(Lt))),he=new Set(Ft.map(Lt=>JSON.stringify(Lt)));for(const Lt of he)if(!ne.has(Lt))return!1;return!0},rt=G.useCallback(Ft=>{Z("score");const ne=Ft?[...Ft]:[...H];u({type:"addPoints",complex:!0,finish:!0,payload:ne}),u({type:"passPuzzle"})},[H,u,Z]),ut=()=>{N(!1),O(!1),L(""),xt&&(Re(),it(!0)),!xt&&!k&&Ze(),k&&rt()},st=G.useMemo(()=>Object.assign({},...T),[T]),ot=(Ft,ne)=>st[Ft]===ne;G.useEffect(()=>{r(()=>{Z("score"),Ae(),O(!0),L(n.solution.right.desc);const Ft=[...H,...n.resolve.rewards],ne=[...m];A(ne),setTimeout(()=>{O(!1),N(!1),u({type:"hidePuzzleButtons",payload:!1}),u({type:"puzzleAction",action:"resolve",payload:{element:x,rewards:Ft,finish:!0}})},5e3)})},[H,m,u,n.resolve.rewards,n.solution.right.desc,Z,x,r]);const ht=(Ft,ne)=>T.findIndex(he=>{const Lt=Object.keys(he)[0],qt=Object.values(he)[0];return Lt===Ft&&qt===ne}),[vt,it]=G.useState(!0),[dt,lt]=G.useState("storylines.misc.start"),[xt,yt]=G.useState(!1),pt=()=>{lt("storylines.misc.retry"),it(!1),yt(!1),Ze()},[bt,Tt]=G.useState(!1),[Ct,kt]=G.useState(!1),[It,Jt]=G.useState(!1),ie=()=>{let Ft=nt(H,n.timerFeedback.rewards);if(i.specificCorrectFeedbacks){const ne=new Map(Ft.map(he=>[he.id,{...he}]));T.forEach(he=>{const Lt=Object.keys(he)[0],qt=he[Lt],te=i.correctFeedbacks.find(Ie=>Ie.id===`${Lt}-${qt}`);te!=null&&te.rewards&&te.rewards.forEach(Ie=>{if(ne.has(Ie.id)){const Je=ne.get(Ie.id);Je.points-=Ie.points,ne.set(Ie.id,Je)}})}),Ft=Array.from(ne.values())}W(Ft),A([]),yt(!0),L(n.timerFeedback.desc),N(!0),Z("fail")},Ae=()=>{Tt(!0),kt(!1),Jt(!1)},Ze=()=>{Tt(!1),kt(!0),Jt(!1)},Re=()=>{Tt(!1),kt(!1),Jt(!0)},Ee=G.useCallback(()=>{const Ft=document.querySelector('button[id^="source-item"]'),ne=document.querySelector('button[id^="destination-item"]'),he=Ft.getBoundingClientRect().right,qt=ne.getBoundingClientRect().left+6-he;d.items.forEach((te,Ie)=>{if(te.matchDestinationId!==void 0&&te.matchDestinationId!==null){const Je=document.querySelector(`#${te.id}`),Gt=document.querySelector(`#${te.matchDestinationId}`),ee=Je.getBoundingClientRect().top,pe=Gt.getBoundingClientRect().top,En=pe>ee,ue=Math.abs(pe-ee),me=Math.sqrt(qt*qt+ue*ue),Dn=Je.querySelector(".match-line__hipotenuse");Dn.style.setProperty("width",`${me}px`);const jn=Math.atan(ue/qt),Si=En?jn*(180/Math.PI):-jn*(180/Math.PI);Dn.style.setProperty("transform",`rotate(${Si}deg)`)}})},[d.items]);G.useEffect(()=>(Ee(),window.addEventListener("resize",Ee),()=>{window.removeEventListener("resize",Ee)}),[Ee]);const xn=G.useMemo(()=>{let Ft="";return Ft="match ",S!=null&&S.url&&(Ft+="match--with-custom-bg"),Ft},[S==null?void 0:S.url]),hn={backgroundImage:S!=null&&S.url?`url('${S.url}')`:""};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:xn,style:hn,children:[(c||_>0)&&P.jsxs("header",{className:"match__header",children:[P.jsx("div",{}),c&&P.jsx("div",{className:"match__title","data-testid":"match__title",children:bi(c)}),_>0&&P.jsx(JU,{topRight:!0,initialSeconds:_,isPaused:bt,shouldStart:Ct,shouldReset:It,onTimeOver:ie})]}),P.jsx("div",{className:"match__columns",children:P.jsxs("div",{className:"match__columns-scroll scroll-shadow-container",children:[P.jsxs("div",{className:"match__column-wrap",children:[d.title&&P.jsx("div",{className:"match__subtitle",children:bi(d.title)}),P.jsx("div",{className:"match__column",children:d.items.map(Ft=>P.jsxs("button",{id:Ft.id,"data-testid":Ft.id,className:["unset-button match-button",E===Ft.id&&"match-button--marked",ot(Ft.id,Ft.matchDestinationId)&&"match-button--success",ht(Ft.id,Ft.matchDestinationId)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${ht(Ft.id,Ft.matchDestinationId)+1})`},disabled:ot(Ft.id,Ft.matchDestinationId),type:"button",onClick:()=>X(Ft),children:[P.jsx(wz,{item:Ft,viewMode:l}),P.jsx("div",{className:"icon-check-circle-black color--success"}),P.jsx("div",{className:"icon-error-circle-black color--error"}),P.jsx("div",{className:"match-line__hipotenuse"})]},Ft.id))})]}),P.jsxs("div",{className:"match__column-wrap",children:[f.title&&P.jsx("div",{className:"match__subtitle",children:bi(f.title)}),P.jsx("div",{className:"match__column",children:f.items.map(Ft=>P.jsxs("button",{id:Ft.id,"data-testid":Ft.id,className:["unset-button match-button",E===Ft.id&&"match-button--marked",ot(Ft.matchSourceId,Ft.id)&&"match-button--success",ht(Ft.matchSourceId,Ft.id)+1&&"match-button--matched"].filter(Boolean).join(" "),style:{"--matched-color":`var(--matched-color-${ht(Ft.matchSourceId,Ft.id)+1})`},disabled:ot(Ft.matchSourceId,Ft.id),type:"button",onClick:()=>X(Ft),children:[P.jsx(wz,{item:Ft,viewMode:l}),P.jsx("div",{className:"icon-check-circle-black color--success"}),P.jsx("div",{className:"icon-error-circle-black color--error"})]},Ft.id))})]})]})})]}),_>0&&vt&&P.jsx(ZU,{buttonLabel:dt,translate:y,onClose:pt}),R&&P.jsx(fd,{success:M,text:B,translate:y,timeExpired:xt,functionOnClose:ut,keyboardControl:g,delay:3e3})]})}function _nt({emitEvent:u,soundActions:t=[()=>{},()=>{}],getEvent:e,info:n,specificFeedbacks:i,setResolveAction:r,nodeId:o,destinationAreas:l,draggableItems:c,noDraggableItems:d,background:f,showDestinationAreas:m,timer:_,viewMode:g,keyboardControl:S}){var jn,Si;const y=zt=>e({type:"translate",payload:zt}),x=`sort-puzzle_${o}`,[T,A]=G.useState(!1),[E,C]=G.useState(!1),[R,N]=G.useState(""),[M,O]=G.useState(!1),[B,L]=G.useState([]),[k]=t;ry({soundActions:t});const I=G.useRef({}),H=G.useRef({}),[W,Z]=G.useState(!0),[X,tt]=G.useState("storylines.misc.start"),[nt,Q]=G.useState(!1),[$,rt]=G.useState(!1),[ut,st]=G.useState(!1),[ot,ht]=G.useState(!1),vt=()=>{const zt=i.specificCorrectFeedbacks?[]:B,Wt=Ae(zt,n.timerFeedback.rewards);g==="matchMode"&&Tt.current.forEach(fe=>{fe.acceptedItems=[]}),L(Wt),Q(!0),Ee(n.timerFeedback.desc,!1),k("fail")},it=G.useCallback(()=>{rt(!0),st(!1),ht(!1)},[]),dt=()=>{rt(!1),st(!0),ht(!1)},lt=()=>{rt(!1),st(!1),ht(!0)},xt=()=>{tt("storylines.misc.retry"),Z(!1),Q(!1),dt()},yt=(zt,Wt)=>{const fe=Yt=>Yt.current.flatMap(we=>{const ce=we.acceptedItems;return ce||[]}).sort(),_e=fe(zt),Pt=fe(Wt);return _e.length!==Pt.length?!1:_e.join(",")===Pt.join(",")},pt=G.useRef(0),bt=G.useRef([]),Tt=G.useRef([]);G.useEffect(()=>{g==="matchMode"&&!pt.current&&l.forEach(zt=>{pt.current+=1,bt.current.push({id:zt.id,acceptedItems:zt.acceptedItems}),Tt.current.push({id:zt.id,acceptedItems:[]})})},[l,g]);const Ct=G.useRef(null),kt=G.useRef(null),It=G.useCallback(()=>{const zt=Ct.current.clientHeight,Wt=kt.current.clientHeight;kt.current.style.transform=`scale(${zt/Wt})`},[]);G.useEffect(()=>(It(),window.addEventListener("resize",It),()=>{window.removeEventListener("resize",It)}),[It]);const Jt=G.useRef([]),ie=G.useCallback(()=>{Jt.current=Object.values(H.current).filter(Boolean).map(zt=>{const Wt=zt.getBoundingClientRect();return{id:zt.id,top:Wt.top,left:Wt.left,right:Wt.right,bottom:Wt.bottom}})},[]);G.useEffect(()=>(ie(),window.addEventListener("resize",ie),()=>{window.removeEventListener("resize",ie)}),[ie]);const Ae=(zt,Wt)=>{const fe=new Map(zt.map(_e=>[_e.id,{..._e}]));return Wt.forEach(_e=>{fe.has(_e.id)?fe.get(_e.id).points+=_e.points:fe.set(_e.id,{..._e})}),Array.from(fe.values())},Ze=G.useCallback(zt=>{k("score");const Wt=zt?[...zt]:[...B];u({type:"addPoints",complex:!0,finish:!0,payload:Wt}),u({type:"passPuzzle"})},[B,u,k]),Re=G.useCallback(()=>{N(""),C(!1),A(!1),u({type:"hidePuzzleButtons",payload:!1})},[u]),Ee=G.useCallback((zt,Wt=!1)=>{zt&&N(zt),Wt&&C(!0),A(!0),u({type:"hidePuzzleButtons",payload:!0}),it()},[u,it]),xn=G.useCallback(()=>{n.solution.right.desc&&(it(),N(n.solution.right.desc));const zt=Ae(B,n.solution.right.rewards);L([...zt]),Ee(null,!0)},[B,n.solution.right.desc,n.solution.right.rewards,it,Ee]),hn=G.useCallback((zt,Wt)=>{const fe=i==null?void 0:i.correctFeedbacks.find(Pt=>Pt.id===zt.id),_e=Ae(B,fe.rewards);L([..._e]),fe.desc&&Ee(fe.desc,!0),!fe.desc&&Wt&&Ee(null,!0)},[B,Ee,i==null?void 0:i.correctFeedbacks]),Ft=G.useCallback(()=>{var Wt;const zt=Ae(B,n.solution.wrong.rewards);L([...zt]),n.solution.wrong.desc&&Ee((Wt=n.solution.wrong)==null?void 0:Wt.desc,!1)},[B,n.solution.wrong.desc,n.solution.wrong.rewards,Ee]),ne=(zt,Wt)=>{setTimeout(()=>{Wt.classList.remove("sort-draggable-item--error"),Wt.classList.add("sort-draggable-item--resetting"),Wt.style.setProperty("transform",zt.transform),setTimeout(()=>Wt.classList.remove("sort-draggable-item--resetting"),1e3)},1e3)},he=zt=>{if(zt==="none")return{x:0,y:0};const fe=zt.replace("matrix(","").replace("matrix3d(","").replace(")","").split(", ");return fe.length===6?{x:parseFloat(fe[4]),y:parseFloat(fe[5])}:fe.length===16?{x:parseFloat(fe[12]),y:parseFloat(fe[13])}:{x:0,y:0}},Lt=G.useRef(),qt=G.useRef(),te=G.useRef(),Ie=G.useRef(),Je=(zt,Wt)=>{Lt.current=Wt;const fe=zt.currentTarget;fe.classList.add("sort-draggable-item--dragging");const _e=zt.touches?zt.touches[0].clientX:zt.clientX,Pt=zt.touches?zt.touches[0].clientY:zt.clientY;qt.current=_e,te.current=Pt;const Yt=window.getComputedStyle(fe).getPropertyValue("transform");Ie.current=he(Yt)},Gt=G.useCallback((zt,Wt)=>{if(Lt.current&&Lt.current===Wt){const fe=Ct.current.clientHeight/kt.current.clientHeight,_e=I.current[Wt],Pt=_e.getBoundingClientRect(),Zt=_e.parentElement.getBoundingClientRect(),we=(zt.touches?zt.touches[0].clientX:zt.clientX)-qt.current,ce=(zt.touches?zt.touches[0].clientY:zt.clientY)-te.current,fn=(Zt.width-Pt.width)/fe,xi=(Zt.height-Pt.height)/fe,$n=Math.min(Math.max(Ie.current.x+we/fe,0),fn),is=Math.min(Math.max(Ie.current.y+ce/fe,0),xi);_e.style.transform=`translate(${$n}px, ${is}px)`}},[]),ee=(zt,Wt)=>{const _e=I.current[zt].getBoundingClientRect(),Pt=Jt.current.find(Zt=>Zt.id===Wt&&!(_e.left>=Zt.right||_e.right<=Zt.left||_e.top>=Zt.bottom||_e.bottom<=Zt.top)),Yt=Jt.current.find(Zt=>Zt.id!==Wt&&!(_e.left>=Zt.right||_e.right<=Zt.left||_e.top>=Zt.bottom||_e.bottom<=Zt.top));return Pt?"correctArea":Yt?"incorrectArea":"neutral"},pe=G.useCallback(zt=>{if(Lt.current&&Lt.current===zt){k("click-ui");const Wt=I.current[zt],fe=c.find(_e=>zt===_e.id);if(qt.current=null,te.current=null,Wt.classList.remove("sort-draggable-item--dragging"),Lt.current=null,g!=="resolveMode"){const _e=ee(zt,fe.destination.id);if(_e==="correctArea"){if(g==="anyItemResolver"){k("score"),it(),Wt.classList.add("sort-draggable-item--success");const Pt=!0;O(Pt),i.specificCorrectFeedbacks?hn(fe,Pt):xn()}if(g==="matchMode")if(k("score"),Wt.classList.add("sort-draggable-item--success"),Tt.current.find(Yt=>Yt.id===fe.destination.id).acceptedItems.push(fe.id),i.specificCorrectFeedbacks){const Yt=yt(Tt,bt);Yt&&O(!0),hn(fe,Yt)}else yt(Tt,bt)&&(O(!0),xn())}else if(_e==="incorrectArea"&&(g==="anyItemResolver"||g==="matchMode")){if(k("fail"),Wt.classList.add("sort-draggable-item--error"),i.specificWrongFeedbacks){const Pt=i==null?void 0:i.wrongFeedbacks.find(Zt=>Zt.id===fe.id),Yt=Ae(B,Pt.rewards);L([...Yt]),Pt.desc&&Ee(Pt.desc,!1)}else Ft();ne(fe,Wt)}}}},[B,c,xn,Ft,hn,it,k,Ee,i.specificCorrectFeedbacks,i.specificWrongFeedbacks,i==null?void 0:i.wrongFeedbacks,g]),En=()=>{let zt=!1;it(),c.forEach(Wt=>{const fe=I.current[Wt.id];if(Wt.destination.id)ee(Wt.id,Wt.destination.id)!=="correctArea"?(zt=!0,fe.classList.add("sort-draggable-item--error"),ne(Wt,fe)):fe.classList.add("sort-draggable-item--success");else{const _e=fe.getBoundingClientRect();Jt.current.find(Yt=>!(_e.left>=Yt.right||_e.right<=Yt.left||_e.top>=Yt.bottom||_e.bottom<=Yt.top))&&(zt=!0,fe.classList.add("sort-draggable-item--error"),ne(Wt,fe))}}),zt?(k("fail"),Ft()):(k("score"),O(!0),xn())},ue=()=>{c.forEach(zt=>{const Wt=I.current[zt.id];Wt.classList.remove("sort-draggable-item--error"),Wt.classList.remove("sort-draggable-item--success"),Wt.classList.add("sort-draggable-item--resetting"),Wt.style.setProperty("transform",zt.transform),setTimeout(()=>Wt.classList.remove("sort-draggable-item--resetting"),1e3)})},me=()=>{Re(),nt&&(lt(),ue(),Z(!0)),!nt&&!M&&dt(),M&&Ze()};G.useEffect(()=>{r(()=>{k("score"),it(),C(!0),N(n.solution.right.desc);const zt=[...B,...n.resolve.rewards];Re(),u({type:"puzzleAction",action:"resolve",payload:{element:x,rewards:zt,finish:!0}})})},[B,u,n.resolve.rewards,n.solution.right.desc,it,k,x,Re,r]),G.useEffect(()=>{if(!Ct.current||!kt.current)return;const zt=fe=>Gt(fe,Lt.current),Wt=()=>pe(Lt.current);return document.addEventListener("mousemove",zt),document.addEventListener("mouseup",Wt),document.addEventListener("touchmove",zt,{passive:!1}),document.addEventListener("touchend",Wt),()=>{document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",Wt),document.removeEventListener("touchmove",zt),document.removeEventListener("touchend",Wt)}},[pe,Gt]);const Dn={backgroundImage:(jn=f==null?void 0:f.img)!=null&&jn.url?`url('${(Si=f==null?void 0:f.img)==null?void 0:Si.url}')`:""};return P.jsxs("div",{ref:Ct,className:"sort-wrapper",children:[P.jsxs("div",{ref:kt,className:"sort-puzzle",style:Dn,children:[d.map(zt=>P.jsxs("div",{id:`${zt.id}`,className:"sort-no-draggable-item",style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`,"--backgroundColor":`${zt.backgroundColor}`,borderRadius:`${zt.borderRadius}`},children:[zt.imgId&&P.jsx("img",{src:zt.img.url,alt:zt.img.name}),zt.text&&bi(zt.text)]},zt.id)),l.map(zt=>P.jsx("div",{ref:Wt=>{H.current[zt.id]=Wt},id:zt.id,className:`sort-destination-area ${m?"sort-destination-area--revelable":""}`,style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`}},zt.id)),c.map(zt=>P.jsxs("div",{ref:Wt=>{I.current[zt.id]=Wt},id:`${zt.id}`,className:"sort-draggable-item",onMouseDown:Wt=>Je(Wt,zt.id),onTouchStart:Wt=>Je(Wt,zt.id),style:{"--height":`${zt.heightInPercentage}%`,"--width":`${zt.widthInPercentage}%`,"--transform":`${zt.transform}`,"--backgroundColor":`${zt.backgroundColor}`,borderRadius:`${zt.borderRadius}`},children:[zt.imgId&&P.jsx("img",{src:zt.img.url,alt:zt.img.name}),zt.text&&bi(zt.text)]},zt.id))]}),g==="resolveMode"&&P.jsx("button",{type:"button",onClick:()=>{En()},className:"gat--btn gat--btn__primary sort-resolve-button",children:P.jsx("span",{children:y("storylines.misc.check")})}),_>0&&W&&P.jsx(ZU,{buttonLabel:X,translate:y,onClose:xt}),T&&P.jsx(fd,{success:E,text:R,translate:y,timeExpired:nt,functionOnClose:me,keyboardControl:S}),_>0&&P.jsx(JU,{topRight:!0,initialSeconds:_,isPaused:$,shouldStart:ut,shouldReset:ot,onTimeOver:vt})]})}exports.AnimationComponent=dnt;exports.AutoEvaluationComponent=jtt;exports.CameraChangeContext=m9;exports.CameraChangeProvider=FY;exports.CardsSelectorPuzzleComponent=att;exports.CartelComponent=gX;exports.ChainedImageClickPuzzleComponent=R$;exports.ChangeCamera=g9;exports.ComicComponent=pX;exports.ConversationalComponent=cX;exports.ConversationalProComponent=uX;exports.CrackerPuzzleComponent=v$;exports.DecisionComponent=M9;exports.DialogComponent=ont;exports.DragItemPuzzleComponent=btt;exports.DragToSceneComponent=vnt;exports.FrameImageClickComponent=O$;exports.HackerPuzzleComponent=SX;exports.HangedPuzzleComponent=A$;exports.ImageClickPuzzleComponent=s$;exports.ImageComponent=aX;exports.InventoryItem=PH;exports.KeyboardPuzzleComponent=TX;exports.LecturesComponent=XK;exports.LoginPuzzleComponent=EX;exports.MatchPuzzleComponent=ynt;exports.NoticeComponent=RH;exports.PatternComponent=ztt;exports.PdfComponent=SY;exports.PdfVisor=v5;exports.ProgressRing=WI;exports.ReferralComponent=mnt;exports.SortPuzzleComponent=_nt;exports.SurveyComponent=Ntt;exports.TerminalPuzzleComponent=_tt;exports.TestComponent=Ctt;exports.TextClickPuzzleComponent=Btt;exports.UrlComponent=xY;exports.VideoComponent=BY;exports.VideoVisor=y5;exports.WebBuilderPuzzleComponent=W$;exports.WriterPuzzleComponent=ftt;exports.useCameraChange=mk;
335
335
  //# sourceMappingURL=arcade-components.cjs.map