(this["webpackJsonplearn-morse-code"]=this["webpackJsonplearn-morse-code"]||[]).push([[0],[,,function(e){e.exports=JSON.parse('{"-----":"0",".----":"1","..---":"2","...--":"3","....-":"4",".....":"5","-....":"6","--...":"7","---..":"8","----.":"9",".-":"a","-...":"b","-.-.":"c","-..":"d",".":"e","..-.":"f","--.":"g","....":"h","..":"i",".---":"j","-.-":"k",".-..":"l","--":"m","-.":"n","---":"o",".--.":"p","--.-":"q",".-.":"r","...":"s","-":"t","..-":"u","...-":"v",".--":"w","-..-":"x","-.--":"y","--..":"z",".-.-.-":".","--..--":",","..--..":"?","-.-.--":"!","-....-":"-","-..-.":"/",".--.-.":"@","-.--.":"(","-.--.-":")",".----.":"\'",".-..-.":"\\"",".-...":"&","---...":": ","-.-.-.":";","-...-":"=",".-.-.":"+","..--.-":"_","...-..-":"$"}')},function(e){e.exports=JSON.parse('{"mainVolume":0.2,"historySize":50}')},function(e){e.exports=JSON.parse('{"0":"-----","1":".----","2":"..---","3":"...--","4":"....-","5":".....","6":"-....","7":"--...","8":"---..","9":"----.","a":".-","b":"-...","c":"-.-.","d":"-..","e":".","f":"..-.","g":"--.","h":"....","i":"..","j":".---","k":"-.-","l":".-..","m":"--","n":"-.","o":"---","p":".--.","q":"--.-","r":".-.","s":"...","t":"-","u":"..-","v":"...-","w":".--","x":"-..-","y":"-.--","z":"--..",".":".-.-.-",",":"--..--","?":"..--..","!":"-.-.--","-":"-....-","/":"-..-.","@":".--.-.","(":"-.--.",")":"-.--.-","\'":".----.","\\"":".-..-.","&":".-...",":":"---...",";":"-.-.-.","=":"-...-","+":".-.-.","_":"..--.-","$":"...-..-"}')},,function(e,t,n){},function(e){e.exports=JSON.parse('{"words":["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]}')},,,function(e){e.exports=JSON.parse('{"words":["1","2","3","4","5","6","7","8","9","0"]}')},function(e){e.exports=JSON.parse('{"words":["the","be","to","of","and","a","in","that","have","I","it","for","not","on","with","he","as","you","do","at","this","but","his","by","from","they","we","say","her","she","or","an","will","my","one","all","would","there","their","what","so","up","out","if","about","who","get","which","go","me","when","make","can","like","time","no","just","him","know","take","person","into","year","your","good","some","could","them","see","other","than","then","now","look","only","come","its","over","think","also","back","after","use","two","how","our","work","first","well","way","even","new","want","because","any","these","give","day","most","us"]}')},function(e){e.exports=JSON.parse('{"words":["Liam","Noah","Elijah","Logan","Mason","James","Aiden","Ethan","Lucas","Jacob","Michael","Matthew","Benjamin","Alexander","William","Daniel","Jayden","Oliver","Carter","Sebastian","Joseph","David","Gabriel","Julian","Jackson","Anthony","Dylan","Wyatt","Grayson","Isaiah","Christopher","Joshua","Christian","Andrew","Samuel","Mateo","Jaxon","Josiah","John","Luke","Ryan","Nathan","Isaac","Owen","Henry","Levi","Aaron","Caleb","Jeremiah","Landon"]}')},function(e){e.exports=JSON.parse('{"words":["Emma","Olivia","Ava","Isabella","Sophia","Mia","Amelia","Charlotte","Abigail","Emily","Harper","Evelyn","Madison","Victoria","Sofia","Scarlett","Aria","Elizabeth","Camila","Layla","Ella","Chloe","Zoey","Penelope","Skylar","Grace","Mila","Lillian","Aaliyah","Lily","Paisley","Bella","Brooklyn","Savannah","Luna","Natalie","Ellie","Leah","Audrey","Ariana","Aurora","Zoe","Hannah","Violet","Samantha","Nora","Nevaeh","Serenity","Gabriella","Hailey"]}')},function(e){e.exports=JSON.parse('{"words":["dilithium","borg","replicator","picard","vulcan","ensign","phaser","kirk","warbird","ferengi","hypospray","tribble","sisko","starfleet","engage","holodeck","warp","enterprise","romulan","quadrant","tricorder","georgiou","futile","klingon","janeway","delta","assimilate","energize"]}')},function(e,t,n){e.exports=n.p+"static/media/straight_key.f140bc7b.jpg"},function(e,t,n){e.exports=n.p+"static/media/electronic_key.cd2cf560.jpg"},function(e,t,n){e.exports=n(23)},,,,,function(e,t,n){},function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),l=n(9),o=n.n(l),i=(n(22),n(6),n(1)),c=r.a.createContext();var s=r.a.createContext();function d(e){var t=Object(a.useState)(""),n=Object(i.a)(t,2),l=n[0],o=n[1],c=Object(a.useState)([]),d=Object(i.a)(c,2),u=d[0],m=d[1];return r.a.createElement(s.Provider,{value:{morseCharBuffer:l,morseWords:u,setMorseCharBuffer:o,setMorseWords:m}},e.children)}var u=n(5),m=n(7),h=n(10),p=n(11),f=n(12),v=n(13),E=n(14),g=r.a.createContext();function b(e){var t=Object(a.useState)("alphabet"),n=Object(i.a)(t,2),l=n[0],o=n[1],c=Object(a.useState)(10),s=Object(i.a)(c,2),d=s[0],b=s[1],y=[];switch(l){case"alphabet":y=m.words;break;case"numbers":y=h.words;break;case"boys":y=f.words;break;case"girls":y=v.words;break;case"startrek":y=E.words;break;case"common100":y=p.words;break;default:y=m.words}var w=y.length;return r.a.createElement(g.Provider,{value:{wordList:y.slice(0,d),wordListShuffled:function(e){for(var t,n,a=Object(u.a)(e),r=a.length;0!==r;)n=Math.floor(Math.random()*r),t=a[r-=1],a[r]=a[n],a[n]=t;return a}(y).slice(0,d),wordListCategory:l,setWordListCategory:o,metadata:{alphabet:{name:"Alphabet",description:"All letters of the alphabet"},numbers:{name:"Numbers",description:"0-9"},boys:{name:"Boys Names",description:"Popular Boys Names"},girls:{name:"Girls Names",description:"Popular Girls Names"},startrek:{name:"Star Trek",description:"Star Trek universe"},common100:{name:"Common Words",description:"100 Most Common Words"}},wordListCount:d,setWordListCount:b,wordListCountMax:w}},e.children)}var y=r.a.createContext();function w(e){var t,n=Object(a.useContext)(g),l=n.wordList,o=n.wordListShuffled,c=Object(a.useState)(0),s=Object(i.a)(c,2),d=s[0],u=s[1],m=Object(a.useState)("sequential"),h=Object(i.a)(m,2),p=h[0],f=h[1];return"sequential"===p?t=void 0===l[d]?[l[0]]:l[d]:"random"===p&&(t=void 0===o[d]?[o[0]]:o[d]),r.a.createElement(y.Provider,{value:{word:t,getNextWord:function(){u((function(e){return e+1}))},resetFeeder:function(){u(0)},setOrder:f}},e.children)}var C=n(2),k=r.a.createContext();function O(e){var t,n=Object(a.useState)("ready"),l=Object(i.a)(n,2),o=l[0],c=l[1],d=Object(a.useContext)(y).resetFeeder,u=Object(a.useContext)(y),m=u.word,h=u.getNextWord,p=Object(a.useContext)(s),f=p.morseCharBuffer,v=p.setMorseCharBuffer,E=f.split("_").filter((function(e){return""!==e})),g="",b=[],w=[],O=0;function L(){"completed"!==o&&(c("completed"),d(),j())}function j(){var e=document.getElementById("challenge-overlay");e.classList.remove("fade"),e.classList.remove("hide")}return"object"===typeof m?(L(),t=m[0].split("")):t=m.split(""),E.forEach((function(e,n){"_"===f.slice(-1)&&((C[E[n]]||"[?]")===t[n-O].toLowerCase()?(b.push(n-O),document.getElementById("challengeWord").childNodes[n-O].classList.add("correct")):(w.push(n),w.length>0&&(v((function(e){var t=e.split("_").filter((function(e){return""!==e}));return t.splice(w[0],1),t=t.join("_")+"_"})),w.splice(1,w.length)),O=w.length))})),b.length===t.length&&(g="correct",setTimeout((function(){v(""),E=[],w=[],O=0,null!==document.getElementById("challengeWord")&&document.getElementById("challengeWord").childNodes.forEach((function(e){e.classList="cLetter"}))}),800),setTimeout((function(){b.length>0&&(b=[],h())}),1e3)),r.a.createElement(k.Provider,{value:{challengeState:o,setChallengeState:c,startChallenge:function(){var e,t=3;document.getElementById("challengeReady").classList.add("starting"),document.getElementById("challengeReady").innerHTML='Challenge starting in'.concat(t,""),e=setInterval((function(){0===--t&&(document.getElementById("challenge-overlay").classList.add("fade"),clearInterval(e),setTimeout((function(){document.getElementById("challenge-overlay").classList.add("hide"),c("started")}),900)),document.getElementById("challengeReady").innerHTML='Challenge starting in'.concat(t,"")}),1e3)},completeChallenge:L,cancelChallenge:function(){"cancelled"!==o&&(c("cancelled"),d(),j())},challengeWordClass:g,morseArray:E,incorrectMorseIndexes:w}},e.children)}var L=r.a.createContext();function j(e){var t=Object(a.useState)(0),n=Object(i.a)(t,2),l=n[0],o=n[1],c=Object(a.useState)(!1),s=Object(i.a)(c,2),d=s[0],m=s[1],h=Object(a.useState)([]),p=Object(i.a)(h,2),f=p[0],v=p[1],E=Object(a.useContext)(k),g=E.challengeState,b=E.setChallengeState;function y(){d||(m(!0),v((function(e){return[].concat(Object(u.a)(e),[setInterval((function(){null!==document.getElementById("gameClock")?o((function(e){return e+1})):w()}),1e3)])})))}function w(){d&&(C(),m(!1))}function C(){for(var e=0;e=v&&j=E?(o((function(e){return e+"/"})),clearInterval(N),N=0,j=0):"challenge"===h&&j>=v&&(o((function(e){return e+"_"})),clearInterval(N),N=0,j=0)}),1),a()}),t))):setTimeout((function(){a()}),3*f)}))}function q(){b&&y?"left"===k?(C.push("-"),k=null):(C.push("."),C.push("-")):b&&!y?C.push("."):y&&!b&&C.push("-"),C.length>0&&function(){var e=C,t=0;for(var n in e)"."===e[n]?t+=2*f:"-"===e[n]&&(t+=4*f);function a(){w=!1,C=[],q()}var r=setTimeout((function(){a()}),t);w=!0;for(var l=function(t){T&&(e.pop(),clearTimeout(r),a()),M=M.then((function(){var n=e[t];if(n)return A(n)}))},o=0;o20&&(L=!1,clearInterval(t),e=0)}),1)}function D(){L=!1,clearInterval(t),e<10&&(T=!0,C.pop()),e=0}window.AudioContext=window.AudioContext||window.webkitAudioContext,n=B?new B:null,Object(a.useEffect)((function(){return document.addEventListener("keydown",W),document.addEventListener("keyup",P),document.querySelectorAll(".paddle").forEach((function(e){e.addEventListener("mousedown",W),e.addEventListener("touchstart",W),e.addEventListener("mouseout",P),e.addEventListener("mouseup",P),e.addEventListener("touchend",P)})),function(){document.removeEventListener("keydown",W),document.removeEventListener("keyup",P),document.querySelectorAll(".paddle").forEach((function(e){e.removeEventListener("mousedown",W),e.removeEventListener("touchstart",W),e.removeEventListener("mouseout",P),e.removeEventListener("mouseup",P),e.removeEventListener("touchend",P)})),clearInterval(t),clearInterval(N)}}),[m,h,p]),Object(a.useEffect)((function(){if("/"===l.slice(-1)&&"practice"===h){var e=l.slice(0,l.length-1);d((function(t){return[e].concat(Object(u.a)(t))})),i.length>=g&&d((function(e){return e.slice(0,e.length-1)})),o("")}}),[l])},q=r.a.memo((function(){A()})),W=function(e){return" "===e.dd?r.a.createElement("div",{className:"ditDah"},"\xa0"):r.a.createElement("div",{className:"ditDah"},e.dd)},P=r.a.memo((function(){var e=Object(a.useContext)(s).morseCharBuffer,t=e.split("").map((function(e,t){return r.a.createElement(W,{key:t,dd:e})})),n="",l=e.split(" ");if(""===e);else for(var o in l)" "===l[o]?n+=" ":void 0===C[l[o]]?n+=""===l[o]?"":"[?]":n+=C[l[o]];return r.a.createElement("div",{id:"morseBufferDisplay"},r.a.createElement("div",{id:"overlay"}),r.a.createElement("div",{id:"ditDahs-container"},r.a.createElement("div",{id:"ditDahs"},t)),r.a.createElement("div",{id:"alphanumeric-container"},r.a.createElement("div",{id:"alphanumeric"},n.toUpperCase())))})),_=function(){var e=Object(a.useContext)(s),t=e.morseWords,n=e.setMorseWords,l="";return t.forEach((function(e,t){if(e.includes(" ")){var n="";e.split(" ").forEach((function(e){void 0===C[e]?n+="[?]":n+=C[e].toUpperCase()})),l=n+" "+l}else l=void 0===C[e]?"[?] "+l:C[e].toUpperCase()+" "+l})),r.a.createElement("div",{id:"morse-history"},r.a.createElement("div",{id:"morseHistory-textbox"},l),r.a.createElement("div",{id:"clear"},r.a.createElement("span",{id:"message"},'"',r.a.createElement("span",{className:"ditDah"},"[?]"),'" signifies no translation available.'),r.a.createElement("button",{id:"clear-history",onClick:function(){n([])}},"Clear")))},D=function(){var e,t,n,r=Object(a.useContext)(s),l=r.morseCharBuffer,o=r.setMorseCharBuffer,i=r.morseWords,d=r.setMorseWords,m=Object(a.useContext)(x).wpm,h=Object(a.useContext)(c).gameMode,p=Object(a.useContext)(S).frequency,f=0,v=0,E=0,g=0,b=1200/m*.3,y=3*b,w=7*b,C=I.historySize,k=window.AudioContext||window.webkitAudioContext||!1;window.AudioContext=window.AudioContext||window.webkitAudioContext,e=k?new k:null;var O=!1;function L(a){if("touchstart"===a.type&&a.preventDefault(),32===a.keyCode){if("morseInput"===document.activeElement.id)return;"body"!==document.activeElement.tagName.toLowerCase()&&(a.preventDefault(),document.activeElement.blur())}O||(O=!0,32!==a.keyCode&&"morseButton"!==a.target.id&&"paddle"!==a.target.className||a.repeat||(document.getElementById("morseButton").classList.add("active"),"interrupted"===e.state&&e.resume(),(t=e.createOscillator()).frequency.value=p,t.type="sine",(n=e.createGain()).gain.exponentialRampToValueAtTime(I.mainVolume,e.currentTime),t.connect(n),n.connect(e.destination),t.start(),g>=y&&g=w?(o((function(e){return e+"/"})),clearInterval(E),E=0,g=0):"challenge"===h&&g>=y&&(o((function(e){return e+"_"})),clearInterval(E),E=0,g=0)}),1),void 0!==t&&"running"===t.context.state&&(n.gain.setTargetAtTime(1e-4,e.currentTime,.001),t.stop(e.currentTime+.05))))}Object(a.useEffect)((function(){document.addEventListener("keydown",L),document.addEventListener("keyup",j);var e=document.getElementById("morseButton");return e.addEventListener("touchstart",L),e.addEventListener("touchend",j),e.addEventListener("mousedown",L),e.addEventListener("mouseout",j),e.addEventListener("mouseup",j),function(){document.removeEventListener("keydown",L),document.removeEventListener("keyup",j);var e=document.getElementById("morseButton");e.removeEventListener("touchstart",L),e.removeEventListener("touchend",j),e.removeEventListener("mousedown",L),e.removeEventListener("mouseout",j),e.removeEventListener("mouseup",j),clearInterval(f),clearInterval(E)}}),[m,h,p]),Object(a.useEffect)((function(){if("/"===l.slice(-1)&&"practice"===h){var e=l.slice(0,l.length-1);d((function(t){return[e].concat(Object(u.a)(t))})),i.length>=C&&d((function(e){return e.slice(0,e.length-1)})),o("");var t=document.getElementById("morseHistory-textbox");t.scrollTop=t.scrollHeight}}),[l])},J=r.a.memo((function(){D()})),R=function(){var e=Object(a.useContext)(M).keyType;return r.a.createElement(r.a.Fragment,null,"straight"===e?r.a.createElement(J,null):r.a.createElement(q,null),r.a.createElement(P,null),r.a.createElement("br",null),r.a.createElement(_,null))},G=r.a.memo((function(e){var t=e.morseArray,n=[];for(var a in t){var l=t[a];n.push(r.a.createElement("span",{key:a},l))}return r.a.createElement("div",{id:"challengeBufferDisplay"},r.a.createElement("div",{id:"ditDahs"},n))})),H=function(e){return r.a.createElement("div",{id:"challengeControls"},r.a.createElement("button",{onClick:e.cancelChallenge},"Exit Challenge"))},F=r.a.memo((function(e){var t=Object(a.useContext)(y).word,n=("object"===typeof t?t[0].split(""):t.split("")).map((function(e,t){return r.a.createElement("span",{key:t,className:"cLetter"},e)}));return r.a.createElement("div",{id:"challengeWord",className:e.challengeWordClass},n)})),V=function(e){var t=Object(a.useContext)(L).gameClockTime,n=Math.floor(t/60),l=t%60;return r.a.createElement("div",{id:"gameClock"},"Time Elapsed: ",r.a.createElement("span",{id:"clockTime"},n," minutes ",l," seconds"))},U=r.a.memo((function(){var e=Object(a.useContext)(M).keyType,t=Object(a.useContext)(k),n=t.challengeState,l=t.cancelChallenge,o=t.morseArray,i=t.challengeWordClass;return r.a.createElement(r.a.Fragment,null,"started"===n?"straight"===e?r.a.createElement(J,null):r.a.createElement(q,null):r.a.createElement(r.a.Fragment,null),r.a.createElement("div",{id:"challenge-header"},r.a.createElement(V,null),r.a.createElement(H,{cancelChallenge:l})),r.a.createElement(F,{challengeWordClass:i}),r.a.createElement(G,{morseArray:o}))})),K=r.a.memo((function(){var e=Object(a.useContext)(c).setGameMode,t=Object(a.useContext)(s).setMorseCharBuffer,n=Object(a.useContext)(y).resetFeeder,l=Object(a.useContext)(L),o=l.stopGameClock,i=l.setGameClockTime,d=l.clockIsRunning,u=Object(a.useContext)(k).setChallengeState;function m(a){t(""),n(),u("ready"),e(a.target.id),d&&(o(),i(0)),document.querySelector(".mode-picker#gameMode #buttons").childNodes.forEach((function(e){e.id===a.target.id?e.classList.add("selected"):e.classList.remove("selected")}))}return r.a.createElement("div",{id:"gameMode",className:"mode-picker"},r.a.createElement("div",{id:"title"},"Mode"),r.a.createElement("div",{id:"buttons"},r.a.createElement("button",{id:"practice",className:"selected",onClick:m},"Practice Mode"),r.a.createElement("button",{id:"challenge",onClick:m},"Challenge Mode")))})),z=r.a.memo((function(){var e=Object(a.useContext)(M),t=e.setKeyType,n=e.keyType;function l(e){switch(t(e.target.id),e.target.id){case"straight":e.target.classList.add("selected"),document.getElementById("electronic").classList.remove("selected"),document.querySelector("#morseButton").classList.remove("showPaddles"),document.querySelector(".paddle").classList.remove("showPaddles"),document.querySelector(".paddle#left").classList.remove("showPaddles"),document.querySelector(".paddle#right").classList.remove("showPaddles"),document.getElementById("paddle-mode-buttons").style.visibility="hidden",document.getElementById("morseButtonText").innerHTML="TAP BUTTON OR PRESS SPACEBAR";break;case"electronic":e.target.classList.add("selected"),document.getElementById("straight").classList.remove("selected"),document.querySelector("#morseButton").classList.add("showPaddles"),document.querySelector(".paddle").classList.add("showPaddles"),document.querySelector(".paddle#left").classList.add("showPaddles"),document.querySelector(".paddle#right").classList.add("showPaddles"),document.getElementById("paddle-mode-buttons").style.visibility="visible",document.getElementById("morseButtonText").innerHTML="TAP/HOLD BUTTONS OR PRESS COMMA / PERIOD";break;case"modeA":e.target.classList.add("selected"),document.getElementById("modeB").classList.remove("selected");break;case"modeB":e.target.classList.add("selected"),document.getElementById("modeA").classList.remove("selected")}}return Object(a.useEffect)((function(){document.querySelector("button#".concat(n)).classList.add("selected")}),[]),r.a.createElement("div",{id:"keyType",className:"mode-picker"},r.a.createElement("div",{id:"title"},"Key Type"),r.a.createElement("div",{id:"key-type-buttons"},r.a.createElement("button",{id:"straight",onClick:l},"Straight Key"),r.a.createElement("button",{id:"electronic",onClick:l},"Electronic Key")),r.a.createElement("div",{id:"paddle-mode-buttons"},r.a.createElement("fieldset",{id:"paddle-mode"},r.a.createElement("legend",null,"Paddle Mode"),r.a.createElement("button",{id:"modeA",class:"selected",onClick:l},"A"),r.a.createElement("button",{id:"modeB",onClick:l},"B"),r.a.createElement("br",null))))})),$={twitter:{name:"Twitter",icon:"ri-twitter-fill",link:"https://twitter.com/intent/tweet?text=Check%20out%20this%20site%20that%20helps%20you%20learn%20Morse%20Code%3A%20https%3A//learnmorsecode.net%20%40genemecija%20%23morse%20%23morsecode"},facebook:{name:"Facebook",icon:"ri-facebook-box-fill",link:"https://www.facebook.com/sharer/sharer.php?u=https%3A//learnmorsecode.net"},email:{name:"Email",icon:"ri-mail-line",link:"mailto:?subject="+encodeURIComponent("Check out this site that helps you learn Morse code! https://learnmorsecode.net")}},Z={email:{name:"Email",icon:"ri-mail-line",link:"mailto:gene@genemecija.com?subject="+encodeURIComponent("Hello, Gene!")},github:{name:"GitHub",icon:"ri-github-fill",link:"https://github.com/genemecija/learn-morse-code/"},twitter:{name:"Twitter",icon:"ri-twitter-fill",link:"https://twitter.com/genemecija"}},Y=function(){function e(e){var t=e.target.id,n="900",a="500";"email"===t&&(n="150",a="150"),function(e,t,n,a){var r=void 0!==window.screenLeft?window.screenLeft:window.screen.left,l=void 0!==window.screenTop?window.screenTop:window.screen.top,o=(window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width)/2-n/2+r,i=(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height)/2-a/2+l,c=window.open(e,t,"scrollbars=yes, width="+n+", height="+a+", top="+i+", left="+o);window.focus&&c.focus()}($[t].link,"Share",n,a)}var t=Object.keys($).map((function(t,n){return r.a.createElement("i",{id:t,key:n,onClick:e,className:$[t].icon})}));return r.a.createElement("div",{id:"header"},r.a.createElement("div",{id:"title"},"Learn Morse Code"),r.a.createElement("div",{id:"social-links"},"Share: ",r.a.createElement("span",{id:"share-icons"},t)))},Q=function(){var e,t=Object(a.useContext)(x).wpm,n=Object(a.useContext)(S).frequency,r=1200/t,l=window.AudioContext||window.webkitAudioContext;function o(t){var a,l="."===t?r:3*r;"interrupted"===e.state&&e.resume(),(a=e.createOscillator()).frequency.value=n,a.type="sine";var o=e.currentTime,i=e.createGain();i.gain.exponentialRampToValueAtTime(I.mainVolume,o),i.gain.setValueAtTime(I.mainVolume,o),a.connect(i),i.connect(e.destination),a.start(o),setTimeout((function(){i.gain.setTargetAtTime(1e-4,e.currentTime,.009),a.stop(e.currentTime+.05)}),l)}window.AudioContext=window.AudioContext||window.webkitAudioContext,e=l?new l:null;var i=[],c=[];return{playMorseWord:function(e){i=[];for(var t=0;t=o?e-1:o}))}},r.a.createElement("i",{className:"ri-arrow-down-s-line"})),r.a.createElement("input",{type:"number",name:"wpm",id:"wpm-input",min:"5",max:"30",value:t,onChange:function(e){Number(e.target.value)>i?n(i):Number(e.target.value)=10&&n<36)return r.a.createElement("button",{key:"legend_item_"+n,className:"item",onClick:t},r.a.createElement("span",{className:"alpha",key:"legend_btn_"+n},e.toUpperCase()),r.a.createElement("span",{className:"morse",key:"legend_spn_"+n},me[e]))})),l=Object.keys(me).map((function(e,n){if(n>36)return r.a.createElement("button",{key:"legend_item_"+n,className:"item",onClick:t},r.a.createElement("span",{className:"alpha",key:"legend_btn_"+n},e.toUpperCase()),r.a.createElement("span",{className:"morse",key:"legend_spn_"+n},me[e]))}));return r.a.createElement("div",{id:"legend"},r.a.createElement("div",{id:"legend-title"},"Legend"),r.a.createElement("div",{id:"legend-items"},a,n,l))})),pe=function(){var e=Q().playMorseWord,t=Object(a.useState)(""),n=Object(i.a)(t,2),l=n[0],o=n[1],c=Object(a.useState)(""),s=Object(i.a)(c,2),d=s[0],u=s[1];return Object(a.useEffect)((function(){var e=Array.from(l.trim().toLowerCase()).map((function(e){if(" "===e)return"/";var t=function(e){var t="";for(var n in e)t+=me[e[n].toLowerCase()];return t}(e);return"undefined"===t?"?":t+" "})).map((function(e){return e.trim()})).join(" ").replace(/ \/ /g,"/").replace(/ \?/g,"?");u(e)}),[l]),r.a.createElement("div",{id:"playMorseInput"},r.a.createElement("div",{id:"title"},r.a.createElement("h2",null,"Translate To Morse")),r.a.createElement("div",{id:"input"},r.a.createElement("input",{type:"text",id:"morseInput",value:l,onChange:function(e){e.preventDefault(),o(e.target.value)},placeholder:"Type here.",maxLength:"25"})," ",r.a.createElement("i",{className:"ri-play-fill",onClick:function(){e(d)}}),r.a.createElement("i",{className:"ri-stop-fill",onClick:function(){return e("")}})),r.a.createElement("div",{id:"morseTranslation"},r.a.createElement("span",{id:"morseTrans"},""===d?"Morse translation will appear here.":d.replace(/\?/g,"[?]").replace(/\] /g,"]"))))},fe=function(){var e=Object(a.useState)("nav-learn"),t=Object(i.a)(e,2),n=t[0],l=t[1];function o(e){"nav-learn"===e.target.id?l("nav-learn"):"nav-legend"===e.target.id?l("nav-legend"):l("nav-play"),document.querySelector(".navbar").childNodes.forEach((function(t){t.id===e.target.id?t.classList.add("selected"):t.classList.remove("selected")}))}return r.a.createElement("div",{className:"sidebar",id:"left"},r.a.createElement("div",{id:"sidebar-container"},r.a.createElement("div",{className:"navbar"},r.a.createElement("div",{id:"nav-play",className:"nav-item",onClick:o},"Play"),r.a.createElement("div",{id:"nav-learn",className:"nav-item selected",onClick:o},"Learn"),r.a.createElement("div",{id:"nav-legend",className:"nav-item",onClick:o},"Legend")),r.a.createElement("div",{id:"info-icon",onClick:function(){document.querySelector(".sidebar#left").classList.toggle("hide"),document.querySelector("#main-interface").classList.toggle("expandLeft")}},r.a.createElement("i",{className:"ri-arrow-left-circle-line"})),r.a.createElement("div",{id:"sidebar-content"},"nav-learn"===n&&r.a.createElement(ue,null),"nav-legend"===n&&r.a.createElement("div",{id:"playerAndLegend"},r.a.createElement(he,null),r.a.createElement("span",{id:"note"},"Adjust the Morse code speed by changing the WPM in the Options menu."),r.a.createElement(pe,null)))))},ve=r.a.memo((function(e){var t=Object(a.useContext)(S),n=t.frequency,l=t.setFrequency,o=300,i=1500;return r.a.createElement("div",{id:"frequency",className:"mode-picker"},r.a.createElement("div",{id:"title"},"Frequency ",r.a.createElement("span",{id:"range"},"(",o,"-",i,")")),r.a.createElement("div",{id:"input"},r.a.createElement("button",{id:"freq-down",onClick:function(){l((function(e){return e-10>=o?e-10:o}))}},r.a.createElement("i",{className:"ri-arrow-down-s-line"})),r.a.createElement("input",{type:"number",name:"frequency",id:"frequency-input",value:n,onChange:function(e){Number(e.target.value)>i?l(i):Number(e.target.value)