(()=>{"use strict";var e={141:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.spin_button=t.flash=t.get_json=t.send_json=void 0,t.send_json=function(e,t,n,o=(()=>{})){let s=new XMLHttpRequest;s.onload=()=>{200==s.status?n(JSON.parse(s.responseText)):(console.error(`Failed POST to '${e}' with status ${s.status}.`),o())},s.onerror=()=>{console.error(`Failed to POST to '${e}'.`),o()},s.open("POST",e,!0),s.setRequestHeader("Content-Type","application/json;charset=UTF-8"),s.send(JSON.stringify(t))},t.get_json=function(e,t,n=(()=>{})){let o=new XMLHttpRequest;o.onload=()=>{200==o.status?t(JSON.parse(o.responseText)):(console.error(`Failed to load json '${e}' with status ${o.status}`),n())},o.onerror=()=>{console.error(`Failed to load json '${e}'`),n()},o.open("GET",e,!0),o.send()},t.flash=function(e,t){let n=document.getElementById("flashes"),o=document.createElement("div");n.appendChild(o),o.innerHTML=`<div class="alert alert-${t} alert-dismissible fade show mt-3" role="alert">\n            ${e}\n            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>\n         </div>`},t.spin_button=function(e){e.disabled=!0,e.innerText="";let t=document.createElement("div");e.appendChild(t),t.innerHTML='<div>\n            <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>\n            Loading...\n        </div>'}}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(()=>{const e=n(141);function t(){let e=document.getElementsByClassName("scene-check-box"),t=document.getElementById("confirm-button");for(let n of e)if(n.checked)return void(t.disabled=!1);t.disabled=!0}document.body.onload=()=>{!function(){let e=document.getElementsByClassName("scene-select");for(let n of e)n.getElementsByClassName("scene-check-box")[0].addEventListener("click",t)}(),function(){let t=document.getElementById("confirm-button"),n=t.dataset.target,o=t.dataset.project_name,s=t.dataset.success_url;t.addEventListener("click",(()=>{let r=function(){let t=function(){let t=document.getElementsByClassName("scene-priority"),n=[],o=Array(t.length).fill(!1);for(let s=0;s<t.length;++s){let r=parseInt(t[s].value);if(o[r])return(0,e.flash)(`The priority ${r} can't be used twice.`,"danger"),[];o[r]=!0,n.push(r)}return n}();if(!t.length)return[];let n=document.getElementsByClassName("scene-check-box"),o=[];for(let e=0;e<n.length;++e)o.push(-1);for(let e=0;e<n.length;++e)n[e].checked&&(o[t[e]]=e);let s=[];for(let e of o)-1!=e&&s.push(e);let r="Used scene order: ";for(let e of s)r+=`${e} `;return console.log(r),s}();if(window.scrollTo(0,0),r.length){(0,e.flash)("The project is being populated, this might take a few minutes. Open the terminal for more info.","info"),(0,e.spin_button)(t);let l={name:o,scene_ids:r};(0,e.send_json)(n,l,(()=>{window.location.href=s}),(()=>{(0,e.flash)(`The editor unexpectedly failed to populate the project '${o}'. For more information see the console log. Please consider opening an Issue on GitHub if this problem persists.`,"danger")}))}}))}(),t()}})()})();