Changeset 3459126
- Timestamp:
- 02/11/2026 04:26:00 PM (8 weeks ago)
- Location:
- orbem-studio
- Files:
-
- 22 edited
- 1 copied
-
tags/1.1.10 (copied) (copied from orbem-studio/trunk)
-
tags/1.1.10/assets/build/app.asset.php (modified) (1 diff)
-
tags/1.1.10/assets/build/app.js (modified) (1 diff)
-
tags/1.1.10/assets/build/devmode.asset.php (modified) (1 diff)
-
tags/1.1.10/assets/build/devmode.js (modified) (1 diff)
-
tags/1.1.10/assets/build/explore.asset.php (modified) (1 diff)
-
tags/1.1.10/assets/build/explore.js (modified) (1 diff)
-
tags/1.1.10/inc/class-explore.php (modified) (6 diffs)
-
tags/1.1.10/orbem-studio.php (modified) (2 diffs)
-
tags/1.1.10/readme.txt (modified) (2 diffs)
-
tags/1.1.10/templates/components/explore-characters.php (modified) (1 diff)
-
tags/1.1.10/templates/explore.php (modified) (2 diffs)
-
trunk/assets/build/app.asset.php (modified) (1 diff)
-
trunk/assets/build/app.js (modified) (1 diff)
-
trunk/assets/build/devmode.asset.php (modified) (1 diff)
-
trunk/assets/build/devmode.js (modified) (1 diff)
-
trunk/assets/build/explore.asset.php (modified) (1 diff)
-
trunk/assets/build/explore.js (modified) (1 diff)
-
trunk/inc/class-explore.php (modified) (6 diffs)
-
trunk/orbem-studio.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/components/explore-characters.php (modified) (1 diff)
-
trunk/templates/explore.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
orbem-studio/tags/1.1.10/assets/build/app.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' fcc07b1bf7922d1a0150');1 <?php return array('dependencies' => array(), 'version' => 'd137e139c95c404ea149'); -
orbem-studio/tags/1.1.10/assets/build/app.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911),n(704)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911),n(704)})(); -
orbem-studio/tags/1.1.10/assets/build/devmode.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' 7109d497c77bcdd37acf');1 <?php return array('dependencies' => array(), 'version' => '29234ba45771bf4210e1'); -
orbem-studio/tags/1.1.10/assets/build/devmode.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(704)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(704)})(); -
orbem-studio/tags/1.1.10/assets/build/explore.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' 5ddfcc2872dc2083da4e');1 <?php return array('dependencies' => array(), 'version' => 'af45054488c344cca6cb'); -
orbem-studio/tags/1.1.10/assets/build/explore.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911)})(); -
orbem-studio/tags/1.1.10/inc/class-explore.php
r3455137 r3459126 46 46 $permission_callback = function() { return current_user_can( 'read' ); }; 47 47 $namespace = 'orbemorder/v1'; 48 $google_function = is_plugin_active('orbem-studio-pro/orbem-studio-pro.php') ? 'handleProGoogleOauthCallback' : 'handleGoogleOauthCallback'; 48 49 49 50 // Google oauth handle for logging in. 50 51 register_rest_route($namespace, '/google-oauth-callback/', [ 51 52 'methods' => 'POST', 52 'callback' => [$this, 'handleGoogleOauthCallback'],53 'callback' => [$this, $google_function], 53 54 'permission_callback' => '__return_true', 54 55 ]); … … 72 73 'methods' => 'POST', 73 74 'callback' => [$this, 'getOrbemArea'], 74 'permission_callback' => $permission_callback75 'permission_callback' => '__return_true', 75 76 ]); 76 77 … … 79 80 'methods' => 'POST', 80 81 'callback' => [$this, 'getItemDescription'], 81 'permission_callback' => $permission_callback82 'permission_callback' => '__return_true', 82 83 ]); 83 84 … … 897 898 $orbem_studio_userid = (int) $user->ID; 898 899 899 // Endpoint intentionally accessible to all authenticated users.900 if (0 === $orbem_studio_userid) {901 return rest_ensure_response([902 'success' => false,903 'data' => esc_html__('User not authenticated', 'orbem-studio'),904 ]);905 }906 907 900 // Get request data. 908 $data = $request->get_json_params(); 909 $position = isset($data['position']) ? sanitize_title(wp_unslash($data['position'])) : ''; 901 $data = $request->get_json_params(); 902 $position = isset($data['position']) ? sanitize_title(wp_unslash($data['position'])) : ''; 903 $characters = $data['characters'] ?? ''; 904 $orbem_studio_characters = []; 905 906 if (true === is_array($characters)) { 907 foreach( $characters as $value ) { 908 if ( true === empty($orbem_studio_characters[$value])) { 909 $orbem_studio_characters[] = is_numeric($value) ? intval($value) : sanitize_text_field(wp_unslash($value)); 910 } 911 } 912 } elseif ('' !== $characters) { 913 $orbem_studio_characters[] = is_numeric($characters) ? intval($characters) : sanitize_text_field(wp_unslash($characters)); 914 } 915 910 916 $area = '' !== $position ? get_posts([ 911 917 'post_type' => 'explore-area', … … 1004 1010 $user = wp_get_current_user(); 1005 1011 $userid = (int) $user->ID; 1006 1007 // Endpoint intentionally accessible to all authenticated users.1008 if (0 === $userid) {1009 return rest_ensure_response([1010 'success' => false,1011 'data' => esc_html__('User not authenticated', 'orbem-studio'),1012 ]);1013 }1014 1012 1015 1013 // Get request data. … … 1489 1487 } 1490 1488 1491 if (true !== $breakable && true !== $collectable && $passable && 'explore-point' === $explore_point->post_type) {1489 if (true !== $breakable && true !== $collectable && true !== $draggable && true !== $is_hazard && $passable && 'explore-point' === $explore_point->post_type) { 1492 1490 $classes .= ' no-point'; 1493 1491 } -
orbem-studio/tags/1.1.10/orbem-studio.php
r3457422 r3459126 6 6 * Plugin URI: https://orbem.studio/ 7 7 * Description: Build your own RPG video game using the power of WordPress 8 * Version: 1.1. 98 * Version: 1.1.10 9 9 * Author: orbemorder 10 10 * Author URI: https://orbemorder.com/ … … 34 34 * Plugin version constant. 35 35 */ 36 const ORBEM_STUDIO_VERSION = '1.1. 9';36 const ORBEM_STUDIO_VERSION = '1.1.10'; 37 37 38 38 if (version_compare(phpversion(), '8.1.0', '>=')) { -
orbem-studio/tags/1.1.10/readme.txt
r3457422 r3459126 6 6 Tested up to: 6.9 7 7 Requires PHP: 8.1 8 Stable tag: 1.1. 98 Stable tag: 1.1.10 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 171 171 == Changelog == 172 172 173 = 1.1.10 = 174 * Fix draggable items. 175 * Remove logged in dependency for get calls. 176 173 177 = 1.1.9 = 174 178 * Update select meta field to display titles. -
orbem-studio/tags/1.1.10/templates/components/explore-characters.php
r3434825 r3459126 10 10 use OrbemStudio\Explore; 11 11 12 $orbem_studio_characters = get_user_meta($orbem_studio_userid, 'explore_characters', true); 12 if (true === empty($orbem_studio_characters)) { 13 $orbem_studio_characters = get_user_meta($orbem_studio_userid, 'explore_characters', true); 14 } 13 15 ?> 14 16 <div class="characters-form"> -
orbem-studio/tags/1.1.10/templates/explore.php
r3452489 r3459126 182 182 $orbem_studio_main_character_id = $orbem_studio_main_character_info['id'] ?? false; 183 183 $orbem_studio_is_admin = user_can(get_current_user_id(), 'manage_options'); 184 $orbem_studio_is_logged_in = is_user_logged_in(); 184 185 185 186 if ( $orbem_studio_is_admin ) { … … 203 204 include plugin_dir_path(__FILE__) . 'plugin-header.php'; 204 205 ?> 205 <main id="primary"<?php echo esc_attr(true === $orbem_studio_is_admin ? ' data-devmode=true' : ''); ?> class="site-main<?php echo esc_attr($orbem_studio_rst); ?>">206 <main id="primary"<?php echo esc_attr(true === $orbem_studio_is_admin ? ' data-devmode=true' : ''); ?><?php echo esc_attr(true === $orbem_studio_is_logged_in ? ' data-loggedin=true' : ''); ?> class="site-main<?php echo esc_attr($orbem_studio_rst); ?>"> 206 207 <?php include $orbem_studio_plugin_dir_path . 'start-screen.php'; ?> 207 208 <?php if (true === $orbem_studio_is_admin) : ?> -
orbem-studio/trunk/assets/build/app.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' fcc07b1bf7922d1a0150');1 <?php return array('dependencies' => array(), 'version' => 'd137e139c95c404ea149'); -
orbem-studio/trunk/assets/build/app.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911),n(704)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911),n(704)})(); -
orbem-studio/trunk/assets/build/devmode.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' 7109d497c77bcdd37acf');1 <?php return array('dependencies' => array(), 'version' => '29234ba45771bf4210e1'); -
orbem-studio/trunk/assets/build/devmode.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(704)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(704)})(); -
orbem-studio/trunk/assets/build/explore.asset.php
r3457422 r3459126 1 <?php return array('dependencies' => array(), 'version' => ' 5ddfcc2872dc2083da4e');1 <?php return array('dependencies' => array(), 'version' => 'af45054488c344cca6cb'); -
orbem-studio/trunk/assets/build/explore.js
r3457422 r3459126 1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){ s(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const s=document.getElementById("_product_video_url");s&&"video"===a.type&&(s.value=a.url);const r=document.getElementById("_product_video_url_thumbnail");r&&"image"===a.type&&(r.value=a.url)})),n.open()}))}function s(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=s},704:(e,t,n)=>{n.d(t,{S:()=>s});var a=n(295),o=n(911);function s(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),s=document.getElementById("zoom-out");n&&s&&(n.addEventListener("click",(()=>{p("in")})),s.addEventListener("click",(()=>{p("out")})));let r,c=null,i=0,l=0;function d(e){if(clearTimeout(r),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(r=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),s=document.getElementById("map-character"),r=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,s.style.zIndex="0"):window.noTouch=!1}))),r&&r.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let s="";o&&(s=o.dataset.type);let r=document.querySelector(".game-container");r=r.className.replace("game-container ","");const c={type:s,area:null!=r?r:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),r=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),s=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(s.style.display="none",o.textContent="🫣"):(s.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=s.style.height;m=m?m.replace("px",""):"";let p=s.style.width;if(p=p?p.replace("px",""):"",r.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:s.dataset?.height,d.type="number",d.value=p&&""!==p?p:s.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),r.style.display="none",s&&(s.style.height=`${i.value}px`,s.style.width=`${d.value}px`)}))})),r.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),r.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),r=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),r&&r.classList.remove("selected"),a&&(s.style.left=parseInt(a.style.left.replace("px",""))-200+"px",s.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t;function r(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,s=(e.clientY-a.top)/t,r=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-r+"px",n.style.height=s-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=s-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),s=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+s,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":s}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+s.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&s()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ne,Z:()=>me});var a=n(704);let o,s,r;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;function B(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,s=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=s}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":K(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Ce();break;case"strength":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Ce(),K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,K(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Ce()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function M(e,t,n,a){let o;if(e){let s=!1;!1!==t&&(s=e,e=t);const r=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&s&&(e=s),r&&!1===d){const t=JSON.parse(r);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const s=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Be(e.className);if(t&&1!==t.length){let r,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===s?0:m+1,y=function(e,t,n,a,o,s){o="0"===o?"60":o,s="0"===s?"0.175":s;const r=Math.hypot(e-n,t-a)*parseFloat(s)*o;return Math.ceil(r/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((s>m||f&&s===m)&&(x&&x.classList.remove("engage"),d=le(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?s>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=s,g=0,Ee(a,n)):s===p&&(clearInterval(o),Ee(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(D(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,r=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:s,D(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else le(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=H([]),o="",s=!1,r=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{W(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=Re(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===s&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===s)&&(o="down"===o?"up":"down",s=!0),g.top>p&&!0===g.collide&&!0===s&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==r||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===r)&&(o="left"===o||"down"===o?"right":"left",r=!0),g.left<t&&!0===g.collide&&!0===r&&(c=!0),(!0===r&&!0===c||!0===i&&!0===s)&&(o="",a=H(a),r=!1,c=!1,i=!1,s=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(W(n,e),o=""),l>20&&(d=0,s=!1,i=!1,r=!1,c=!1,o="",m++)}else a=H(a)}),t)}(e,c,i),Ee(a,n));window.allowCutscene=!0}else Ee(a,n)}function P(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function R(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&G(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function D(e,t){const n=t.querySelector(".character-icon.engage"),a=Be(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function W(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function H(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function $(e,t,n,a,o){!0===a&&V(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const s=document.querySelector(`.${t}-amount`);let r=!1;s&&(r=s.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),r&&"point"!==t&&"money"!==t?(s.setAttribute("data-amount",e),r.style.width=e+"px"):"point"===t?(s.setAttribute("data-amount",e),r.style.width=j(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(s.setAttribute("data-amount",e),s.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,z("projectile","health",100,0,"true",!1),n&&F(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&z(n,t,e,2e3,"",!1)}function z(e,t,n,a,s,r){const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===r&&(n="health"!==t?ee(t)+n:j(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:s};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function j(e){return e/window.nextLevelPointAmount*100+"%"}function J(e,t,n){clearTimeout(s),s=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),s=a.dataset.hazardremove,r=a.dataset.ability;X(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==s&&s&&"none"!==s){const e=s.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&z(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),r&&"transportation"===r&&($e(),function(){const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Be(e.className)),e.classList.add("materialize")})),Se(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Ie(Be(a.className),!1),He(t,n,!0,o,e)}else t&&0===o&&z(n,"point",0,2e3,"",!0)}const s=`${OrbemOrder.siteRESTURL}/mission/`,r={mission:e};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function X(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function U(e,t,n,a,o){const s={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Me(document.getElementById("map-character"),"down",!0)}))}function V(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),_(0,e,t,0,!0))}function _(e,t,n,a,o){const s=`${OrbemOrder.siteRESTURL}/save-storage-item/`,r={id:e,name:t,value:a,type:n,remove:o};fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function F(e,t){const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Ve(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Ve(!0)}))}else Ve(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&$e(),document.addEventListener("keydown",ze),document.querySelector(".action-key").addEventListener("click",ze);const s=document.querySelectorAll(".spell"),r=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",s&&r&&(s.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),s=e.getAttribute("title"),r=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(s),a.classList.add("spell"),a.setAttribute("data-value",r),window.weaponTime=r}))})),r.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),r.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(ue(),i.classList.remove("engage")):ue();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Xe(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=j(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){me()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),R(),P();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Y=function(){let e=!1;return function(t,n){if(n&&t&&We(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,s=n.dataset.mission;let r=!0===t.classList.contains("heavy-engage")?"heavy":"normal";r=!0===t.classList.contains("charge-attack-engage")?"charged":r;const c=parseInt(JSON.parse(t.dataset.strength)[r])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,ae(n)):i<=.5*o&&!1===x?(x=!0,ae(n)):i<=.25*o&&!1===q&&(q=!0,ae(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Be(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&we(s)&&J(s,n,s)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),Z=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,s){var r;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(r=OrbemOrder.previousCutsceneArea)&&void 0!==r?r:"":window.previousCutsceneArea,Ve(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const i=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");i&&i.forEach((e=>{e.remove()}));const l=document.querySelector(".right-bottom-devmode"),d=document.querySelector(".dev-mode-menu");d&&l&&(d.remove(),l.remove());const u=document.querySelector(".explore-item-list");u&&(u.innerHTML="");const m=document.querySelector(".default-map");if(m&&m.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let r="";OrbemOrder.musicNames&&(r=JSON.parse(OrbemOrder.musicNames)[t]);const i={position:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(i)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const i=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),i&&i.remove();const p=document.createElement("style");p.id="map-item-styles",p.innerHTML=n["map-item-styles-scripts"];const g=document.querySelector(".missions-content");if(g&&(g.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{X(e),e.remove()}),500))}d&&d.append(p),m&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,R(),P();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),B(),_e(),(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const s=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');s&&s.forEach((e=>{M(e,!1,!1,!1)})),pe(),ge(),ke();const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(r&&r.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}if("yes"===n["is-cutscene"]){const e=Be(document.querySelector(".map-cutscene").className);Ie(e,!0),window.previousCutsceneArea=e,qe(window.previousCutsceneArea)}else Ae();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t),function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(Be(i[e].className)),e++}),1e3)}ue()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),c=document.querySelector(".map-weapon");s&&(n["start-top"]=JSON.parse(s).top,n["start-left"]=JSON.parse(s).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Me(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,te(r,t),window.allowMovement=!0,c.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"].includes("transportation"))&&$e()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),s=document.createElement("button");s.classList.add("storage-item-button"),s.textContent="Equip";const r=document.createElement("button");r.textContent="Unequip",r.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(r),a.appendChild(s);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>ee(m)&&i.addEventListener("click",(()=>{He(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{V(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}Q(!1),a.innerHTML="",U(m,l,u,!1,t.title)})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),Q(!0),a.innerHTML="",U(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function K(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function Q(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),s=parseInt(n.dataset.amount),r=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(s+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),r+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(s-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),r-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",s),n.querySelector(".gauge").style.width=s+"px",a.style.width=r+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function ee(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function te(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ne(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&oe(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),s=parseInt(n.style.top,10);const r=document.getElementById("map-character");if(o<parseInt(r.style.left.replace("px",""))+400?o+=1:o-=1,s<parseInt(r.style.top.replace("px",""))+400?s+=1:s-=1,a&&n){const e=De(a,n.getBoundingClientRect(),s,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(ae(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");re(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function ae(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?oe(e):clearInterval(m)),S++}function oe(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,s=e.querySelector(".projectile");s&&se(s,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,s,r,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==s&&"no"===c?function(e,t,n,a,o){let s,r;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=de(o),d=de(i);le(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);s=m-c.left,r=p-c.top,e.style.transform="translate("+s+"px, "+r+"px)"}(e,t,n,o,a):!0===s?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),ie(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(ie(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(r);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==s&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(re(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Fe(),$(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===s||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function re(e,t,n){const a=ce(e,n),o=ce(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ce(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function ie(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function le(e,t,n,a,o,s){const r=.075*Math.hypot(e-n,t-a)*s;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+r+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function de(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function ue(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),s=t?null:document.querySelector("."+e+"-materialize-item-map-item"),r=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),s&&s.remove()),r&&"true"===r.dataset.removable&&r.remove(),"no"===n.dataset?.disappear&&be(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function me(){var e;const t=document.querySelector(".game-container"),n=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(e=OrbemOrder.previousCutsceneArea)&&void 0!==e?e:"";const a=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");a&&a.forEach((e=>{e.classList.add("engage")})),Ve(!1),ke(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",B(),pe();const o=document.getElementById("characters"),s=!!o&&o.querySelectorAll(".character-item");o&&0<s.length&&(o.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",n&&n.classList.add("do-mobile");let r="";OrbemOrder.musicNames&&I&&(r=JSON.parse(OrbemOrder.musicNames)[I]),te(r,I);const i=document.getElementById("explore-points"),l=document.getElementById("missions");i&&(i.style.opacity="1"),l&&(l.style.opacity="1");const d=document.getElementById("key-guide");Ye(d,"engage"),Ye(n,"engage"),window.buttonShow=setInterval((function(){Ye(n,"engage"),Ye(d,"engage")}),1e4);const m=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(m&&m.forEach((e=>{M(e,!1,!1,!1)})),ge(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Pe),document.querySelector(".action-key").addEventListener("click",Pe)}(),Ce(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Be(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,qe(window.previousCutsceneArea),Ie(e,!0)}if(""!==window.previousCutsceneArea){Te(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Be(e.className)),e.classList.add("no-point")})),Se(I,c))}_e(),t&&(t.style.display="block");const p=document.getElementById("map-character");p&&p.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ae()}),1e3)}function pe(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ge(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Be(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function ye(e,t,n,a,o,s){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Be(e.className);e.classList.contains("enemy-item")&&Y(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),s=Be(e.className),i=document.querySelector(`.map-cutscene[data-character="${s}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&We(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Ie(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),z(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&We(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Le(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Le(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ne(e,"false");if("true"===e.dataset.hazard&&!1===he(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=ee("health")-parseInt(t);Fe(),$(n,"health","hazard",!1,""),fe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===he(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&he(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ne(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ue(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],s={duration:1e3,iterations:1/0};a.animate(e,s)}}document.addEventListener("click",n),document.addEventListener("keydown",n),z(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(M(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),xe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&He(e,Be(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&J(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Be(o):t;const s=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&s&&!1===s.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&J(e.dataset.mission,e,t),Ie(t,!1),""===t&&Se(y,[Be(e.className)]),e.remove()):(e.classList.add("engage"),Le(document.querySelector("."+s.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(r);const t=Be(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),r=setTimeout((()=>{Se(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ve(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&We(m,e,0)){const n=Be(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,s=document.querySelector(".start-timer");if((a||void 0!==o)&&s&&!1===e.classList.contains("start-timer")){const n="true"===s.dataset.removable?"":[t,Be(s.className)];J(e.dataset.mission,e,n),s.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&he(e,l,"strength")&&null===a&&void 0===o&&we(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Be(e.className))}))),J(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(xe(e),"point"===e.dataset.type&&He(e,Be(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==we(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!he(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&ve(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[s]?s:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function fe(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function we(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function he(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function ve(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&be(e)}function be(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Se(e,t){const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Le(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const s=e.style.left.replace("px",""),r=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Be(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(s)+"px",o.style.top=parseInt(r)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function xe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Be(e.className),s=document.createElement("span"),r=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+r+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(s.setAttribute("data-type",t),s.setAttribute("data-id",a),s.setAttribute("data-value",n),s.setAttribute("title",o),s.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);s.setAttribute("data-width",t.width.replace("px","")),s.setAttribute("data-height",t.height.replace("px","")),s.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",s.append(n)}if(s.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),r=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),r&&r.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(s),s.addEventListener("click",(()=>{"true"!==s.dataset.empty&&G(s)}))),_(a,o,t,n,!1))}}}function qe(e){const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ee(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Be(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Oe(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Oe(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),s=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),r=document.getElementById(s);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),r.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&te(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ue(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Oe(n,0,s),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let s=a.querySelector("audio");s=null!=s&&s;const r=Be(a.className),c=o.dataset?.mainid!==r?document.getElementById(r):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(r);const u=n.querySelector('.cut-character[data-character="'+r+'"]'),m=n.querySelector('.character-name[data-character="'+r+'"]');if(o&&(d=o.dataset.mainid===r?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===r&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&M(d,!1,!1,!1),""!==e&&(Ue(e,i,s,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ae()}}}function ke(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ue(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&te(t.dataset.music,Be(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Ie(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Be(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),s=JSON.parse(n.getAttribute("data-character-position")),r=Be(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,s=parseInt(a.style.top.replace("px",""))+25,r=t+a.offsetWidth-50,c=s+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>r&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<s?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Me(e,p,!1),"no"!==n.dataset?.npcfaceme&&D(g,a))}}(i,n.dataset.character,n),s&&0<s.length&&void 0!==s[0]&&"before"===s[0]?.trigger){window.allowCutscene=!1,"0"!==s[0]?.top&&Je(i,s[0].top,s[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+r+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ze(30),a&&M(a,!1,t,e),o&&M(c,n,t,e)}else Ee(e,t)}function Oe(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Be(e.className).replace(" ",""),o=e.dataset.boss,s=!!n&&document.getElementById(n),r=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}r&&r.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&He(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&te(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ze(30),g&&M(g,!1,!1,!1),t&&M(s,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Te(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Be(e.className))})),Se(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(J(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&Z(w,S,b,v),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),s&&"true"===s.dataset?.cutscenebreak&&(s.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ne(e)}}),100)}function Te(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),z(Be(e.className),"point",0,2e3,"",!0))}))}function Ae(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ne(e,t){const n=void 0!==e.className?Be(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),Z(n,a,t)}function Ce(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(F(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Me(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");F(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,s=n.style.top,r=parseInt(o,10),c=Re(parseInt(s,10),r,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=ye(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),s=ye(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=s+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=s+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?s+450-window.dragLeft.offset+"px":s+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Be(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Me(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const s=n&&C!==window.currentWeapon?window.currentWeapon:"",r=document.getElementById(o+s);r&&(a.classList.remove("engage"),r.classList.add("engage"),e.dataset.static="true")}}function Pe(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),s=C===o.dataset.weapon?"":"-"+o.dataset.weapon,r="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),r){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,$(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${r}-punch${s}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),r){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Ie(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let s=!1;if(o&&""!==o&&(s=document.querySelector("."+o+"-mission-item"),s&&(a=s.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&te(n,o);let a=null,r=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();r=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,s=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-r+"px",a.style.top=s-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function r(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(r(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),s=n.querySelector(".programming-subject"),r=a.querySelector("textarea");if(o&&s&&(o.classList.add("engage"),s.classList.add("engage")),a&&s&&r){a.prepend(s),r.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(s.querySelector("strong").textContent);r.addEventListener("keyup",(s=>{if(13===s.which){const s=a.querySelector("textarea");parseInt(s.value)===parseInt(o)&&(J(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Be(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Ie(Be(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&te(a,I)}(n))}}))}}(o,s,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Re(e,t,n){const a=e,o=t,s=!1!==n?".map-character-icon.engage, ":"",r=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===r.dataset.ability?':not([data-hazard="true"])':"";return De(document.querySelectorAll(s+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==s)}function De(e,t,n,a,o,s){const r=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===s?t:d;return e&&(!1===window.godMode&&!0!==s||!0===s)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&We(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===s?1:v,!w||h||y||f||(i.left=r+v,i.collide=!0),!h||w||y||f||(i.left=r-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function We(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,s=e.offsetTop,r=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||r+n<l-n||s-n>d+n)}function He(e,t,n,a,o){let s=e.dataset.type;s=s&&""!==s?s:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const r=document.querySelector(`#explore-points .${s}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(r&&0<i){if(c=r.dataset.amount,"point"===s){const e=parseInt(c)+parseInt(null!=i?i:"0");r.setAttribute("data-amount",e);const t=Xe(c),n=Xe(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}r.classList.add("engage"),setTimeout((function(){r.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(s),$(parseInt(c)+parseInt(i),s,t,n,o)}}function $e(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&he("",t,"programming")&&e.addEventListener("click",je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&he("",t,"programming")&&e.removeEventListener("click",je)}))}function ze(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Be(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,s=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,r=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=r<o?o-r:r-o;(c<s?s-c:c-s)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(J(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),z(Be(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),z(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,s={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const s=parseInt(e.style.top.replace("px","")),r=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=s<c,d=r<i,u=l?c-s:s-c,m=d?i-r:r-i,p=s<c-50,g=r<i-50,y=p?c-50-s:s-(c-50),f=g?i-(45+a.offsetWidth/2)-r:r-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),s=document.querySelector(".power-amount"),r=s.querySelector(".gauge"),c=s?s.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Je(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;s.setAttribute("data-amount",t),r.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(r,s)}function Je(e,t,n,a,o,s,r){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Ce()),Ee(r,s)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Xe(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ue(e,t,n,a){var o;let s=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):s=!0;const r=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==r&&t&&""!==t){s=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${r}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}s&&(window.nextDialogue=!0)}function Ve(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function _e(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=ee("health"),n=parseInt(t)-parseInt(e);Fe(),$(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");fe(25,k,e)}}),1e3)}function Fe(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ye(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ze(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911)})();1 (()=>{"use strict";var e={295:(e,t,n)=>{function a(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,n=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});n.on("select",(function(){const a=n.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===a.type)o.value=a.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=a.url);const r=document.getElementById("_product_video_url");r&&"video"===a.type&&(r.value=a.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===a.type&&(s.value=a.url)})),n.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let n=document.getElementById(`explore-character-images[${t}]`);if(n);else{const t=e.target.closest(".explore-image-field");t&&(n=t.querySelector(".explore-upload-field"))}n&&(n.value="")}))}n.d(t,{X:()=>a}),document.addEventListener("DOMContentLoaded",(function(){a()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,n)=>{n.d(t,{S:()=>r});var a=n(295),o=n(911);function r(){let e=!1;window.devmode=!1;let t=1;const n=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");n&&r&&(n.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const n=document.querySelector(".game-container").getBoundingClientRect(),a="menu"===c.dataset.type?e.clientX:e.clientX-n.left,o="menu"===c.dataset.type?e.clientY:e.clientY-n.top;c.style.left=a/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,n="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,a={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:n,meta:c.dataset?.meta};n===e&&(a.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const n=document.querySelector(".game-container"),a=document.getElementById("zoom-amount");if(n){let o=void 0!==n.style.transform&&""!==n.style.transform?n.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),a&&(a.textContent=(100*o).toString()),t=o,n.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const y=document.querySelector(".level-selector"),f=document.getElementById("select-level");y&&f&&f.addEventListener("click",(()=>{y.classList.add("engage"),y.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,n=e.dataset.name;(0,o.Z)(),(0,o.U)(n,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const n=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),n=document.getElementById("left-pinpoint");t.value=window.mouseY,n.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const n=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof a.X&&((0,a.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const n=function(e){const t=Object.fromEntries(e.entries()),n={};for(const[e,a]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=n;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=a}return n}(new FormData(e)),a=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:n};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const n=t.querySelector(".find-title"),a=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(a&&o){const n=a.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(n);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),a.addEventListener("click",(()=>{if(!0!==a.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),a=document.createElement("input");a.type="checkbox",t.textContent="Record Walking Path",t.appendChild(a),o.appendChild(t),a.addEventListener("change",(()=>{e=!!a.checked&&n}))}t.appendChild(o),a.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:n,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),a.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),a.classList.remove("created"),s.style.display="none"}))}}))}n.addEventListener("click",(e=>{const n=e.target.closest(".find-explore-item"),a=document.querySelector("."+n.dataset.class+'[data-genre="'+n.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),a&&(r.style.left=parseInt(a.style.left.replace("px",""))-200+"px",r.style.top=parseInt(a.style.top.replace("px",""))-200+"px",a.scrollIntoView(),a.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}n&&n.length&&n.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const y=document.getElementById("engage-wallbuilder"),f=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(y){y.addEventListener("click",(()=>{f.classList.toggle("engage"),f.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const n=document.createElement("div");n.draggable=!0;const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t;function s(e){if(h&&n){const a=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-a.left)/t,r=(e.clientY-a.top)/t,s=parseFloat(n.style.left.replace("px","")),c=parseFloat(n.style.top.replace("px",""));n.style.width=o-s+"px",n.style.height=r-c+"px"}}n.className="wp-block-group map-item",n.style.left=o-b+"px",n.style.top=r-S+"px",n.style.backgroundColor="rgb(0,146,255)",n.style.opacity="0.3",n.style.zIndex="1",n.dataset.genre="explore-wall",w.appendChild(n),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let a=document.querySelector(".game-container");a=a.className.replace("game-container ","");const o=n.style.top.replace("px",""),r=n.style.left.replace("px",""),c=n.style.width.replace("px",""),i=n.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=a?a:"",values:{title:"wall-"+a+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{n.id=e.data,n.className=n.className+" wall-"+a+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",n.dataset.width=c,n.dataset.height=i,n.addEventListener("dragstart",d),n.addEventListener("mouseup",m)}))}else n.addEventListener("dragstart",d),n.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,n)=>{n.d(t,{U:()=>Ce,Z:()=>pe});var a=n(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,y,f,w,h="",v=!1,b=!1,S=0,L=!1,x=!1,q=!1,E=!1,k=!1,I="",O=!1,T=400,A=400,N=0;const C=OrbemOrder.defaultWeapon;let B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const n=document.querySelector("#map-character");if(t&&n){const t=void 0===n.dataset.currentchar?window.mainCharacter:n.dataset.currentchar,a=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(a){a.forEach(((e,t)=>{if(o[t]){const n=e.src;e.src=o[t].src,o[t].src=n}}));const t=n.dataset.ability,r=n.dataset.name;n.dataset.currentchar=e.dataset.charactername,n.dataset.ability=e.dataset.ability,n.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(n.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]'));break;case"programming":Q(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Be();break;case"strength":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Be(),Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,Q(document.querySelector('.storage-item[title="'+n.dataset?.weapon+'"]')),Be()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(e,t,n,a){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,y=0,f=!0,w=!1;const h=Me(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,y=function(e,t,n,a,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-n,t-a)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===y-1||f?((r>m||f&&r===m)&&(x&&x.classList.remove("engage"),d=de(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===f?r>p?(g=0,f=!0,0!==p?m++:m=0):"true"===l?(f=!0,m=r,g=0,ke(a,n)):r===p&&(clearInterval(o),ke(a,n)):(f=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(W(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(y+=1,m=0<m?m-1:r,W(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else de(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(function(e,t,n){let a=$([]),o="",r=!1,s=!1,c=!1,i=!1,l=0,d=0,u="",m=0;(function t(){const a=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{H(n,e),t()}),a)})(),setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){const t=e.style.left.replace("px",""),p=e.style.top.replace("px",""),g=De(p,t,e);switch(a){case"down":e.style.top=g.top+1+"px";break;case"up":e.style.top=g.top-1+"px";break;case"left":e.style.left=g.left-1+"px";break;case"right":e.style.left=g.left+1+"px"}switch(u=o,((g.left>t||g.left<t)&&!0===g.collide&&!1===r&&("left"===a||"right"===a)||!0===g.collide&&g.top>p)&&(o=m%2==0?"down":"up"),(("down"===o&&g.top<p||"up"===o&&g.top>p)&&!0===g.collide&&("left"===a||"right"===a)||g.left>t&&!0===r)&&(o="down"===o?"up":"down",r=!0),g.top>p&&!0===g.collide&&!0===r&&("left"===a||"right"===a)&&(i=!0),!(g.top>p||g.top<p)||!0!==g.collide||!1!==s||"up"!==a&&"down"!==a||(o=m%2==0?"left":"right"),(("left"===o&&g.left>t||"right"===o&&g.left<t)&&!0===g.collide&&("up"===a||"down"===a)||g.top>p&&!0===s)&&(o="left"===o||"down"===o?"right":"left",s=!0),g.left<t&&!0===g.collide&&!0===s&&(c=!0),(!0===s&&!0===c||!0===i&&!0===r)&&(o="",a=$(a),s=!1,c=!1,i=!1,r=!1,m++),o){case"down":"up"!==a?e.style.top=g.top+1+"px":o="";break;case"up":"down"!==a?e.style.top=g.top-1+"px":o="";break;case"left":"right"!==a?e.style.left=g.left-1+"px":o="";break;case"right":"left"!==a?e.style.left=g.left+1+"px":o=""}!1===g.collide?l++:(l=0,u!==o&&d++),d>100&&(H(n,e),o=""),l>20&&(d=0,r=!1,i=!1,s=!1,c=!1,o="",m++)}else a=$(a)}),t)}(e,c,i),ke(a,n));window.allowCutscene=!0}else ke(a,n)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),n=document.getElementById("item-description");n&&(n.innerHTML=""),t&&t.classList.remove("engage");const a=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),a&&a.classList.add("engage")}))}))}function D(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&K(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),n=document.getElementById("music-volume"),a=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(a&&n&&o&&(window.sfxVolume=a.value/100,window.talkingVolume=o.value,n.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),a.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{n&&a&&o&&function(e,t,n){if(!1===B)return;const a={music:e,sfx:t,talking:n};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n.value,a.value,o.value)})))}function W(e,t){const n=t.querySelector(".character-icon.engage"),a=Me(t.className);n&&n.classList.remove("engage");const o=document.getElementById(a+"static-"+e);o&&o.classList.add("engage")}function H(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function $(e){const t=Array.isArray(e)?e:[e],n=["up","down","left","right"].filter((e=>!t.includes(e)));return 0===n.length?null:n[Math.floor(Math.random()*n.length)]}function z(e,t,n,a,o){!0===a&&_(n,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!1===Array.isArray(n)?OrbemOrder.explorePoints[t].positions.push(n):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(n)&&!0===Array.isArray(n)&&n.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=J(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const n=t.dataset.unlockable;parseInt(e)>=parseInt(n)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,n={spellid:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),n=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,E=!1,k=!1,j("projectile","health",100,0,"true",!1),n&&Y(n.dataset.startleft,n.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==n&&!0===["money","point","health","mana"].includes(t)&&n!==o&&j(n,t,e,2e3,"",!1)}function j(e,t,n,a,r,s){if(!1===B)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===n||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(n="health"!==t?te(t)+n:J(t)-n),o=setTimeout((()=>{const e={type:t,item:i,amount:n,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),a))}function J(e){return e/window.nextLevelPointAmount*100+"%"}function X(e,t,n){clearTimeout(r),r=setTimeout((()=>{const a=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.style.display="block"})),a){const o=parseInt(a.dataset.points),r=a.dataset.hazardremove,s=a.dataset.ability;U(a);const i=a.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+a.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),a.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(n)&&!1===n.includes(e)||!1===Array.isArray(n)&&n!==e)&&j(e,"point",0,2e3,"",!0)}))}if(setTimeout((()=>{a.remove(),s&&"transportation"===s&&(ze(),function(){if(!1===B)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll('[data-showaftermission="'+e+'"]');t&&(t.forEach((e=>{c.push(Me(e.className)),e.classList.add("materialize")})),Le(I,c))}),500),t&&o>0){const a=document.querySelector(`.map-cutscene[data-mission="${e}"]`);a&&Oe(Me(a.className),!1),$e(t,n,!0,o,e)}else t&&0===o&&j(n,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function U(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function V(e,t,n,a,o){const r={type:e,itemid:t,amount:n,unequip:a};"weapons"===e&&(window.currentWeapon=C!==o?"-"+o:""),!1!==B&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),Pe(document.getElementById("map-character"),"down",!0)}))}function _(e,t){const n=document.querySelector('.retrieval-points span[title="'+e+'"]'),a=n.getAttribute("data-count");n&&(a&&1<a?n.setAttribute("data-count",a-1):(n.setAttribute("data-type",""),n.setAttribute("data-id",""),n.setAttribute("data-value",""),n.setAttribute("title",""),n.setAttribute("data-empty","true"),n.setAttribute("data-count","")),F(0,e,t,0,!0))}function F(e,t,n,a,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:a,type:n,remove:o};!1!==B&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Y(e,t){if(!1===B)return;const n=`${OrbemOrder.siteRESTURL}/coordinates/`,a={left:e.replace("px",""),top:t.replace("px","")};fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150),I=document.querySelector(".game-container"),window.mainCharacter=I.dataset?.main,I=I.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const n=document.getElementById("unmute");n&&n.addEventListener("click",(()=>{e.muted=!e.muted,n.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),_e(!0))}));const a=document.getElementById("skip-intro-video");a&&a.addEventListener("click",(()=>{e.pause(),t&&t.remove(),_e(!0)}))}else _e(!0);const t=document.getElementById("explore-create-account"),n=document.getElementById("explore-login-account"),a=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&a&&n&&(t.addEventListener("click",(()=>{a.style.display="none",o.style.display="block",t.style.display="none",n.style.display="block"})),n.addEventListener("click",(()=>{a.style.display="block",o.style.display="none",n.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&ze(),document.addEventListener("keydown",je),document.querySelector(".action-key").addEventListener("click",je);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=C!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),n=document.querySelector("#weapon"),a=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");n.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),a.className="map-weapon",a.classList.add(o),a.classList.add(r),a.classList.add("spell"),a.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(me(),i.classList.remove("engage")):me();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),n=e.querySelector(".gauge");if(n&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),n.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const a=Ue(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],e.setAttribute("data-amount",t),n.style.width=J(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){pe()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),D(),R();const y=document.getElementById("new-explore");y&&y.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost."),await async function(){if(!1===B)return;const e=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3)}))}));const Z=function(){let e=!1;return function(t,n){if(n&&t&&He(t,n,0)&&!1===e){if("explore-enemy"===n.dataset.genre&&!1===t.classList.contains("protection")){var a;const e=n.dataset.health,o=n.dataset.healthamount,r=n.dataset.mission;let s=!0===t.classList.contains("heavy-engage")?"heavy":"normal";s=!0===t.classList.contains("charge-attack-engage")?"charged":s;const c=parseInt(JSON.parse(t.dataset.strength)[s])+window.attackMultiplier,i=0<=e-c?e-c:0,l=null!==(a=n.dataset.weapon)&&void 0!==a?a:"";if((""!==l&&t.dataset.weapon===l||""===l)&&n.setAttribute("data-health",i),"boss"===n.getAttribute("data-enemy-type")&&(i<=.75*o&&!1===L?(L=!0,oe(n)):i<=.5*o&&!1===x?(x=!0,oe(n)):i<=.25*o&&!1===q&&(q=!0,oe(n))),0===i){clearInterval(window.shooterInt),clearInterval(window.runnerInt),n.remove();const e=Me(n.className),t=`${OrbemOrder.siteRESTURL}/enemy/`,a={health:0,position:e};!1!==B&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),r&&he(r)&&X(r,n,r)}}e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),G=function(){window.runningPointFunction=!1;let e=!1;return function(t,n,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),B=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,_e(!1),window.allowMovement=!1,clearInterval(window.shooterInt),clearInterval(window.runnerInt);const d=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");d&&d.forEach((e=>{e.remove()}));const u=document.querySelector(".right-bottom-devmode"),m=document.querySelector(".dev-mode-menu");m&&u&&(m.remove(),u.remove());const p=document.querySelector(".explore-item-list");p&&(p.innerHTML="");const g=document.querySelector(".default-map");if(g&&g.remove(),!1===e){const n=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let n=e;n=n.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";n["dev-mode"]&&""!==n["dev-mode"]&&(u=n["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=n["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=n["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{U(e),e.remove()}),500))}d&&d.append(m),g&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=n["start-top"],t.dataset.startleft=n["start-left"],t.innerHTML=n["map-explainers"]+n["map-items"]+n["map-cutscenes"]+n.minigames+n["map-svg"]+n["map-communicate"],"yes"===n["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=n["menu-explainers"]+n["fullscreen-explainers"]+e.innerHTML+t.outerHTML,D(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=n["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),Fe(),document.querySelector('main[devmode="true"]')&&(0,a.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{P(e,!1,!1,!1)})),ge(),ye(),Ie();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}if("yes"===n["is-cutscene"]){const e=Me(document.querySelector(".map-cutscene").className);Oe(e,!0),window.previousCutsceneArea=e,Ee(window.previousCutsceneArea)}else Ne();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const n=Me(i[e].className);!1===B?window.crewCharacters.push(n):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,n={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(n),e++}),1e3)}me()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),a=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(n["start-top"]=JSON.parse(r).top,n["start-left"]=JSON.parse(r).left),a.style.top=n["start-top"]+"px",a.style.left=n["start-left"]+"px",a.className=n["start-direction"]+"-dir",a.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),Pe(a,n["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",I=t,ne(i,t),window.allowMovement=!0,s.style.display="block",(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||n["explore-ability"]&&n["explore-ability"].includes("transportation"))&&ze()}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),K=function(){let e=!1;return function(t){const n=t.getAttribute("data-id"),a=document.querySelector(".storage-item.engage");if(a&&a.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,a={id:n};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let n=e;n=n.data;const a=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),a.innerHTML=n,a.appendChild(c),a.appendChild(s),a.appendChild(r);const i=a.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>te(m)&&i.addEventListener("click",(()=>{$e(o,d),a.innerHTML=""})),c&&c.addEventListener("click",(()=>{_(d,m),a.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img");n&&a&&(a.src=e.src,n.dataset.weapon=t.title,n.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}ee(!1),a.innerHTML="",V(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),ee(!0),a.innerHTML="",V(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function Q(e){if(e){const t=e.querySelector("img"),n=document.querySelector(".map-weapon"),a=document.querySelector(".weapon-content img"),o=n.querySelector("img");n&&a&&(o.src=t.src,a.src=t.src,n.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",n.dataset.strength=e.dataset.strength,n.dataset.projectile=e.dataset.projectile,window.currentWeapon=C!==e.title?"-"+e.title:"")}}function ee(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),n=document.querySelector("#explore-points .health-amount"),a=document.querySelector("#explore-points .mana-amount");let o=parseInt(a.dataset.amount),r=parseInt(n.dataset.amount),s=parseInt(a.style.width.replace("px","")),c=parseInt(n.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),n=t.getAttribute("data-subtype");"health"===n&&(r+=parseInt(e),c+=parseInt(e)),"mana"===n&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),n=e.getAttribute("data-subtype");"health"===n&&(r-=parseInt(t),c-=parseInt(t)),"mana"===n&&(o-=parseInt(t),s-=parseInt(t))}t&&(n.style.width=c+"px",n.setAttribute("data-amount",r),n.querySelector(".gauge").style.width=r+"px",a.style.width=s+"px",a.setAttribute("data-amount",o),a.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function te(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function ne(e,t){if(!e||""===e)return;const n=document.createElement("audio");n.setAttribute("loop",""),n.src=e,n.id=t,document.body.appendChild(n);const a=document.getElementById("music-volume");a&&n&&(n.volume=a.value/100),window.currentMusic&&window.currentMusic.pause(),n&&(n.play(),window.currentMusic=n)}function ae(e,t){const n=e.getAttribute("data-enemy-type");t&&t.remove(),"shooter"===n&&re(e),"runner"===n&&(window.runnerInt=setInterval((()=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelectorAll(".default-map svg rect, .protection");let o=parseInt(n.style.left,10),r=parseInt(n.style.top,10);const s=document.getElementById("map-character");if(o<parseInt(s.style.left.replace("px",""))+400?o+=1:o-=1,r<parseInt(s.style.top.replace("px",""))+400?r+=1:r-=1,a&&n){const e=We(a,n.getBoundingClientRect(),r,o,!0,!1);n.style.left=e.left+"px",n.style.top=e.top+"px"}}),20)),"boss"===n&&(oe(e),w=setInterval((()=>{const e=document.querySelector(".pulse-wave-container");ce(e,document.querySelector(".map-character-icon.engage"),document.querySelector(".game-container"))?(E=!0,window.theHazardValue=e.dataset.value):E=!1}),20))}function oe(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[S]+"-wave-engage"),"pulse-wave"===t[S]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[S]?re(e):clearInterval(m)),S++}function re(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const n=document.querySelector(".map-character-icon.engage"),a=n.getBoundingClientRect().left+n.width/2,o=n.getBoundingClientRect().top+n.width/2,r=e.querySelector(".projectile");r&&se(r,a,o,e,t,!1,".projectile","no")}),5e3)}function se(e,t,n,a,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,n,a,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=ue(o),d=ue(i);de(d.x,d.y,l.x,l.y,e,a);const u=Math.atan2(n-c.top,t-c.left),m=t+800*Math.cos(u),p=n+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,n,o,a):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),le(e,t,n),a=document.querySelector(".game-container")):"yes"===c&&(le(e,t,n),a=document.querySelector(".game-container"));const l=setInterval((function(){const e=a.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const n=document.querySelector(".game-container");requestAnimationFrame((function a(){if(document.body.contains(e)){for(const a of t)if(ce(e,a,n)){if(!0===a.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),n=document.querySelector("#explore-points .health-amount"),a=parseInt(n.getAttribute("data-amount"));if(n&&0<=a){const e=a>=t?a-t:0;Ye(),z(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(a)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}a.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function ce(e,t,n){const a=ie(e,n),o=ie(t,n);return!(a.right<o.left||a.left>o.right||a.bottom<o.top||a.top>o.bottom)}function ie(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return{top:n.top-a.top,left:n.left-a.left,width:n.width,height:n.height,right:n.right-a.left,bottom:n.bottom-a.top}}function le(e,t,n){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=n+"px"}function de(e,t,n,a,o,r){const s=.075*Math.hypot(e-n,t-a)*r;let c="down";const i=Math.abs(t-a),l=Math.abs(e-n);return o.style.transition="all "+s+"ms linear 0s",t>a&&i>l?c="up":t<a&&i>l?c="down":e<n&&l>i?c="right":e>n&&l>i&&(c="left"),c}function ue(e){const{top:t,left:n,width:a,height:o}=e.getBoundingClientRect();return{x:n+a/2,y:t+o/2}}function me(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,n=t?null:document.querySelector("."+e+"-map-item"),a=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),n=t.parentNode;t&&(t.classList.add("engage"),c.remove()),n&&!1===n.classList.contains("dependent")&&n.classList.add("dependent")}a&&a.classList.add("been-viewed"),o&&o.classList.add("already-hit"),n&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene}(n)&&(n.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===n.dataset?.disappear&&Se(n),n.classList.add("no-point"))}));const n=document.querySelectorAll(".map-item-modal.graeme"),a=document.querySelectorAll(".map-item-modal");a&&a.forEach((e=>{e.classList.remove("engage")})),n&&n.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[I]&&0<OrbemOrder.exploreMaterializedItems[I].length&&OrbemOrder.exploreMaterializedItems[I].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function pe(){var e,t;B=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const n=document.querySelector(".game-container"),a=document.querySelector(".touch-buttons");window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"";const o=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");o&&o.forEach((e=>{e.classList.add("engage")})),_e(!1),Ie(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),ge();const r=document.getElementById("characters"),s=!!r&&r.querySelectorAll(".character-item");r&&0<s.length&&(r.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",a&&a.classList.add("do-mobile");let i="";OrbemOrder.musicNames&&I&&(i=JSON.parse(OrbemOrder.musicNames)[I]),ne(i,I);const l=document.getElementById("explore-points"),d=document.getElementById("missions");l&&(l.style.opacity="1"),d&&(d.style.opacity="1");const m=document.getElementById("key-guide");Ze(m,"engage"),Ze(a,"engage"),window.buttonShow=setInterval((function(){Ze(a,"engage"),Ze(m,"engage")}),1e4);const p=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(p&&p.forEach((e=>{P(e,!1,!1,!1)})),ye(),function(){let e=!1;document.addEventListener("keydown",(t=>{const n=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(v=!0),"Space"===t.code&&(b=!0,u=setTimeout((()=>{!0===b&&(n.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",Re),document.querySelector(".action-key").addEventListener("click",Re)}(),Be(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&I){const e=Me(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ee(window.previousCutsceneArea),Oe(e,!0)}if(""!==window.previousCutsceneArea){Ae(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push(Me(e.className)),e.classList.add("no-point")})),Le(I,c))}Fe(),n&&(n.style.display="block");const g=document.getElementById("map-character");g&&g.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),setTimeout((()=>{Ne()}),1e3)}function ge(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="none"),a&&(a.style.display="none")}))}function ye(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,n=Me(e.className),a=document.querySelectorAll('[data-materializemission="'+n+'"]');if(a&&a.forEach((e=>{e.style.display="none"})),t&&""!==t){const n=JSON.parse(t);if("0"!==n.height){const t=document.createElement("div"),a=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+a+"-blockade",t.style.top=n.top+"px",t.style.left=n.left+"px",t.style.width=n.width+"px",t.style.height=n.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function fe(e,t,n,a,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),y=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=Me(e.className);e.classList.contains("enemy-item")&&Z(m,e);const n=document.querySelector("."+t+"-drag-dest-map-item");let a=!1;n&&!1===e.classList.contains("no-point")&&(a=document.querySelector("."+n.dataset.mission+"-mission-item"),null===a&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=Me(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&He(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Oe(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const n=document.querySelector("."+e+"-map-communicate"),a=n.parentNode;a.classList.add("notify"),t&&(t.remove(),j(n.id,"communicate",a.id,2e3,"",!1)),n.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&He(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(xe(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(xe(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void Ce(e,"false");if("true"===e.dataset.hazard&&!1===ve(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,n=te("health")-parseInt(t);Ye(),z(n,"health","hazard",!1,""),we(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===ve(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(E=!0,window.theHazardValue=e.dataset.value,k=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(n&&(a=document.querySelector("."+n.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&ve(e,l,"strength")&&a&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===e.dataset.genre&&ae(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),n=e=>{("keydown"===e.type&&"Space"===e.code||"click"===e.type)&&(window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",n))};if(t){var v;t.classList.add("show-explainer"),t.style.zIndex="10",e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1,Ve(Array.from(t.querySelector("p").childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const a=t.querySelector("img");if(a){const e=parseInt(a.dataset.rotate);let t=!1,n=!1,o=!1;if(a&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,n=`rotate(${e}deg) translate( 10px, 10px )`,o=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,n=`rotate(${e}deg) translate( -10px, -10px )`,o=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:n},{transform:o}],r={duration:1e3,iterations:1/0};a.animate(e,r)}}document.addEventListener("click",n),document.addEventListener("keydown",n),j(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(P(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),qe(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&$e(e,Me(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&X(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?Me(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger")&&("engagement"!==e.dataset.triggertype?(e.dataset.mission&&""!==e.dataset.mission&&X(e.dataset.mission,e,t),Oe(t,!1),""===t&&Le(y,[Me(e.className)]),e.remove()):(e.classList.add("engage"),xe(document.querySelector("."+r.dataset?.character+"-map-item"),!0,e,!1))),!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=Me(e.className),n=document.querySelector("."+t+"-map-item"),a=document.querySelector("."+t+"-drag-dest-map-item");n&&(n.style.display="block"),a&&(a.style.display="block"),c.push(t),s=setTimeout((()=>{Le(y,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&be(e),clearTimeout(g),g=setTimeout((()=>{E=!1,k=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&He(m,e,0)){const n=Me(e.className),a=document.querySelector('[data-timertriggee="'+n+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((a||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const n="true"===r.dataset.removable?"":[t,Me(r.className)];X(e.dataset.mission,e,n),r.style.display="none",e.style.display="none"}else if(a||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(a.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===O){O=!0;const t=document.createElement("div");t.className="timer-countdown";let n=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=n;const a=document.querySelector(".game-container");a&&a.appendChild(t),f=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(n=t),e.textContent=0<n?n-1:0,"0"===e.textContent&&(e.remove(),clearInterval(f),O=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&ve(e,l,"strength")&&null===a&&void 0===o&&he(e.dataset.mission)){const n=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);n&&(t=[],n.forEach((e=>{t.push(Me(e.className))}))),X(e.dataset.mission,e,t)}"true"===e.getAttribute("data-breakable")&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(qe(e),"point"===e.dataset.type&&$e(e,Me(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==he(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!ve(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&be(e):e.remove()}})),a[37]||a[38]||a[39]||a[40]||a[87]||a[65]||a[68]||a[83]){const e=!0===a[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(a)),t=window.isDragging;let n,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),n=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+n+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(a[t]?o:0)+(a[n]?o:0);return v<0?0:v>h?h:v}function we(e,t,n){let a=parseInt(n.style.left.replace("px","")),o=parseInt(n.style.top.replace("px",""));t&&(a=a+400<parseInt(t.style.left.replace("px"))?a-e:a+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,n.style.left=a+"px",n.style.top=o+"px")}function he(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),n=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===n.length}function ve(e,t,n){return"strength"===n?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:n===t.dataset.ability}function be(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Se(e)}function Se(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Le(e,t){if(!1===B)return;const n={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function xe(e,t,n,a){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){const r=e.style.left.replace("px",""),s=e.style.top.replace("px",""),c=e.getBoundingClientRect().width/2-7.5,i=Me(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=n.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===a&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function qe(e){const t=e.getAttribute("data-type"),n=e.getAttribute("data-value"),a=e.id,o=Me(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",a),r.setAttribute("data-value",n),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const n=document.createElement("img");n.setAttribute("src",e.dataset.image),n.setAttribute("width","80px"),n.style.objectFit="contain",r.append(n)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&K(r)}))),F(a,o,t,n,!1))}}}function Ee(e){if(!1===B)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function ke(e,t){if(!1===e&&!1===t)return;const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:Me(e.className),!n||void 0!==n.dataset?.video&&"false"!==n.dataset?.video){if(n&&"true"===n.dataset?.video&&!1===n.classList.contains("been-viewed")){const e=n.querySelector("video");if(window.allowMovement=!1,n.classList.add("engage"),e){"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Te(n,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Te(n,0,!1)}))}}}else{const a=n.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===n.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),n.classList.add("engage"),n.dataset.music&&""!==n.dataset.music&&ne(n.dataset.music,e),"yes"===n.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=a[0];a[0]&&a[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=a[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,n)=>{clearTimeout(d),n<t.length?(e.innerHTML+=t.charAt(n),n++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(n))&&(u=0),m(e,t,n)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==h&&(h.pause(),h.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=n.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(a.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const n=e.querySelector("p"),a=n.innerText;n.innerText="",m(n,a,0),y(),Ve(a,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),n.classList.remove("engage"),n.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,a[0].classList.add("engage"),Te(n,0,r),n.style.removeProperty("position"),n.style.removeProperty("display"),n.style.removeProperty("width"),n.style.removeProperty("max-height"),n.style.removeProperty("height"),n.style.removeProperty("transform"),n.style.removeProperty("left"),n.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key"))&&a&&n.classList.contains("engage")&&p()};n.classList.add("been-viewed"),window.allowCutscene=!0;const y=(e="")=>{const a=n.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=a.querySelector("audio");r=null!=r&&r;const s=Me(a.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=a.dataset.voice,l=a.dataset?.triggerpath;let d=document.getElementById(s);const u=n.querySelector('.cut-character[data-character="'+s+'"]'),m=n.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&n){let e=parseInt(c.style.left.replace("px",""))-n.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),n.style.left=e+"px",n.style.top=t+"px";const a=document.querySelector(".engage.character-name");a&&(a.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=n.querySelector(".engage.cut-character"),t=n.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"))}l&&d&&P(d,!1,!1,!1),""!==e&&(Ve(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};y(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),!0===t&&Ne()}}}function Ie(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const n=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),a=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===a&&!0===e.classList.contains("engage")?((e="")=>{const n=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let a=n.querySelector("audio");a=null!=a&&a;const o=n.dataset.voice;""!==e&&Ve(e,o,a,!1)})(n[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&ne(t.dataset.music,Me(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Oe(e,t){const n=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,a=document.getElementById("map-character"),o=Me(n.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+a?.dataset?.mainid+")")?.className),r=JSON.parse(n.getAttribute("data-character-position")),s=Me(n.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,n){const a=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(a){const t=parseInt(a.style.left.replace("px",""))+25,r=parseInt(a.style.top.replace("px",""))+25,s=t+a.offsetWidth-50,c=r+a.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(Pe(e,p,!1),"no"!==n.dataset?.npcfaceme&&W(g,a))}}(i,n.dataset.character,n),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Xe(i,r[0].top,r[0].left,!0,n,t,e);const a=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==n.dataset?.path;(a||o)&&Ge(30),a&&P(a,!1,t,e),o&&P(c,n,t,e)}else ke(e,t)}function Te(e,t,n){e.classList.remove("engage"),window.nextAreaMissionComplete="";const a=Me(e.className).replace(" ",""),o=e.dataset.boss,r=!!n&&document.getElementById(n),s=document.querySelector(".indicator-icon"),i=e.dataset?.communicate,l=document.querySelectorAll('[data-materializecutscene="'+a+'"]'),d=document.querySelectorAll('[data-removeaftercutscene="'+a+'"]');if(l&&0<l.length&&l.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&0<d.length&&d.forEach((e=>{e.remove()})),i&&""!==i){const e=document.querySelector("."+i+"-map-item");e&&e.classList.add("dependent")}s&&s.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&$e(e,a,!1,e.dataset.value,"");const u=document.querySelector('[data-character="'+window.mainCharacter+'"]');u&&u.classList.remove("engage");let m="";OrbemOrder.musicNames&&(m=JSON.parse(OrbemOrder.musicNames)[I]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&m&&ne(m,I),""!==h&&(h.pause(),h.currentTime=0);const p=JSON.parse(e.getAttribute("data-character-position")),g=document.querySelector('[data-trigger-cutscene="'+a+'"]');if(p&&0<p.length&&void 0!==p[0]&&"after"===p[0]?.trigger){const t=void 0!==e.dataset?.path;(g||t)&&Ge(30),g&&P(g,!1,!1,!1),t&&P(r,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&Ae(y,a);const f=document.querySelectorAll('[data-showaftercutscene="'+a+'"]');f&&(f.forEach((e=>{e.classList.add("no-point"),c.push(Me(e.className))})),Le(I,c));const w=e.dataset.nextarea,v=e.getAttribute("data-nextarea-position"),b=e.dataset.mapurl,S=document.querySelector(".map-weapon"),L=e.dataset.missioncomplete;L&&(X(L,document.querySelector("."+L+"-mission-item"),L),window.nextAreaMissionComplete=L),w&&G(w,S,b,v,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",g&&"true"===g.dataset?.cutscenebreak&&(g.dataset.cutscenebreak="false"),r&&"true"===r.dataset?.cutscenebreak&&(r.dataset.cutscenebreak="false"),o&&""!==o){const e=document.querySelector("."+o+"-map-item");e&&ae(e)}}),100)}function Ae(e,t){e.forEach((e=>{t===e.dataset.removeaftercutscene&&(e.remove(),j(Me(e.className),"point",0,2e3,"",!0))}))}function Ne(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function Ce(e,t){const n=void 0!==e.className?Me(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const a=document.querySelector(".map-weapon");a&&(a.style.display="none"),G(n,a,t,!1,window.crewCharacters)}function Be(){const e={};let t=!1;function n(t,n){const a=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==n||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,n=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&n===window.charCurrentTop||(Y(t,n),window.charCurrentLeft=t,window.charCurrentTop=n,clearInterval(window.coordinateTimeout))}),1e3),Pe(a,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(n){e[n.which]=!0,t=n.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){n(e,!1)})),document.addEventListener("touchend",(function(e){n(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Y(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const n=document.getElementById("map-character"),a=document.querySelector(".map-weapon"),o=n.style.left,r=n.style.top,s=parseInt(o,10),c=De(parseInt(r,10),s,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=fe(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=fe(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);n.style.top=o+"px",n.style.left=r+"px",a&&!0===window.weaponConnection&&(a.style.top=o+T+"px",a.style.left=r+A+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),n.scrollIntoView({block:"nearest"})}}),16)}function Me(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace("mission-trigger ","").replace(" hit","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function Pe(e,t,n){const a=document.querySelector(".map-character-icon.engage");if(a&&""===window.currentCharacterAutoDirection||a&&""!==t){let o=a.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=n&&C!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(a.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function Re(e){let t=!1,n=200,a=!1;const o=document.querySelector(".map-weapon"),r=C===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(v=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(b=!1,clearTimeout(u),o&&!1===a)){const e=o.classList.contains("spell");if(n=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){switch(o.classList.add("engage"),s){case"up":T=310;break;case"down":T=490;break;case"left":A=350;break;case"right":A=450}i&&(i.classList.add("punched"),l.classList.add("engage"))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,z(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===a&&!1===v)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}}),n);else if(!0===v){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),a=!0,setTimeout((()=>{switch(a=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":T=400;break;case"left":case"right":A=400}v=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),n=parseInt(o.style.top.replace("px",""));const a=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":n+=1e4;break;case"top":n-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}se(o,t,n,document,2,e,a,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,n=e.dataset?.sign,a=e.dataset?.minigame,o=!!a&&document.querySelector("[data-minigame="+a+"]");t&&""!==t&&(Oe(t,!1),e.dataset.cutscene=""),n&&""!==n&&(function(e){const t=document.querySelector("."+e+"-map-item");function n(e){("Space"===e.code||e.target.classList.contains("action-key"))&&(t.classList.remove("open-up"),document.removeEventListener("keydown",n),document.querySelector(".action-key").removeEventListener("click",n))}t.classList.add("open-up"),document.addEventListener("click",(e=>{!1===e.target.classList.contains("action-key")&&t.classList.remove("open-up")}),{once:!0}),document.addEventListener("keydown",n),document.querySelector(".action-key").addEventListener("click",n)}(n),e.dataset.sign=""),a&&o&&""!==a&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const n=t.dataset.music;let a=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(a=r.classList.contains("engage"))),a){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),n&&""!==n&&ne(n,o);let a=null,s=0,c=0;const i=e=>{if(e.preventDefault(),a=e.target,a){const t=a.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(a){const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top;a.style.position="fixed",a.style.zIndex="9",a.style.left=o-s+"px",a.style.top=r-c+"px"}},d=()=>{if(a){a=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),n=t.querySelectorAll("ellipse"),a=e.querySelector(".draggable-images");function s(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom)}(function(e,t){for(const n of t){let t=!1;for(const a of e)if(s(a,n)){t=!0;break}if(!t)return!1}return!0})(a.querySelectorAll(".minigame-draggable-image"),n)&&(t.style.display="none",a.style.display="none",function(e,t,n){const a=n.querySelector(".programming-output"),o=n.querySelector(".minigame-programming"),r=n.querySelector(".programming-subject"),s=a.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),a&&r&&s){a.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const n=e.charCodeAt(0).toString(2);t+=("00000"+n).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=a.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(X(e,t,e),n.classList.remove("engage"),window.allowMovement=!0,function(e){const t=Me(e.className),n=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');n&&Oe(Me(n.className),!1);let a="";OrbemOrder.musicNames&&(a=JSON.parse(OrbemOrder.musicNames)[I]),e.dataset.music&&""!==e.dataset.music&&a&&ne(a,I)}(n))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function De(e,t,n){const a=e,o=t,r=!1!==n?".map-character-icon.engage, ":"",s=document.getElementById("map-character"),c=!1!==(n=n||document.querySelector(".map-character-icon.engage"))&&"hazard"===s.dataset.ability?':not([data-hazard="true"])':"";return We(document.querySelectorAll(r+".default-map svg rect, .map-item"+c+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item'),n,parseInt(a),parseInt(o),!1,""!==r)}function We(e,t,n,a,o,r){const s=a,c=n,i={top:n,left:a,collide:!1},l=document.getElementById("map-character"),d={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-t.offsetWidth/2),offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+(400-t.offsetHeight/2),offsetHeight:t.offsetHeight},u=!0===r?t:d;return e&&(!1===window.godMode&&!0!==r||!0===r)&&e.forEach((e=>{let n=e;if(!0===n.id.includes("mc-")&&(n=d),t!==e&&He(u,n,0)){const e=n.offsetLeft+n.offsetWidth,t=n.offsetLeft,a=n.offsetTop,l=n.offsetTop+n.offsetHeight,d=u.offsetLeft+u.offsetWidth,m=u.offsetLeft,p=u.offsetTop,g=u.offsetTop+u.offsetHeight;i.collide=!0;const y=l>p&&a<p&&l<p+10,f=a<g&&l>g&&a>g-10,w=e>m&&t<m,h=t<d&&e>d;let v=!0===o?5:window.moveSpeed;v=!0===r?1:v,!w||h||y||f||(i.left=s+v,i.collide=!0),!h||w||y||f||(i.left=s-v,i.collide=!0),y&&!f&&(i.top=c+v,i.collide=!0),f&&!y&&(i.top=c-v,i.collide=!0)}})),i}function He(e,t,n){const a=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(a+n<i-n||o+n>c-n||s+n<l-n||r-n>d+n)}function $e(e,t,n,a,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===n?parseInt(a):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ue(c),n=Ue(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],t!==n){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+n,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const a=document.querySelector(".my-points");a&&(a.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const n=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const n=document.getElementById("ching");n&&(n.volume=window.sfxVolume,n.play())}(r),z(parseInt(c)+parseInt(i),r,t,n,o)}}function ze(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.addEventListener("click",Je)})),document.addEventListener("keyup",(n=>{16===n.keyCode&&ve("",t,"programming")&&e.removeEventListener("click",Je)}))}function je(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const n=Me(e.className),a=document.querySelector("."+n+"-drag-dest-map-item");if(a){const o=parseInt(a.style.left.replace("px",""))+a.offsetWidth/2,r=parseInt(a.style.top.replace("px",""))+a.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+a.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(a.dataset.offset)&&i<parseInt(a.dataset.offset)&&!1===a.classList.contains("completed-mission")&&(X(a.dataset.mission,document.querySelector("."+a.dataset.mission+"-mission-item"),n),a.classList.add("completed-mission"),e.classList.add("no-point"),"true"===a.dataset.removable&&(a.remove(),j(Me(a.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),j(n,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:n,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==B&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),n=document.querySelector(".currently-dragging"),a=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,y=p?c-50-r:r-(c-50),f=g?i-(45+a.offsetWidth/2)-s:s-(i-(55+a.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&y>=e.offsetHeight?"up":o,o=!1===p&&y>=a.offsetHeight?"down":o,o=g&&f>=e.offsetWidth?"left":o,o=!1===g&&f>=a.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);n&&n.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Je(e){const t=document.querySelector(".game-container").getBoundingClientRect(),n=e.clientX-t.left-400,a=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Xe(o,a,n,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const n=parseInt(t.getAttribute("data-amount"));100<=n?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",n+1),e.style.width=n+1+"px")}),1500)}(s,r)}function Xe(e,t,n,a,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>n,d=i>t,u=l?c-n:n-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(a){clearInterval(window.movementInt),e.classList.add("auto-move");const a=Math.max(m,u),y=setInterval((()=>{if(p<=a){let a="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",a="down"),l?(e.style.left=p<=u?c-p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":n+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,n){const a=""===e?t:e,o=n.querySelector(".map-character-icon.engage");if(a!==window.currentCharacterAutoDirection){const e=n.querySelector("#"+window.mainCharacter+"-"+a+window.currentWeapon);window.currentCharacterAutoDirection=a,n.classList.add(a+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),n.className=""}}(a,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(y),Be()),ke(s,r)}p++}),window.moveSpeed)}else e.style.left=n+"px",e.style.top=t+"px"}function Ue(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const n in t)if(e>t[n]&&e<t[parseInt(n)+1]||e===t[n])return parseInt(n)+1}return 1}async function Ve(e,t,n,a){var o;let r=!1;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==n?(h=n,h.volume=function(e,t=-40,n=16){return(parseInt(window.talkingVolume)-t)/(n-t)}(),h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))):r=!0;const s=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===n&&""!==s&&t&&""!==t){r=!1;const n=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${s}`,o=0,c=1.2,i={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&c&&(i.audioConfig.pitch=o,i.audioConfig.speakingRate=c);try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;h=new Audio(`data:audio/mp3;base64,${o}`),h.volume=.5,await h.play(),h.addEventListener("ended",(()=>{!1===a&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&(window.nextDialogue=!0)}function _e(e){const t=document.getElementById("start-screen-music"),n=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,n&&(n.textContent="🔉",n.addEventListener("click",(()=>{t.muted=!t.muted,n.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),n.remove())}function Fe(){setInterval((()=>{if(!0===E){const e=window.theHazardValue,t=te("health"),n=parseInt(t)-parseInt(e);Ye(),z(n,"health","hazard","")}if(!1!==k){const e=document.getElementById("map-character");we(25,k,e)}}),1e3)}function Ye(){clearTimeout(y);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,y=setTimeout((()=>{e.dataset.hurt=!1}),1e3))}function Ze(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function Ge(e){const t=document.getElementById("map-character"),n=parseInt(t.style.left.replace("px","")),a=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=n-e+"px";break;case"left":t.style.left=n+e+"px";break;case"top":t.style.top=a+e+"px";break;case"down":t.style.top=n-e+"px"}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,n=document.getElementById("g_id_onload"),a={credential:e.credential,nonce:n?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(911)})(); -
orbem-studio/trunk/inc/class-explore.php
r3455137 r3459126 46 46 $permission_callback = function() { return current_user_can( 'read' ); }; 47 47 $namespace = 'orbemorder/v1'; 48 $google_function = is_plugin_active('orbem-studio-pro/orbem-studio-pro.php') ? 'handleProGoogleOauthCallback' : 'handleGoogleOauthCallback'; 48 49 49 50 // Google oauth handle for logging in. 50 51 register_rest_route($namespace, '/google-oauth-callback/', [ 51 52 'methods' => 'POST', 52 'callback' => [$this, 'handleGoogleOauthCallback'],53 'callback' => [$this, $google_function], 53 54 'permission_callback' => '__return_true', 54 55 ]); … … 72 73 'methods' => 'POST', 73 74 'callback' => [$this, 'getOrbemArea'], 74 'permission_callback' => $permission_callback75 'permission_callback' => '__return_true', 75 76 ]); 76 77 … … 79 80 'methods' => 'POST', 80 81 'callback' => [$this, 'getItemDescription'], 81 'permission_callback' => $permission_callback82 'permission_callback' => '__return_true', 82 83 ]); 83 84 … … 897 898 $orbem_studio_userid = (int) $user->ID; 898 899 899 // Endpoint intentionally accessible to all authenticated users.900 if (0 === $orbem_studio_userid) {901 return rest_ensure_response([902 'success' => false,903 'data' => esc_html__('User not authenticated', 'orbem-studio'),904 ]);905 }906 907 900 // Get request data. 908 $data = $request->get_json_params(); 909 $position = isset($data['position']) ? sanitize_title(wp_unslash($data['position'])) : ''; 901 $data = $request->get_json_params(); 902 $position = isset($data['position']) ? sanitize_title(wp_unslash($data['position'])) : ''; 903 $characters = $data['characters'] ?? ''; 904 $orbem_studio_characters = []; 905 906 if (true === is_array($characters)) { 907 foreach( $characters as $value ) { 908 if ( true === empty($orbem_studio_characters[$value])) { 909 $orbem_studio_characters[] = is_numeric($value) ? intval($value) : sanitize_text_field(wp_unslash($value)); 910 } 911 } 912 } elseif ('' !== $characters) { 913 $orbem_studio_characters[] = is_numeric($characters) ? intval($characters) : sanitize_text_field(wp_unslash($characters)); 914 } 915 910 916 $area = '' !== $position ? get_posts([ 911 917 'post_type' => 'explore-area', … … 1004 1010 $user = wp_get_current_user(); 1005 1011 $userid = (int) $user->ID; 1006 1007 // Endpoint intentionally accessible to all authenticated users.1008 if (0 === $userid) {1009 return rest_ensure_response([1010 'success' => false,1011 'data' => esc_html__('User not authenticated', 'orbem-studio'),1012 ]);1013 }1014 1012 1015 1013 // Get request data. … … 1489 1487 } 1490 1488 1491 if (true !== $breakable && true !== $collectable && $passable && 'explore-point' === $explore_point->post_type) {1489 if (true !== $breakable && true !== $collectable && true !== $draggable && true !== $is_hazard && $passable && 'explore-point' === $explore_point->post_type) { 1492 1490 $classes .= ' no-point'; 1493 1491 } -
orbem-studio/trunk/orbem-studio.php
r3457422 r3459126 6 6 * Plugin URI: https://orbem.studio/ 7 7 * Description: Build your own RPG video game using the power of WordPress 8 * Version: 1.1. 98 * Version: 1.1.10 9 9 * Author: orbemorder 10 10 * Author URI: https://orbemorder.com/ … … 34 34 * Plugin version constant. 35 35 */ 36 const ORBEM_STUDIO_VERSION = '1.1. 9';36 const ORBEM_STUDIO_VERSION = '1.1.10'; 37 37 38 38 if (version_compare(phpversion(), '8.1.0', '>=')) { -
orbem-studio/trunk/readme.txt
r3457422 r3459126 6 6 Tested up to: 6.9 7 7 Requires PHP: 8.1 8 Stable tag: 1.1. 98 Stable tag: 1.1.10 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 171 171 == Changelog == 172 172 173 = 1.1.10 = 174 * Fix draggable items. 175 * Remove logged in dependency for get calls. 176 173 177 = 1.1.9 = 174 178 * Update select meta field to display titles. -
orbem-studio/trunk/templates/components/explore-characters.php
r3434825 r3459126 10 10 use OrbemStudio\Explore; 11 11 12 $orbem_studio_characters = get_user_meta($orbem_studio_userid, 'explore_characters', true); 12 if (true === empty($orbem_studio_characters)) { 13 $orbem_studio_characters = get_user_meta($orbem_studio_userid, 'explore_characters', true); 14 } 13 15 ?> 14 16 <div class="characters-form"> -
orbem-studio/trunk/templates/explore.php
r3452489 r3459126 182 182 $orbem_studio_main_character_id = $orbem_studio_main_character_info['id'] ?? false; 183 183 $orbem_studio_is_admin = user_can(get_current_user_id(), 'manage_options'); 184 $orbem_studio_is_logged_in = is_user_logged_in(); 184 185 185 186 if ( $orbem_studio_is_admin ) { … … 203 204 include plugin_dir_path(__FILE__) . 'plugin-header.php'; 204 205 ?> 205 <main id="primary"<?php echo esc_attr(true === $orbem_studio_is_admin ? ' data-devmode=true' : ''); ?> class="site-main<?php echo esc_attr($orbem_studio_rst); ?>">206 <main id="primary"<?php echo esc_attr(true === $orbem_studio_is_admin ? ' data-devmode=true' : ''); ?><?php echo esc_attr(true === $orbem_studio_is_logged_in ? ' data-loggedin=true' : ''); ?> class="site-main<?php echo esc_attr($orbem_studio_rst); ?>"> 206 207 <?php include $orbem_studio_plugin_dir_path . 'start-screen.php'; ?> 207 208 <?php if (true === $orbem_studio_is_admin) : ?>
Note: See TracChangeset
for help on using the changeset viewer.