import{s as e}from"./http-DKYHx80t.js";import{t}from"./select-CM1ofcjc.js";function n({stepUrl:e,labels:t}){return{progress:0,detail:t.preparing,error:null,running:!1,async run(){if(!this.running){this.running=!0,this.error=null;try{for(;;){let e=await this.step();if(!e.ok){this.error=e.error||t.failedTitle;break}if(typeof e.progress==`number`&&(this.progress=e.progress),e.detail&&(this.detail=e.detail),e.done){e.redirect&&window.location.assign(e.redirect);break}}}catch(e){this.error=e&&e.message?e.message:String(e)}finally{this.running=!1}}},async step(){let t=document.querySelector(`meta[name="csrf-token"]`)?.getAttribute(`content`)||``,n=await fetch(e,{method:`POST`,headers:{"X-CSRF-TOKEN":t,"X-Requested-With":`XMLHttpRequest`,Accept:`application/json`}});if(!n.ok){let e=`HTTP ${n.status}`;try{let t=await n.json();t&&t.error&&(e=t.error)}catch{}return{ok:!1,error:e}}return n.json()}}}e.data(`enhancedSelect`,t),e.data(`migrateRunner`,n),window.Alpine=e,e.start();