"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[782],{91720:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(45992),r=n(62772),i=n(17588),o=n(97690);const s=e=>({transform:`${e.preTransforms.join(" ")} scale(${e.scale}) rotateX(${e.rotateX}deg) rotateY(${e.rotateY}deg) ${(0,o.Y)(e.rotateZ)}`,transition:e.transitions.join(", "),filter:e.filters.join(" ")});const l=e=>{const[t,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(void 0),[l,c]=(0,i.useState)(void 0),[d,u]=(0,i.useState)(!1),f=(0,i.useRef)(null),h=(0,i.useCallback)((e=>{f.current=e,n(e)}),[]);(0,i.useEffect)((()=>{e&&(o(void 0),c(void 0),u(!1))}),[e]);const m=(0,i.useCallback)((n=>{if(!t||e)return;u(!0);const a=t.getBoundingClientRect(),r=(n.clientX-a.left)/a.width,i=(n.clientY-a.top)/a.height,s={coords:{x:Math.min(Math.max(r,0),1),y:Math.min(Math.max(i,0),1)}};o(s),d||c(s)}),[t,d,e]),p=(0,i.useCallback)((()=>{o(void 0),u(!1)}),[]),{innerCardStyle:g,specialFxLayerStyles:b}=function(e){let{hoveringState:t}=e;const n={scale:1,rotateX:0,rotateY:0,rotateZ:0,preTransforms:[],transitions:[],filters:[]};n.rotateZ+=0;const a=[],r=e=>{var t;return null!==(t=a[e])&&void 0!==t||(a[e]={scale:1,rotateX:0,rotateY:0,rotateZ:0,preTransforms:[],transitions:[],filters:[]}),a[e]},i="perspective(1500px)",o=r(0),l=r(1),c="cubic-bezier(0.89, -0.3, 0.18, 1.37)";n.transitions.push(`transform 400ms ${c}`),o.transitions.push("transform 100ms linear"),l.transitions.push(`filter 400ms ${c}`);const d=e=>`drop-shadow(rgba(0, 15, 51, ${e}) 0px 1px 8px)`;if(t){n.preTransforms.push(i),o.preTransforms.push(i),l.filters.push(d(.3)),n.scale+=.05;const{coords:e}=t,a=20;o.rotateX+=a*-(e.y-.5),o.rotateY+=a*(e.x-.5)}else l.filters.push(d(0));return{specialFxLayerStyles:a.filter((e=>!!e)).map((e=>Object.assign(Object.assign({},s(e)),{top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"}))),innerCardStyle:Object.assign({},s(n))}}({hoveringState:!r&&d?l:r}),v=(e,t)=>0===t.length?e:(0,a.jsx)("div",{style:t[0],children:v(e,t.slice(1))});return{handleMouseEnterOrMove:m,handleMouseLeave:p,innerCardStyle:g,specialFxLayerStyles:b,setCardRef:h,wrapInsideStyledCard:v}};var c=n(11833);const d=e=>{let{title:t,frontImageSrc:n,coverImageSrc:i,fitImages:o,flipped:s,burned:d,onClick:u}=e;const f=Boolean(d),h=Boolean(s),{handleMouseEnterOrMove:m,handleMouseLeave:p,innerCardStyle:g,setCardRef:b,specialFxLayerStyles:v,wrapInsideStyledCard:y}=l(h);return y((0,a.jsxs)(c.Ox,{onMouseMove:m,onMouseEnter:m,onMouseLeave:p,role:"button",style:h?g:{},$burned:f,$flipped:h,ref:b,onClick:e=>{e.stopPropagation(),u&&u()},"aria-label":`Card showing ${h?"front":"back"} side with title: ${t}`,"aria-disabled":f,tabIndex:f?-1:0,children:[(0,a.jsx)("img",{style:{opacity:h?1:0,position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:o?"contain":"cover",transition:`opacity ${c.uD}ms steps(1)`},src:n,alt:"front"}),(0,a.jsx)("img",{style:{opacity:h?0:1,position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:o?"contain":"cover",transition:`opacity ${c.uD}ms steps(1)`},src:i,alt:"cover"}),t&&(0,a.jsx)(c.aW,{hidden:!h,children:(0,a.jsx)(r.m_,{text:t,placement:r.m_.Position.TOP,fallbackPlacements:[r.m_.Position.TOP],renderReferencePortalNode:document.querySelector("body"),children:(0,a.jsx)(c.hE,{"data-testid":"card-title",children:t})})})]}),v)}},11833:(e,t,n)=>{n.d(t,{Ox:()=>l,aW:()=>o,hE:()=>s,rl:()=>r,uD:()=>i});var a=n(37577);const r=1e3,i=r/3.4,o=a.Ay.div({display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,position:"absolute",paddingLeft:"12px",paddingRight:"12px",bottom:0,left:0,userSelect:"none",minHeight:"25%",top:"75%",width:"100%",backgroundColor:"rgba(18,18,18,0.5)"}),s=a.Ay.p({color:"white",fontSize:12,textAlign:"center",fontStyle:"normal",fontWeight:400,lineHeight:"16px",overflow:"hidden",textOverflow:"ellipsis",wordWrap:"break-word",whiteSpace:"nowrap",pointerEvents:"none"}),l=a.Ay.div`
  @keyframes rotate-out {
    0% {
      transform: rotateY(0deg);
    }
    33% {
      transform: rotateY(90deg);
    }
    100% {
      transform: rotateY(0deg);
    }
  }

  @keyframes rotate-in {
    0% {
      transform: rotateY(0deg);
    }
    33% {
      transform: rotateY(90deg);
    }
    100% {
      transform: rotateY(0deg);
    }
  }

  @keyframes pulse {
    0% {
      transform: scale(1);
    }
    12% {
      transform: scale(1.05, 1.05);
    }
    40% {
      transform: scale(1.05, 1.05);
    }
    100% {
      transform: scale(1);
    }
  }

  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 100%;
  height: 100%;

  cursor: ${e=>{let{$flipped:t,$burned:n}=e;return t||n?"default":"pointer"}};

  animation-name: ${e=>{let{$flipped:t}=e;return t?"rotate-out":"rotate-in"}}
    ${e=>{let{$burned:t}=e;return t?",pulse":""}};
  animation-duration: ${r}ms;
  animation-delay: 0ms, ${r}ms;
  animation-iteration-count: 1;
  animation-timing-function: ease-out, ease-in-out;
  perspective: 1500px;

  border-radius: ${e=>{let{theme:t}=e;return t.borderRadius.large}};

  /* HACK: We need to set border as important because .genially-embed is reseting our borders in the View */
  border: 1px solid
    ${e=>{let{theme:t,$flipped:n}=e;return n?t.color.border.primary.disabled():t.color.border.primary.default()}} !important;
  outline: 1px white solid;

  filter: ${e=>{let{$flipped:t}=e;return t?"":"drop-shadow(0px 1px 4px rgba(0, 15, 51, 0.2))"}};

  &:hover {
    filter: ${e=>{let{$flipped:t}=e;return t?"":"drop-shadow(rgba(0, 15, 51, 0.3) 0px 1px 8px)"}};
    border-color: ${e=>{let{theme:t,$flipped:n}=e;return n?t.color.border.primary.disabled():t.color.border.primary.hover()}} !important;
  }

  ${o} {
    visibility: ${e=>{let{$flipped:t}=e;return t?"initial":"hidden"}};
    transition: visibility ${i}ms steps(1);
    z-index: 1;
  }

  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: ${e=>{let{$burned:t}=e;return t?"0.4":"0"}};
    transition: opacity ${r}ms steps(1);
    transition-delay: ${r}ms;
    background-color: white;
    pointer-events: none;
  }
`},63110:(e,t,n)=>{n.d(t,{x:()=>l});var a=n(45992),r=n(40671),i=n(99049),o=n(76838),s=n(67333);const l=e=>{let{items:t,renderItem:n,keyExtractor:l,getComputedStyles:c}=e;const d=(0,o.f)(t.length);return(0,a.jsx)(s.x,{numColumns:d.numColumns,numRows:d.numRows,children:(0,a.jsx)(r.N,{children:t.map(((e,t)=>(0,a.jsx)(i.P.div,{layout:!0,style:c?c(e,t):void 0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},transition:{type:"spring",ease:"linear",stiffness:150,damping:20},"data-testid":`grid-item-${l(e)}`,children:n(e)},l(e))))})})}},67333:(e,t,n)=>{n.d(t,{m:()=>i,x:()=>r});var a=n(37577);const r=a.Ay.div`
  display: grid;
  grid-template-columns: repeat(${e=>e.numColumns}, minmax(0, 1fr));
  grid-template-rows: repeat(${e=>e.numRows}, 1fr);
  height: 100%;
  gap: 16px;
  padding: 8px;
  perspective: 1500px;
`,i=a.Ay.canvas({width:"100%",height:"100%",pointerEvents:"none",position:"absolute",top:0,left:0,zIndex:3})},76838:(e,t,n)=>{n.d(t,{f:()=>a});const a=e=>{let t=4;for(;e%t!==0;)t+=1;return{numColumns:t,numRows:e/t}}},70782:(e,t,n)=>{n.r(t),n.d(t,{geniallyFindThePairViewScript:()=>M});var a=n(45992),r=n(54072),i=n(41381),o=n(17588),s={};!function e(t,n,a,r){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o="function"===typeof Path2D&&"function"===typeof DOMMatrix,s=function(){if(!t.OffscreenCanvas)return!1;var e=new OffscreenCanvas(1,1),n=e.getContext("2d");n.fillRect(0,0,1,1);var a=e.transferToImageBitmap();try{n.createPattern(a,"no-repeat")}catch(r){return!1}return!0}();function l(){}function c(e){var a=n.exports.Promise,r=void 0!==a?a:t.Promise;return"function"===typeof r?new r(e):(e(l,l),null)}var d,u,f,h=(d=s,u=new Map,{transform:function(e){if(d)return e;if(u.has(e))return u.get(e);var t=new OffscreenCanvas(e.width,e.height);return t.getContext("2d").drawImage(e,0,0),u.set(e,t),t},clear:function(){u.clear()}}),m=function(){var e,t,n=Math.floor(1e3/60),a={},r=0;return"function"===typeof requestAnimationFrame&&"function"===typeof cancelAnimationFrame?(e=function(e){var t=Math.random();return a[t]=requestAnimationFrame((function i(o){r===o||r+n-1<o?(r=o,delete a[t],e()):a[t]=requestAnimationFrame(i)})),t},t=function(e){a[e]&&cancelAnimationFrame(a[e])}):(e=function(e){return setTimeout(e,n)},t=function(e){return clearTimeout(e)}),{frame:e,cancel:t}}(),p=function(){var t,n,r={};return function(){if(t)return t;if(!a&&i){var o=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {","  if (msg.data.options) {","    CONFETTI(msg.data.options).then(function () {","      if (msg.data.callback) {","        postMessage({ callback: msg.data.callback });","      }","    });","  } else if (msg.data.reset) {","    CONFETTI && CONFETTI.reset();","  } else if (msg.data.resize) {","    SIZE.width = msg.data.resize.width;","    SIZE.height = msg.data.resize.height;","  } else if (msg.data.canvas) {","    SIZE.width = msg.data.canvas.width;","    SIZE.height = msg.data.canvas.height;","    CONFETTI = module.exports.create(msg.data.canvas);","  }","}"].join("\n");try{t=new Worker(URL.createObjectURL(new Blob([o])))}catch(s){return void 0!==typeof console&&"function"===typeof console.warn&&console.warn("\ud83c\udf8a Could not load worker",s),null}!function(e){function t(t,n){e.postMessage({options:t||{},callback:n})}e.init=function(t){var n=t.transferControlToOffscreen();e.postMessage({canvas:n},[n])},e.fire=function(a,i,o){if(n)return t(a,null),n;var s=Math.random().toString(36).slice(2);return n=c((function(i){function l(t){t.data.callback===s&&(delete r[s],e.removeEventListener("message",l),n=null,h.clear(),o(),i())}e.addEventListener("message",l),t(a,s),r[s]=l.bind(null,{data:{callback:s}})}))},e.reset=function(){for(var t in e.postMessage({reset:!0}),r)r[t](),delete r[t]}}(t)}return t}}(),g={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function b(e,t,n){return function(e,t){return t?t(e):e}(e&&(null!==(a=e[t])&&void 0!==a)?e[t]:g[t],n);var a}function v(e){return e<0?0:Math.floor(e)}function y(e){return parseInt(e,16)}function x(e){return e.map(w)}function w(e){var t=String(e).replace(/[^0-9a-f]/gi,"");return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:y(t.substring(0,2)),g:y(t.substring(2,4)),b:y(t.substring(4,6))}}function M(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function C(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function S(e){var t=e.angle*(Math.PI/180),n=e.spread*(Math.PI/180);return{x:e.x,y:e.y,wobble:10*Math.random(),wobbleSpeed:Math.min(.11,.1*Math.random()+.05),velocity:.5*e.startVelocity+Math.random()*e.startVelocity,angle2D:-t+(.5*n-Math.random()*n),tiltAngle:(.5*Math.random()+.25)*Math.PI,color:e.color,shape:e.shape,tick:0,totalTicks:e.ticks,decay:e.decay,drift:e.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:3*e.gravity,ovalScalar:.6,scalar:e.scalar,flat:e.flat}}function E(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,a=t.x+t.random*t.tiltCos,r=t.y+t.random*t.tiltSin,i=t.wobbleX+t.random*t.tiltCos,s=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+(1-n)+")",e.beginPath(),o&&"path"===t.shape.type&&"string"===typeof t.shape.path&&Array.isArray(t.shape.matrix))e.fill(function(e,t,n,a,r,i,o){var s=new Path2D(e),l=new Path2D;l.addPath(s,new DOMMatrix(t));var c=new Path2D;return c.addPath(l,new DOMMatrix([Math.cos(o)*r,Math.sin(o)*r,-Math.sin(o)*i,Math.cos(o)*i,n,a])),c}(t.shape.path,t.shape.matrix,t.x,t.y,.1*Math.abs(i-a),.1*Math.abs(s-r),Math.PI/10*t.wobble));else if("bitmap"===t.shape.type){var l=Math.PI/10*t.wobble,c=.1*Math.abs(i-a),d=.1*Math.abs(s-r),u=t.shape.bitmap.width*t.scalar,f=t.shape.bitmap.height*t.scalar,m=new DOMMatrix([Math.cos(l)*c,Math.sin(l)*c,-Math.sin(l)*d,Math.cos(l)*d,t.x,t.y]);m.multiplySelf(new DOMMatrix(t.shape.matrix));var p=e.createPattern(h.transform(t.shape.bitmap),"no-repeat");p.setTransform(m),e.globalAlpha=1-n,e.fillStyle=p,e.fillRect(t.x-u/2,t.y-f/2,u,f),e.globalAlpha=1}else if("circle"===t.shape)e.ellipse?e.ellipse(t.x,t.y,Math.abs(i-a)*t.ovalScalar,Math.abs(s-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):function(e,t,n,a,r,i,o,s,l){e.save(),e.translate(t,n),e.rotate(i),e.scale(a,r),e.arc(0,0,1,o,s,l),e.restore()}(e,t.x,t.y,Math.abs(i-a)*t.ovalScalar,Math.abs(s-r)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if("star"===t.shape)for(var g=Math.PI/2*3,b=4*t.scalar,v=8*t.scalar,y=t.x,x=t.y,w=5,M=Math.PI/w;w--;)y=t.x+Math.cos(g)*v,x=t.y+Math.sin(g)*v,e.lineTo(y,x),g+=M,y=t.x+Math.cos(g)*b,x=t.y+Math.sin(g)*b,e.lineTo(y,x),g+=M;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(r)),e.lineTo(Math.floor(i),Math.floor(s)),e.lineTo(Math.floor(a),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function I(e,n){var o,s=!e,l=!!b(n||{},"resize"),d=!1,u=b(n,"disableForReducedMotion",Boolean),f=i&&!!b(n||{},"useWorker")?p():null,g=s?M:C,y=!(!e||!f)&&!!e.__confetti_initialized,w="function"===typeof matchMedia&&matchMedia("(prefers-reduced-motion)").matches;function I(t,n,i){for(var s,l,d=b(t,"particleCount",v),u=b(t,"angle",Number),f=b(t,"spread",Number),p=b(t,"startVelocity",Number),y=b(t,"decay",Number),w=b(t,"gravity",Number),M=b(t,"drift",Number),C=b(t,"colors",x),I=b(t,"ticks",Number),O=b(t,"shapes"),j=b(t,"scalar"),T=!!b(t,"flat"),k=function(e){var t=b(e,"origin",Object);return t.x=b(t,"x",Number),t.y=b(t,"y",Number),t}(t),P=d,$=[],F=e.width*k.x,A=e.height*k.y;P--;)$.push(S({x:F,y:A,angle:u,spread:f,startVelocity:p,color:C[P%C.length],shape:O[(s=0,l=O.length,Math.floor(Math.random()*(l-s))+s)],ticks:I,decay:y,gravity:w,drift:M,scalar:j,flat:T}));return o?o.addFettis($):(o=function(e,t,n,i,o){var s,l,d=t.slice(),u=e.getContext("2d"),f=c((function(t){function c(){s=l=null,u.clearRect(0,0,i.width,i.height),h.clear(),o(),t()}s=m.frame((function t(){!a||i.width===r.width&&i.height===r.height||(i.width=e.width=r.width,i.height=e.height=r.height),i.width||i.height||(n(e),i.width=e.width,i.height=e.height),u.clearRect(0,0,i.width,i.height),(d=d.filter((function(e){return E(u,e)}))).length?s=m.frame(t):c()})),l=c}));return{addFettis:function(e){return d=d.concat(e),f},canvas:e,promise:f,reset:function(){s&&m.cancel(s),l&&l()}}}(e,$,g,n,i),o.promise)}function O(n){var a=u||b(n,"disableForReducedMotion",Boolean),r=b(n,"zIndex",Number);if(a&&w)return c((function(e){e()}));s&&o?e=o.canvas:s&&!e&&(e=function(e){var t=document.createElement("canvas");return t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.pointerEvents="none",t.style.zIndex=e,t}(r),document.body.appendChild(e)),l&&!y&&g(e);var i={width:e.width,height:e.height};function h(){if(f){var t={getBoundingClientRect:function(){if(!s)return e.getBoundingClientRect()}};return g(t),void f.postMessage({resize:{width:t.width,height:t.height}})}i.width=i.height=null}function m(){o=null,l&&(d=!1,t.removeEventListener("resize",h)),s&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,y=!1)}return f&&!y&&f.init(e),y=!0,f&&(e.__confetti_initialized=!0),l&&!d&&(d=!0,t.addEventListener("resize",h,!1)),f?f.fire(n,i,m):I(n,i,m)}return O.reset=function(){f&&f.reset(),o&&o.reset()},O}function O(){return f||(f=I(null,{useWorker:!0,resize:!0})),f}n.exports=function(){return O().apply(this,arguments)},n.exports.reset=function(){O().reset()},n.exports.create=I,n.exports.shapeFromPath=function(e){if(!o)throw new Error("path confetti are not supported in this browser");var t,n;"string"===typeof e?t=e:(t=e.path,n=e.matrix);var a=new Path2D(t),r=document.createElement("canvas").getContext("2d");if(!n){for(var i,s,l=1e3,c=l,d=l,u=0,f=0,h=0;h<l;h+=2)for(var m=0;m<l;m+=2)r.isPointInPath(a,h,m,"nonzero")&&(c=Math.min(c,h),d=Math.min(d,m),u=Math.max(u,h),f=Math.max(f,m));i=u-c,s=f-d;var p=Math.min(10/i,10/s);n=[p,0,0,p,-Math.round(i/2+c)*p,-Math.round(s/2+d)*p]}return{type:"path",path:t,matrix:n}},n.exports.shapeFromText=function(e){var t,n=1,a="#000000",r='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';"string"===typeof e?t=e:(t=e.text,n="scalar"in e?e.scalar:n,r="fontFamily"in e?e.fontFamily:r,a="color"in e?e.color:a);var i=10*n,o=i+"px "+r,s=new OffscreenCanvas(i,i),l=s.getContext("2d");l.font=o;var c=l.measureText(t),d=Math.ceil(c.actualBoundingBoxRight+c.actualBoundingBoxLeft),u=Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent),f=c.actualBoundingBoxLeft+2,h=c.actualBoundingBoxAscent+2;d+=4,u+=4,(l=(s=new OffscreenCanvas(d,u)).getContext("2d")).font=o,l.fillStyle=a,l.fillText(t,f,h);var m=1/n;return{type:"bitmap",bitmap:s.transferToImageBitmap(),matrix:[m,0,0,m,-d*m/2,-u*m/2]}}}(function(){return"undefined"!==typeof window?window:"undefined"!==typeof self?self:this||{}}(),s,!1);const l=s.exports;s.exports.create;var c=n(37577),d=n(91720),u=n(63110);var f;!function(e){e.FACEDOWN="faceDown",e.FACEUP="faceUp",e.BURNED="burned"}(f||(f={}));const h=e=>`${e}-original`,m=e=>`${e}-pair`;var p=n(11833),g=n(67333);const b=(e,t)=>{const n=e%2===1,a=t%2===1;return n&&!a?1:!n&&a?-1:e-t},v=e=>{let{theme:t,images:n,coverImageSrc:r,fitImages:i,onSuccess:s,onFailure:v}=e;const y=(0,o.useRef)(),{shuffledCards:x,isFaceUp:w,isBurned:M,onPick:C}=((e,t,n,a)=>{const r=(0,o.useMemo)((()=>{const t=e.flatMap((e=>[Object.assign(Object.assign({},e),{id:h(e.id),pairId:m(e.id)}),Object.assign(Object.assign({},e),{id:m(e.id),pairId:h(e.id)})]));for(let e=t.length-1;e>0;e-=1){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}),[e]),[i,s]=(0,o.useState)((()=>{const e=new Map;return r.forEach((t=>{e.set(t.id,{id:t.id,status:f.FACEDOWN,pairId:t.pairId})})),e})),l=(0,o.useCallback)((e=>{var t;return(null===(t=i.get(e))||void 0===t?void 0:t.status)===f.FACEUP}),[i]),c=(0,o.useCallback)((e=>{var t;return(null===(t=i.get(e))||void 0===t?void 0:t.status)===f.BURNED}),[i]);return{shuffledCards:r,isFaceUp:l,isBurned:c,onPick:e=>{const r=i.get(e);if(r.status!==f.FACEDOWN)return;const o=[...i.values()].filter((e=>e.status===f.FACEUP));if(0===o.length)i.set(r.id,Object.assign(Object.assign({},r),{status:f.FACEUP}));else if(1===o.length){const e=o[0];e.pairId===r.id?(i.set(e.id,Object.assign(Object.assign({},e),{status:f.BURNED})),i.set(r.id,Object.assign(Object.assign({},r),{status:f.BURNED})),t()):(i.set(r.id,Object.assign(Object.assign({},r),{status:f.FACEUP})),n())}else 2===o.length&&(o.forEach((e=>{i.set(e.id,Object.assign(Object.assign({},e),{status:f.FACEDOWN}))})),i.set(r.id,Object.assign(Object.assign({},r),{status:f.FACEUP})));s(new Map(i)),[...i.values()].every((e=>e.status===f.BURNED))&&a()}}})(n,(()=>{setTimeout((()=>{s()}),p.rl)}),(()=>{setTimeout((()=>{v()}),p.rl)}),(()=>{setTimeout((()=>{var e;e=y,l.create(e.current,{resize:!0})(Object.assign(Object.assign({},{particleCount:150,startVelocity:20,spread:150,ticks:60,zIndex:0,disableForReducedMotion:!0}),{disableForReducedMotion:!0,shapes:["circle"]}))}),p.rl)})),[S,E]=(0,o.useState)((()=>Array.from({length:x.length},((e,t)=>t))));return(0,o.useEffect)((()=>{const e=setTimeout((()=>{E((e=>[...e].sort(b).reverse()))}),p.rl);return()=>clearTimeout(e)}),[]),(0,a.jsxs)(c.NP,{theme:t,children:[(0,a.jsx)(g.m,{ref:y}),(0,a.jsx)(u.x,{items:x,renderItem:e=>(0,a.jsx)(d.Z,{title:e.title,frontImageSrc:e.src,coverImageSrc:r,fitImages:i,flipped:w(e.id)||M(e.id),burned:M(e.id),onClick:()=>C(e.id)}),keyExtractor:e=>e.id,getComputedStyles:(e,t)=>({order:S[t]})})]})},y=e=>null!==e,x="https://audios.genial.ly/59e059d30b9c21060cb4c2ec/de8b3efe-c4df-48ff-8bbb-2b3e940663d3.wav",w="https://audios.genial.ly/59e059d30b9c21060cb4c2ec/23fe908b-44e2-4972-981f-d857c429b126.wav",M=(e,t)=>{const{itemList:n}=e.config,o=n.map((e=>null===e.image.source?null:{src:e.image.source,title:e.title,id:(0,r.Ak)()})).filter(y);(0,i.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderApp:()=>{const{coverImage:n,fitImages:r}=e.config;t.preloadAudio(x),t.preloadAudio(w);const i=()=>{t.playAudio({source:x})},s=()=>{t.playAudio({source:w})};return()=>(0,a.jsx)(v,{theme:t.theme,images:o,coverImageSrc:String(n.source),fitImages:r,onSuccess:i,onFailure:s})}})(e,t)}},41381:(e,t,n)=>{n.d(t,{p:()=>o});var a=n(70377),r=n(66264),i=n(60708);function o(e){let{getTargetNodeItem:t,renderApp:n,initialState:o}=e,s=!1;const l=[],c=e=>{l.push(e)};return e=>{const d=t(e.config),u=null===d||void 0===d?void 0:d.parentSlide;function f(){if(!d)return;let e=null;if("idOfFreeNode"in d)e=document.getElementById(d.idOfFreeNode);else{const t=document.createElement("div");t.innerHTML=d.source;let n=t.getElementsByClassName("genially-widget-app");n.length||(n=t.getElementsByClassName("genially-widget-gallery"));const{id:a}=n[0];if(!a)return;e=document.getElementById(a)}if(e){const t=r=>{if(s){const i=n({setState:t,onUnmount:c});a.render(i(r),e)}else console.warn('"rerender" was called when the widget was already unmounted. This is a no-op. Did you forget to dispose of an event handler with "onUnmount"?')};s=!0,t(o),l.push((()=>{a.unmountComponentAtNode(e)}))}}function h(){s=!1,l.forEach((e=>{e()})),l.length=0}null===d||void 0===d||d.on(r.q.Mount,(()=>{f()})),null===d||void 0===d||d.on(r.q.Unmount,(()=>{h()})),d&&"isTransversal"in d&&d.isTransversal?f():null===u||void 0===u||u.on(i.m.Entering,(()=>{s||f()})),null===u||void 0===u||u.on(i.m.Exited,(()=>{d&&"isTransversal"in d&&d.isTransversal||s&&h()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/782.6a5f4b6f.chunk.js.map