2 lines
85 KiB
JavaScript
2 lines
85 KiB
JavaScript
var t=Object.defineProperty,e=Object.prototype.hasOwnProperty,s=Object.getOwnPropertySymbols,n=Object.prototype.propertyIsEnumerable,a=(e,s,n)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n,r=(t,r)=>{for(var l in r||(r={}))e.call(r,l)&&a(t,l,r[l]);if(s)for(var l of s(r))n.call(r,l)&&a(t,l,r[l]);return t};import{S as l,i as c,s as o,e as i,t as $,k as u,c as h,a as p,g as f,d as m,n as d,b as g,f as v,F as y,G as b,H as w,I as x,J as E,K as I,L as k,M as D,N as M,U as P,_ as T,O as N,P as O,Q as V,R as A,T as S,V as q,h as C,W as L,X as F,Y as U,Z as j,j as z,m as B,o as H,v as G,r as R,w as W,$ as Y,a0 as J,a1 as X,a2 as Z,a3 as K,a4 as Q,l as tt,D as et,B as st,a5 as nt,u as at,E as rt,p as lt,q as ct,a6 as ot,A as it,a7 as $t,a8 as ut,a9 as ht,aa as pt,ab as ft,ac as mt,ad as dt,ae as gt,af as vt,ag as _t,x as yt}from"../chunks/vendor-7705c5be.js";function bt(t){let e,s,n,a,r,l,c,o,_;return{c(){e=i("header"),s=i("h1"),n=$("The Docks"),a=u(),r=i("h2"),l=$("a "),c=i("a"),o=$("Full Thrust"),_=$(" ship builder"),this.h()},l(t){e=h(t,"HEADER",{class:!0});var i=p(e);s=h(i,"H1",{class:!0});var $=p(s);n=f($,"The Docks"),$.forEach(m),a=d(i),r=h(i,"H2",{class:!0});var u=p(r);l=f(u,"a "),c=h(u,"A",{href:!0});var g=p(c);o=f(g,"Full Thrust"),g.forEach(m),_=f(u," ship builder"),u.forEach(m),i.forEach(m),this.h()},h(){g(s,"class","svelte-1me5k9w"),g(c,"href","https://shop.groundzerogames.co.uk/rules.html"),g(r,"class","svelte-1me5k9w"),g(e,"class","svelte-1me5k9w")},m(t,i){v(t,e,i),y(e,s),y(s,n),y(e,a),y(e,r),y(r,l),y(r,c),y(c,o),y(r,_)},p:b,i:b,o:b,d(t){t&&m(e)}}}class wt extends l{constructor(t){super(),c(this,t,null,bt,o,{})}}const xt=(t={})=>[D(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>xt(t)))];function Et(t){console.log(t);let{general:a}=t,l=((t,a)=>{var r={};for(var l in t)e.call(t,l)&&a.indexOf(l)<0&&(r[l]=t[l]);if(null!=t&&s)for(var l of s(t))a.indexOf(l)<0&&n.call(t,l)&&(r[l]=t[l]);return r})(t,["general"]);const c=w(xt,x,E(I("cost")))(r(r({},l),{cost:a.mass,mass:0}));return{mass:k("mass",c),cost:k("cost",c)}}const It=t=>Math.ceil(Math.round(10*t)/10);const kt=M("set_ftl",N()),Dt=M("set_ftl_reqs",N()),Mt=new P.default({initial:{mass:0,cost:0,type:"none"}});Mt.addMutation(kt,(t=>T.default.update({type:t}))),Mt.addMutation(Dt,(t=>T.default.update(t)));var Pt=Mt.asDux;const Tt=M("set_engine",N()),Nt=M("set_drive_reqs",N()),Ot=new P.default({initial:{mass:1,cost:2,rating:1}});Ot.addMutation(Tt,(t=>T.default.update(t))),Ot.addMutation(Nt,(t=>T.default.update(t)));var Vt=Ot.asDux;function At(t){return"beam"===t.weapon_type?function({weapon_class:t,arcs:e}){let s;1===t&&(s=1);2==t&&(s=2+(e.length>3?1:0));3==t&&(s=4,St(e)?s+=2:s+=e.length-1);4==t&&(s=8,St(e)?s+=4:s+=2*(e.length-1));return{mass:s,cost:3*s}}(t):"submunition"==t.weapon_type||"pds"===t.weapon_type?{mass:1,cost:3}:"scattergun"===t.weapon_type?{mass:1,cost:4}:"needle"===t.weapon_type?{mass:2,cost:6}:{cost:0,mass:0}}const St=t=>4===t.length&&!t.some((t=>1===t.length));const qt=M("add_weapon",N()),Ct=M("remove_weapon",N()),Lt=(Ft=t=>T(At(t)),t=>Ft(t)(t));var Ft;const Ut=new P.default({initial:[]}),jt={beam:{weapon_type:"beam",weapon_class:1,arcs:["F","A","FS","FP","AS","AP"]},submunition:{weapon_type:"submunition",arcs:["F"]},pds:{weapon_type:"pds"},scattergun:{weapon_type:"scattergun"},needle:{weapon_type:"needle",arcs:["F"]}};Ut.addMutation(qt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,r(r({},Lt(jt[t])),{id:s})]})),Ut.addMutation(Ct,(t=>e=>e.filter((e=>e.id!==t))));const zt=M("set_weapon",N());Ut.addMutation(zt,(t=>T.map(T.if(_.matches({id:t.id}),(e=>Lt(T(t,e)))))));var Bt=Ut.asDux;const Ht=new P.default({initial:{rating:0,cost:0,mass:0}});Ht.addMutation(M("set_adfc",N()),(t=>T.default.update({rating:t,mass:2*t,cost:8*t})));var Gt=Ht.asDux;var Rt=new P.default({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Bt,adfc:Gt}}).asDux;const Wt=[{name:"Scout",mass:[4,10],abbrev:"SC"},{name:"Courier",mass:[4,10],abbrev:"SC"},{name:"Corvette",mass:[8,16],abbrev:"CT"},{name:"Frigate",mass:[14,28],abbrev:"FF"},{name:"Destroyer",mass:[24,36],abbrev:"DD"},{name:"Heavy Destroyer",mass:[30,40],abbrev:"DH"},{name:"Light Cruiser",mass:[40,60],abbrev:"CL"},{name:"Patrol",mass:[50,70],abbrev:"CE"},{name:"Escort Cruiser",mass:[50,70],abbrev:"CE"},{name:"Heavy Cruiser",mass:[60,90],abbrev:"CA"},{name:"Battlecruiser",mass:[80,110],abbrev:"BC"},{name:"Battleship",mass:[100,140],abbrev:"BB"},{name:"Heavy Battleship",mass:[120,160],abbrev:"BDN"},{name:"Dreadnought",mass:[140,180],abbrev:"DN"},{name:"Superdreadnought",mass:[160,300],abbrev:"SDN"},{name:"Escort Carrier",mass:[60,140],abbrev:"CVE",carrier:!0},{name:"Light Carrier",mass:[120,180],abbrev:"CVL",carrier:!0},{name:"Heavy Carrier",mass:[160,300],abbrev:"CVH",carrier:!0},{name:"Attack Carrier",mass:[150,300],abbrev:"CVA",carrier:!0}];function Yt(t=0,e=!1){return console.log({carrier:e}),Wt.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const Jt=new P.default({initial:{standard:0,advanced:0,cost:0,mass:0}}),Xt=M("set_screens",N());Jt.addMutation(Xt,(t=>T.default.update(t)));const Zt=M("set_screens_reqs",N());Jt.addMutation(Zt,(t=>T.default.update(t)));var Kt=Jt.asDux;const Qt=new P.default({initial:[]}),te=M("set_armour_nbr_layers",N());Qt.addMutation(te,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length<t&&(e=[e,O.times(t-e.length,(()=>[]))].flat()),e=T.map(((t,e)=>r({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),Qt.addMutation(M("set_armour_layer",N()),(({layer:t,rating:e})=>T.map(T.if(O.matches({layer:t}),T({rating:e,cost:2*t*e,mass:2*e})))));var ee=Qt.asDux;var se=new P.default({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:Kt,armour:ee}}).asDux;const ne=new P.default({initial:{space:0,cost:0,mass:0}}),ae=M("set_cargo",N());ne.addMutation(ae,(t=>()=>({space:t,cost:0,mass:t})));var re=ne.asDux;const le=new P.default({initial:{type:"none",cost:0,mass:0}}),ce=M("set_streamlining",N());le.addMutation(ce,(t=>T.default.update({type:t})));const oe=M("set_streamlining_cost_mass",N());le.addMutation(oe,(t=>T.default.update(t)));var ie=le.asDux,$e=[{type:"standard",cost:3},{type:"fast",cost:4},{type:"heavy",cost:5},{type:"interceptor",cost:3},{type:"attack",cost:4},{type:"long range",cost:4},{type:"torpedo",cost:6}];const ue=new P.default({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),he=M("set_squadron",N());ue.addMutation(he,(({id:t,type:e})=>T({squadrons:T.map(T.if(O.matches({id:t}),T({type:e,cost:6*O.find($e,{type:e}).cost,mass:6})))})));const pe=M("set_carrier_bays",N());ue.addMutation(pe,(t=>e=>((e=T({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=T({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length<t&&(e=T({squadrons:s=>[...s,...O.times(t-e.squadrons.length,(t=>({id:1+t+e.squadrons.length,cost:6*$e[0].cost,mass:6,type:$e[0].type})))]},e)),e)));var fe=ue.asDux;const me=M("set_ship_mass",N()),de=M("set_name",N()),ge=M("set_ship_reqs",N()),ve=M("set_hull",N()),_e=M("set_ship_type",N()),ye=M("reset"),be={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}},we=new P.default({subduxes:{ftl:Pt,engine:Vt,weaponry:Rt,structure:se,cargo:re,streamlining:ie,carrier:fe},initial:be});we.addMutation(ye,(()=>()=>be)),we.addMutation(ve,(({rating:t})=>e=>T.default.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),we.addMutation(me,(t=>T.default.updateIn("general",{mass:t}))),we.addMutation(de,(t=>T.default.updateIn("general",{name:t}))),we.addMutation(M("set_ship_class",N()),(t=>T.default.updateIn("general",{ship_class:t}))),we.addMutation(ge,(({cost:t,mass:e})=>T.default.updateIn("general",{cost:t,used_mass:e}))),we.addSubscription((t=>V(Et,(e=>t.dispatch(ge(e)))))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=It(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(we.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.general.ship_type),(t=>t.carrier.bays),((e,s,n)=>{console.log({bays:n});const a=Yt(e,n>0);console.log({candidates:a}),0!==a.length&&(a.find((({name:t})=>t===s))||t.dispatch(t.actions.set_ship_type(a[0].name)))})))),we.addMutation(_e,(t=>T.default.updateIn("general.ship_type",t))),we.addSubscription((t=>V([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Pt.actions.set_ftl_reqs(function(t,e){if("none"===t)return{cost:0,mass:0};const s=Math.ceil(e/10);return{mass:s,cost:s*("advanced"===t?3:2)}}(s,e))))))),we.addSubscription((t=>V((t=>t.general.mass),(t=>t.structure.screens.standard),(t=>t.structure.screens.advanced),((e,s,n)=>{console.log({mass:e,standard:s,advanced:n});const a=s*Math.max(3,It(.05*e)),r=n*Math.max(4,It(.075*e));t.dispatch(we.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),we.addSubscription((t=>V([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(we.actions.set_drive_reqs(function(t,e,s=!1){const n=Math.ceil(.05*e*t);return{mass:n,cost:n*(s?3:2)}}(e,s,n)))))));const xe=M("set_firecons",N());we.addMutation(xe,(t=>T.default.updateIn("weaponry.firecons",r({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var Ee=we.asDux;let Ie=q;Ie=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function ke(t){let e,s,n,a,r,l;return{c(){e=i("aside"),s=i("pre"),n=i("code"),a=$(t[0]),this.h()},l(r){e=h(r,"ASIDE",{class:!0});var l=p(e);s=h(l,"PRE",{class:!0});var c=p(s);n=h(c,"CODE",{});var o=p(n);a=f(o,t[0]),o.forEach(m),c.forEach(m),l.forEach(m),this.h()},h(){g(s,"class","svelte-2g9858"),g(e,"class","svelte-2g9858")},m(t,r){v(t,e,r),y(e,s),y(s,n),y(n,a),l=!0},p(t,[e]){(!l||1&e)&&C(a,t[0])},i(t){l||(L((()=>{r||(r=F(e,U,{},!0)),r.run(1)})),l=!0)},o(t){r||(r=F(e,U,{},!1)),r.run(0),l=!1},d(t){t&&m(e),t&&r&&r.end()}}}function De(t,e,s){let n,{ship:a={}}=e;return j(),t.$$set=t=>{"ship"in t&&s(1,a=t.ship)},t.$$.update=()=>{2&t.$$.dirty&&s(0,n=JSON.stringify(a,null,2))},[n,a]}class Me extends l{constructor(t){super(),c(this,t,De,ke,o,{ship:1})}}function Pe(t){let e,s;return{c(){e=i("div"),s=$(t[0]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-1oeefsn")},m(t,n){v(t,e,n),y(e,s)},p(t,[e]){1&e&&C(s,t[0])},i:b,o:b,d(t){t&&m(e)}}}function Te(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Ne extends l{constructor(t){super(),c(this,t,Te,Pe,o,{cost:0})}}function Oe(t){let e,s;return{c(){e=i("div"),s=$(t[0]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-wps6ap")},m(t,n){v(t,e,n),y(e,s)},p(t,[e]){1&e&&C(s,t[0])},i:b,o:b,d(t){t&&m(e)}}}function Ve(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class Ae extends l{constructor(t){super(),c(this,t,Ve,Oe,o,{mass:0})}}function Se(t){let e,s,n,a,r,l,c,o,_,b,w,x,E,I,k;return x=new Ne({props:{cost:t[2]}}),I=new Ae({props:{mass:t[3]}}),{c(){e=i("h1"),s=$("ship name: "),n=i("div"),a=u(),r=i("div"),l=i("h2"),c=$(t[0]),o=$("-class, "),_=$(t[1]),b=u(),w=i("div"),z(x.$$.fragment),E=$("\n \n "),z(I.$$.fragment),this.h()},l(i){e=h(i,"H1",{class:!0});var $=p(e);s=f($,"ship name: "),n=h($,"DIV",{class:!0}),p(n).forEach(m),$.forEach(m),a=d(i),r=h(i,"DIV",{class:!0});var u=p(r);l=h(u,"H2",{class:!0});var g=p(l);c=f(g,t[0]),o=f(g,"-class, "),_=f(g,t[1]),g.forEach(m),b=d(u),w=h(u,"DIV",{class:!0});var v=p(w);B(x.$$.fragment,v),E=f(v,"\n \n "),B(I.$$.fragment,v),v.forEach(m),u.forEach(m),this.h()},h(){g(n,"class","fill svelte-bo35k"),g(e,"class","svelte-bo35k"),g(l,"class","svelte-bo35k"),g(w,"class","reqs svelte-bo35k"),g(r,"class","details svelte-bo35k")},m(t,i){v(t,e,i),y(e,s),y(e,n),v(t,a,i),v(t,r,i),y(r,l),y(l,c),y(l,o),y(l,_),y(r,b),y(r,w),H(x,w,null),y(w,E),H(I,w,null),k=!0},p(t,[e]){(!k||1&e)&&C(c,t[0]),(!k||2&e)&&C(_,t[1]);const s={};4&e&&(s.cost=t[2]),x.$set(s);const n={};8&e&&(n.mass=t[3]),I.$set(n)},i(t){k||(G(x.$$.fragment,t),G(I.$$.fragment,t),k=!0)},o(t){R(x.$$.fragment,t),R(I.$$.fragment,t),k=!1},d(t){t&&m(e),t&&m(a),t&&m(r),W(x),W(I)}}}function qe(t,e,s){let{ship_class:n}=e,{ship_type:a}=e,{cost:r}=e,{mass:l=0}=e;return t.$$set=t=>{"ship_class"in t&&s(0,n=t.ship_class),"ship_type"in t&&s(1,a=t.ship_type),"cost"in t&&s(2,r=t.cost),"mass"in t&&s(3,l=t.mass)},[n,a,r,l]}class Ce extends l{constructor(t){super(),c(this,t,qe,Se,o,{ship_class:0,ship_type:1,cost:2,mass:3})}}function Le(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){g(e,"class","ftl svelte-w7le23"),e.src!==(s="icons/ftl-drive.svg")&&g(e,"src","icons/ftl-drive.svg"),g(e,"alt","ftl drive")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Fe(t){let e,s;return{c(){e=i("div"),s=$(t[1]),this.h()},l(n){e=h(n,"DIV",{class:!0});var a=p(e);s=f(a,t[1]),a.forEach(m),this.h()},h(){g(e,"class","thrust svelte-w7le23")},m(t,n){v(t,e,n),y(e,s)},p(t,e){2&e&&C(s,t[1])},d(t){t&&m(e)}}}function Ue(t){let e,s,n,a,r,l="none"!==t[0]&&Le(),c=t[1]>0&&Fe(t);return{c(){e=i("div"),l&&l.c(),s=u(),c&&c.c(),n=u(),a=i("img"),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);l&&l.l(r),s=d(r),c&&c.l(r),n=d(r),a=h(r,"IMG",{class:!0,src:!0,alt:!0}),r.forEach(m),this.h()},h(){g(a,"class","internal svelte-w7le23"),a.src!==(r="icons/internal-systems.svg")&&g(a,"src","icons/internal-systems.svg"),g(a,"alt","internal systems"),g(e,"class","main_systems svelte-w7le23")},m(t,r){v(t,e,r),l&&l.m(e,null),y(e,s),c&&c.m(e,null),y(e,n),y(e,a)},p(t,[a]){"none"!==t[0]?l||(l=Le(),l.c(),l.m(e,s)):l&&(l.d(1),l=null),t[1]>0?c?c.p(t,a):(c=Fe(t),c.c(),c.m(e,n)):c&&(c.d(1),c=null)},i:b,o:b,d(t){t&&m(e),l&&l.d(),c&&c.d()}}}function je(t,e,s){let{ftl:n="none"}=e,{engine:a=0}=e;return t.$$set=t=>{"ftl"in t&&s(0,n=t.ftl),"engine"in t&&s(1,a=t.engine)},[n,a]}class ze extends l{constructor(t){super(),c(this,t,je,Ue,o,{ftl:0,engine:1})}}function Be(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function He(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function Ge(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/crew-star.svg")&&g(e,"src","icons/crew-star.svg"),g(e,"alt","crew loss threshold"),g(e,"class","svelte-qekx9g")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Re(t,e){let s,n=e[10]&&Ge();return{key:t,first:null,c(){s=i("div"),n&&n.c(),this.h()},l(t){s=h(t,"DIV",{class:!0});var e=p(s);n&&n.l(e),e.forEach(m),this.h()},h(){g(s,"class","cell svelte-qekx9g"),this.first=s},m(t,e){v(t,s,e),n&&n.m(s,null)},p(t,a){(e=t)[10]?n||(n=Ge(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&m(s),n&&n.d()}}}function We(t,e){let s,n,a=[],r=new Map,l=e[7];const c=t=>t[12];for(let o=0;o<l.length;o+=1){let t=He(e,l,o),s=c(t);r.set(s,a[o]=Re(s,t))}return{key:t,first:null,c(){s=i("div");for(let t=0;t<a.length;t+=1)a[t].c();n=u(),this.h()},l(t){s=h(t,"DIV",{class:!0});var e=p(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=d(e),e.forEach(m),this.h()},h(){g(s,"class","row svelte-qekx9g"),this.first=s},m(t,e){v(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);y(s,n)},p(t,o){e=t,1&o&&(l=e[7],a=Y(a,o,c,1,e,l,r,s,J,Re,n,He))},d(t){t&&m(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function Ye(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[9];for(let l=0;l<a.length;l+=1){let e=Be(t,a,l),c=r(e);n.set(c,s[l]=We(c,e))}return{c(){e=i("div");for(let t=0;t<s.length;t+=1)s[t].c()},l(t){e=h(t,"DIV",{});var n=p(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(m)},m(t,n){v(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[l]){1&l&&(a=t[0],s=Y(s,l,r,1,t,a,n,e,J,We,null,Be))},i:b,o:b,d(t){t&&m(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Je(t,e){if(e<=1)return[t];let s=t.length/e;return t.length%e&&s++,[t.slice(0,s),...Je(t.slice(s),e-1)]}function Xe(t,e,s){let n,a,r,{ship_mass:l=0}=e,{rating:c=0}=e,{advanced:o=!1}=e,i=[];return t.$$set=t=>{"ship_mass"in t&&s(1,l=t.ship_mass),"rating"in t&&s(2,c=t.rating),"advanced"in t&&s(3,o=t.advanced)},t.$$.update=()=>{8&t.$$.dirty&&s(4,n=o?3:4),4&t.$$.dirty&&s(5,a=Array(c).fill(!1)),2&t.$$.dirty&&s(6,r=It(l/20)),96&t.$$.dirty&&s(5,a=Je(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=Je(a,n))},[i,l,c,o,n,a,r]}class Ze extends l{constructor(t){super(),c(this,t,Xe,Ye,o,{ship_mass:1,rating:2,advanced:3})}}function Ke(t,e,s){const n=t.slice();return n[1]=e[s],n}function Qe(t,e,s){const n=t.slice();return n[4]=e[s],n}function ts(t,e){let s;return{key:t,first:null,c(){s=i("div"),this.h()},l(t){s=h(t,"DIV",{class:!0}),p(s).forEach(m),this.h()},h(){g(s,"class","cell svelte-15e5q3d"),this.first=s},m(t,e){v(t,s,e)},p(t,e){},d(t){t&&m(s)}}}function es(t,e){let s,n,a=[],r=new Map,l=O.range(e[1].rating);const c=t=>t[4];for(let o=0;o<l.length;o+=1){let t=Qe(e,l,o),s=c(t);r.set(s,a[o]=ts(s))}return{key:t,first:null,c(){s=i("div");for(let t=0;t<a.length;t+=1)a[t].c();n=u(),this.h()},l(t){s=h(t,"DIV",{class:!0});var e=p(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=d(e),e.forEach(m),this.h()},h(){g(s,"class","layer"),this.first=s},m(t,e){v(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);y(s,n)},p(t,o){e=t,1&o&&(l=O.range(e[1].rating),a=Y(a,o,c,0,e,l,r,s,J,ts,n,Qe))},d(t){t&&m(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function ss(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[1];for(let l=0;l<a.length;l+=1){let e=Ke(t,a,l),c=r(e);n.set(c,s[l]=es(c,e))}return{c(){e=i("div");for(let t=0;t<s.length;t+=1)s[t].c();this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(m),this.h()},h(){g(e,"class","layers svelte-15e5q3d")},m(t,n){v(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[l]){1&l&&(a=t[0],s=Y(s,l,r,1,t,a,n,e,J,es,null,Ke))},i:b,o:b,d(t){t&&m(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function ns(t,e,s){let{armour:n=[]}=e;return t.$$set=t=>{"armour"in t&&s(0,n=t.armour)},t.$$.update=()=>{1&t.$$.dirty&&console.log(n)},[n]}class as extends l{constructor(t){super(),c(this,t,ns,ss,o,{armour:0})}}function rs(t){let e,s,n,a,r;return s=new as({props:{armour:t[0].armour}}),a=new Ze({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment)},l(t){e=h(t,"DIV",{});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m)},m(t,l){v(t,e,l),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.armour=t[0].armour),s.$set(n);const r={};1&e&&(r.rating=t[0].hull.rating),1&e&&(r.advanced=t[0].hull.advanced),2&e&&(r.ship_mass=t[1]),a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function ls(t,e,s){let{structure:n={}}=e,{ship_mass:a=0}=e;return t.$$set=t=>{"structure"in t&&s(0,n=t.structure),"ship_mass"in t&&s(1,a=t.ship_mass)},[n,a]}class cs extends l{constructor(t){super(),c(this,t,ls,rs,o,{structure:0,ship_mass:1})}}function os(t){let e,s,n,a;return{c(){e=X("g"),s=X("path"),this.h()},l(t){e=h(t,"g",{transform:!0},1);var n=p(e);s=h(n,"path",{d:!0,class:!0},1),p(s).forEach(m),n.forEach(m),this.h()},h(){g(s,"d",t[1]),g(s,"class","svelte-7q6uh5"),Z(s,"active",t[0]),g(e,"transform",t[2])},m(r,l){v(r,e,l),y(e,s),n||(a=K(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&g(s,"d",t[1]),1&n&&Z(s,"active",t[0]),4&n&&g(e,"transform",t[2])},i:b,o:b,d(t){t&&m(e),n=!1,a()}}}function is(t,e,s){let{arc:n}=e,{radius:a}=e,{active:r=!1}=e;const l={F:0,FS:300,AS:240,A:180,AP:120,FP:60};let c,o,i,$;return t.$$set=t=>{"arc"in t&&s(3,n=t.arc),"radius"in t&&s(4,a=t.radius),"active"in t&&s(0,r=t.active)},t.$$.update=()=>{16&t.$$.dirty&&s(5,c=Math.round(a*(1-Math.sin(60/180*Math.PI)))),16&t.$$.dirty&&s(6,o=Math.round(a*Math.cos(60/180*Math.PI))),112&t.$$.dirty&&s(1,i=`M ${a},${a} L ${a-o},${c} A ${a},${a} 0 0 1 ${a+o},${c} Z`),24&t.$$.dirty&&s(2,$=`rotate(${l[n]},${a},${a})`)},[r,i,$,n,a,c,o,function(e){Q(t,e)}]}class $s extends l{constructor(t){super(),c(this,t,is,os,o,{arc:3,radius:4,active:0})}}function us(t,e,s){const n=t.slice();return n[8]=e[s],n}function hs(t,e){let s,n,a;return n=new $s({props:{arc:e[8],radius:e[1]/2,active:e[0].includes(e[8])}}),n.$on("click",(function(){return e[6](e[8])})),{key:t,first:null,c(){s=tt(),z(n.$$.fragment),this.h()},l(t){s=tt(),B(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){v(t,s,e),H(n,t,e),a=!0},p(t,s){e=t;const a={};2&s&&(a.radius=e[1]/2),1&s&&(a.active=e[0].includes(e[8])),n.$set(a)},i(t){a||(G(n.$$.fragment,t),a=!0)},o(t){R(n.$$.fragment,t),a=!1},d(t){t&&m(s),W(n,t)}}}function ps(t){let e,s,n,a,r,l,c=[],o=new Map,i=t[2];const $=t=>t[8];for(let h=0;h<i.length;h+=1){let e=us(t,i,h),s=$(e);o.set(s,c[h]=hs(s,e))}const u=t[5].default,f=et(u,t,t[4],null);return{c(){e=X("svg");for(let t=0;t<c.length;t+=1)c[t].c();s=X("circle"),f&&f.c(),this.h()},l(t){e=h(t,"svg",{width:!0,height:!0},1);var n=p(e);for(let e=0;e<c.length;e+=1)c[e].l(n);s=h(n,"circle",{cx:!0,cy:!0,r:!0,class:!0},1),p(s).forEach(m),f&&f.l(n),n.forEach(m),this.h()},h(){g(s,"cx","50%"),g(s,"cy","50%"),g(s,"r",n=t[1]/3),g(s,"class","svelte-qqgo8u"),g(e,"width",a=t[1]+"px"),g(e,"height",r=t[1]+"px")},m(t,n){v(t,e,n);for(let s=0;s<c.length;s+=1)c[s].m(e,null);y(e,s),f&&f.m(e,null),l=!0},p(t,[h]){15&h&&(i=t[2],st(),c=Y(c,h,$,1,t,i,o,e,nt,hs,s,us),at()),(!l||2&h&&n!==(n=t[1]/3))&&g(s,"r",n),f&&f.p&&(!l||16&h)&&rt(f,u,t,t[4],h,null,null),(!l||2&h&&a!==(a=t[1]+"px"))&&g(e,"width",a),(!l||2&h&&r!==(r=t[1]+"px"))&&g(e,"height",r)},i(t){if(!l){for(let t=0;t<i.length;t+=1)G(c[t]);G(f,t),l=!0}},o(t){for(let e=0;e<c.length;e+=1)R(c[e]);R(f,t),l=!1},d(t){t&&m(e);for(let e=0;e<c.length;e+=1)c[e].d();f&&f.d(t)}}}function fs(t,e,s){let{$$slots:n={},$$scope:a}=e;let{selected:r=[]}=e,{size:l=60}=e;const c=j(),o=t=>c("click_arc",t);return t.$$set=t=>{"selected"in t&&s(0,r=t.selected),"size"in t&&s(1,l=t.size),"$$scope"in t&&s(4,a=t.$$scope)},[r,l,["FS","F","FP","AP","A","AS"],o,a,n,t=>o(t)]}class ms extends l{constructor(t){super(),c(this,t,fs,ps,o,{selected:0,size:1})}}function ds(t){let e,s;return{c(){e=X("text"),s=$(t[0]),this.h()},l(n){e=h(n,"text",{x:!0,y:!0,class:!0},1);var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"x","50%"),g(e,"y","50%"),g(e,"class","svelte-1u8rlr5")},m(t,n){v(t,e,n),y(e,s)},p(t,e){1&e&&C(s,t[0])},d(t){t&&m(e)}}}function gs(t){let e,s,n;return s=new ms({props:{selected:t[1],size:"40",$$slots:{default:[ds]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);B(s.$$.fragment,n),n.forEach(m),this.h()},h(){g(e,"class","svelte-1u8rlr5")},m(t,a){v(t,e,a),H(s,e,null),n=!0},p(t,[e]){const n={};2&e&&(n.selected=t[1]),5&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n)},i(t){n||(G(s.$$.fragment,t),n=!0)},o(t){R(s.$$.fragment,t),n=!1},d(t){t&&m(e),W(s)}}}function vs(t,e,s){let{weapon_class:n=1}=e,{arcs:a=[]}=e;return t.$$set=t=>{"weapon_class"in t&&s(0,n=t.weapon_class),"arcs"in t&&s(1,a=t.arcs)},[n,a]}class _s extends l{constructor(t){super(),c(this,t,vs,gs,o,{weapon_class:0,arcs:1})}}function ys(t,e,s){const n=t.slice();return n[2]=e[s],n}function bs(t){let e,s;const n=[t[2]];let a={};for(let r=0;r<n.length;r+=1)a=it(a,n[r]);return e=new _s({props:a}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const a=1&s?lt(n,[ct(t[2])]):{};e.$set(a)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ws(t){let e,s,n,a=t[0],r=[];for(let c=0;c<a.length;c+=1)r[c]=bs(ys(t,a,c));const l=t=>R(r[t],1,1,(()=>{r[t]=null}));return{c(){e=i("div"),s=i("div");for(let t=0;t<r.length;t+=1)r[t].c();this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);s=h(n,"DIV",{class:!0});var a=p(s);for(let e=0;e<r.length;e+=1)r[e].l(a);a.forEach(m),n.forEach(m),this.h()},h(){g(s,"class","beams svelte-18nuiwu"),g(e,"class","weapons svelte-18nuiwu")},m(t,a){v(t,e,a),y(e,s);for(let e=0;e<r.length;e+=1)r[e].m(s,null);n=!0},p(t,[e]){if(1&e){let n;for(a=t[0],n=0;n<a.length;n+=1){const l=ys(t,a,n);r[n]?(r[n].p(l,e),G(r[n],1)):(r[n]=bs(l),r[n].c(),G(r[n],1),r[n].m(s,null))}for(st(),n=a.length;n<r.length;n+=1)l(n);at()}},i(t){if(!n){for(let t=0;t<a.length;t+=1)G(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)R(r[e]);n=!1},d(t){t&&m(e),ot(r,t)}}}function xs(t,e,s){let{weapons:n=[]}=e,a=[];return t.$$set=t=>{"weapons"in t&&s(1,n=t.weapons)},t.$$.update=()=>{2&t.$$.dirty&&s(0,a=n.filter((({weapon_type:t})=>"beam"===t)))},[a,n]}class Es extends l{constructor(t){super(),c(this,t,xs,ws,o,{weapons:1})}}function Is(t,e,s){const n=t.slice();return n[1]=e[s],n}function ks(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{class:!0,src:!0,alt:!0}),this.h()},h(){g(e,"class","firecon svelte-10x4b15"),e.src!==(s="icons/firecon.svg")&&g(e,"src","icons/firecon.svg"),g(e,"alt","firecon")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Ds(t){let e,s=_.range(t[0]),n=[];for(let a=0;a<s.length;a+=1)n[a]=ks(Is(t,s,a));return{c(){e=i("div");for(let t=0;t<n.length;t+=1)n[t].c();this.h()},l(t){e=h(t,"DIV",{class:!0});var s=p(e);for(let e=0;e<n.length;e+=1)n[e].l(s);s.forEach(m),this.h()},h(){g(e,"class","svelte-10x4b15")},m(t,s){v(t,e,s);for(let a=0;a<n.length;a+=1)n[a].m(e,null)},p(t,[a]){if(1&a){const a=s.length;let r;for(s=_.range(t[0]),r=a;r<s.length;r+=1)Is(t,s,r),n[r]||(n[r]=ks(),n[r].c(),n[r].m(e,null));for(r=s.length;r<a;r+=1)n[r].d(1);n.length=s.length}},i:b,o:b,d(t){t&&m(e),ot(n,t)}}}function Ms(t,e,s){let{firecons:n=0}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons)},[n]}class Ps extends l{constructor(t){super(),c(this,t,Ms,Ds,o,{firecons:0})}}function Ts(t,e,s){const n=t.slice();return n[2]=e[s],n}function Ns(t,e,s){const n=t.slice();return n[2]=e[s],n}function Os(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen.svg")&&g(e,"src","icons/screen.svg"),g(e,"alt","screen"),g(e,"class","svelte-kh7po5")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function Vs(t){let e,s;return{c(){e=i("img"),this.h()},l(t){e=h(t,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){e.src!==(s="icons/screen-advanced.svg")&&g(e,"src","icons/screen-advanced.svg"),g(e,"alt","advanced screen"),g(e,"class","svelte-kh7po5")},m(t,s){v(t,e,s)},d(t){t&&m(e)}}}function As(t){let e,s,n=O.range(t[0]),a=[];for(let c=0;c<n.length;c+=1)a[c]=Os(Ns(t,n,c));let r=O.range(t[1]),l=[];for(let c=0;c<r.length;c+=1)l[c]=Vs(Ts(t,r,c));return{c(){e=i("div");for(let t=0;t<a.length;t+=1)a[t].c();s=u();for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);for(let e=0;e<a.length;e+=1)a[e].l(n);s=d(n);for(let e=0;e<l.length;e+=1)l[e].l(n);n.forEach(m),this.h()},h(){g(e,"class","svelte-kh7po5")},m(t,n){v(t,e,n);for(let s=0;s<a.length;s+=1)a[s].m(e,null);y(e,s);for(let s=0;s<l.length;s+=1)l[s].m(e,null)},p(t,[c]){if(1&c){const r=n.length;let l;for(n=O.range(t[0]),l=r;l<n.length;l+=1)Ns(t,n,l),a[l]||(a[l]=Os(),a[l].c(),a[l].m(e,s));for(l=n.length;l<r;l+=1)a[l].d(1);a.length=n.length}if(2&c){const s=r.length;let n;for(r=O.range(t[1]),n=s;n<r.length;n+=1)Ts(t,r,n),l[n]||(l[n]=Vs(),l[n].c(),l[n].m(e,null));for(n=r.length;n<s;n+=1)l[n].d(1);l.length=r.length}},i:b,o:b,d(t){t&&m(e),ot(a,t),ot(l,t)}}}function Ss(t,e,s){let{standard:n=0}=e,{advanced:a=0}=e;return t.$$set=t=>{"standard"in t&&s(0,n=t.standard),"advanced"in t&&s(1,a=t.advanced)},[n,a]}class qs extends l{constructor(t){super(),c(this,t,Ss,As,o,{standard:0,advanced:1})}}function Cs(t){let e,s,n,a,r;s=new Ps({props:{firecons:t[0]}});const l=[t[1]];let c={};for(let o=0;o<l.length;o+=1)c=it(c,l[o]);return a=new qs({props:c}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m),this.h()},h(){g(e,"class","svelte-ytgy37")},m(t,l){v(t,e,l),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.firecons=t[0]),s.$set(n);const r=2&e?lt(l,[ct(t[1])]):{};a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function Ls(t,e,s){let{firecons:n=0}=e,{screens:a={}}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons),"screens"in t&&s(1,a=t.screens)},[n,a]}class Fs extends l{constructor(t){super(),c(this,t,Ls,Cs,o,{firecons:0,screens:1})}}function Us(t){let e,s,n,a,r,l,c,o,$,f,_,b,w;const x=[t[0].general];let E={};for(let i=0;i<x.length;i+=1)E=it(E,x[i]);return s=new Ce({props:E}),a=new Es({props:{weapons:t[0].weaponry.weapons}}),c=new cs({props:{structure:t[0].structure,ship_mass:t[0].general.mass}}),$=new Fs({props:{firecons:t[0].weaponry.firecons.nbr,screens:t[0].structure.screens}}),_=new ze({props:{ftl:t[0].ftl.type,engine:t[0].engine.rating}}),{c(){e=i("aside"),z(s.$$.fragment),n=u(),z(a.$$.fragment),r=u(),l=i("div"),z(c.$$.fragment),o=u(),z($.$$.fragment),f=u(),z(_.$$.fragment),this.h()},l(t){e=h(t,"ASIDE",{class:!0});var i=p(e);B(s.$$.fragment,i),n=d(i),B(a.$$.fragment,i),r=d(i),l=h(i,"DIV",{class:!0});var u=p(l);B(c.$$.fragment,u),o=d(u),B($.$$.fragment,u),u.forEach(m),f=d(i),B(_.$$.fragment,i),i.forEach(m),this.h()},h(){g(l,"class","section-2 svelte-5wh1p"),g(e,"class","ship-sheet svelte-5wh1p")},m(t,i){v(t,e,i),H(s,e,null),y(e,n),H(a,e,null),y(e,r),y(e,l),H(c,l,null),y(l,o),H($,l,null),y(e,f),H(_,e,null),w=!0},p(t,[e]){const n=1&e?lt(x,[ct(t[0].general)]):{};s.$set(n);const r={};1&e&&(r.weapons=t[0].weaponry.weapons),a.$set(r);const l={};1&e&&(l.structure=t[0].structure),1&e&&(l.ship_mass=t[0].general.mass),c.$set(l);const o={};1&e&&(o.firecons=t[0].weaponry.firecons.nbr),1&e&&(o.screens=t[0].structure.screens),$.$set(o);const i={};1&e&&(i.ftl=t[0].ftl.type),1&e&&(i.engine=t[0].engine.rating),_.$set(i)},i(t){w||(G(s.$$.fragment,t),G(a.$$.fragment,t),G(c.$$.fragment,t),G($.$$.fragment,t),G(_.$$.fragment,t),L((()=>{b||(b=F(e,U,{},!0)),b.run(1)})),w=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),R(c.$$.fragment,t),R($.$$.fragment,t),R(_.$$.fragment,t),b||(b=F(e,U,{},!1)),b.run(0),w=!1},d(t){t&&m(e),W(s),W(a),W(c),W($),W(_),t&&b&&b.end()}}}function js(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class zs extends l{constructor(t){super(),c(this,t,js,Us,o,{ship:0})}}function Bs(t){let e,s;return{c(){e=i("label"),s=$(t[0]),this.h()},l(n){e=h(n,"LABEL",{class:!0});var a=p(e);s=f(a,t[0]),a.forEach(m),this.h()},h(){g(e,"class","svelte-1urp5hr")},m(t,n){v(t,e,n),y(e,s)},p(t,e){1&e&&C(s,t[0])},d(t){t&&m(e)}}}function Hs(t){let e,s,n,a=t[0]&&Bs(t);const r=t[4].default,l=et(r,t,t[3],null),c=l||function(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,placeholder:!0,value:!0}),this.h()},h(){g(e,"type","text"),g(e,"placeholder",t[2]),e.value=t[1]},m(a,r){v(a,e,r),s||(n=K(e,"change",t[5]),s=!0)},p(t,s){4&s&&g(e,"placeholder",t[2]),2&s&&e.value!==t[1]&&(e.value=t[1])},d(t){t&&m(e),s=!1,n()}}}(t);return{c(){e=i("div"),a&&a.c(),s=u(),c&&c.c(),this.h()},l(t){e=h(t,"DIV",{class:!0});var n=p(e);a&&a.l(n),s=d(n),c&&c.l(n),n.forEach(m),this.h()},h(){g(e,"class","svelte-1urp5hr")},m(t,r){v(t,e,r),a&&a.m(e,null),y(e,s),c&&c.m(e,null),n=!0},p(t,[o]){t[0]?a?a.p(t,o):(a=Bs(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),l?l.p&&(!n||8&o)&&rt(l,r,t,t[3],o,null,null):c&&c.p&&6&o&&c.p(t,o)},i(t){n||(G(c,t),n=!0)},o(t){R(c,t),n=!1},d(t){t&&m(e),a&&a.d(),c&&c.d(t)}}}function Gs(t,e,s){let{$$slots:n={},$$scope:a}=e,{label:r=""}=e,{value:l=""}=e,{placeholder:c}=e;return t.$$set=t=>{"label"in t&&s(0,r=t.label),"value"in t&&s(1,l=t.value),"placeholder"in t&&s(2,c=t.placeholder),"$$scope"in t&&s(3,a=t.$$scope)},[r,l,c,a,n,function(e){Q(t,e)}]}class Rs extends l{constructor(t){super(),c(this,t,Gs,Hs,o,{label:0,value:1,placeholder:2})}}function Ws(t,e,s){const n=t.slice();return n[7]=e[s],n}function Ys(t,e){let s,n,a,r=e[7]+"";return{key:t,first:null,c(){s=i("option"),n=$(r),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,r),e.forEach(m),this.h()},h(){s.__value=a=e[7],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,l){e=t,8&l&&r!==(r=e[7]+"")&&C(n,r),8&l&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&m(s)}}}function Js(t){let e,s,n,a=[],r=new Map,l=t[3];const c=t=>t[7];for(let o=0;o<l.length;o+=1){let e=Ws(t,l,o),s=c(e);r.set(s,a[o]=Ys(s,e))}return{c(){e=i("select");for(let t=0;t<a.length;t+=1)a[t].c()},l(t){e=h(t,"SELECT",{value:!0});var s=p(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(m)},m(r,l){v(r,e,l);for(let t=0;t<a.length;t+=1)a[t].m(e,null);ht(e,t[2]),s||(n=K(e,"change",t[5]),s=!0)},p(t,s){8&s&&(l=t[3],a=Y(a,s,c,1,t,l,r,e,J,Ys,null,Ws)),12&s&&ht(e,t[2])},d(t){t&&m(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Xs(t){let e,s,n,a,r;return s=new Rs({props:{label:"ship class",value:t[1].ship_class}}),s.$on("change",t[4]),a=new Rs({props:{label:"ship type",$$slots:{default:[Js]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m),this.h()},h(){g(e,"class","svelte-fc2507")},m(t,l){v(t,e,l),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,[e]){const n={};2&e&&(n.value=t[1].ship_class),s.$set(n);const r={};1036&e&&(r.$$scope={dirty:e,ctx:t}),a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function Zs(t,e,s){let n,a=b,r=()=>(a(),a=ut(c,(t=>s(6,n=t))),c);t.$$.on_destroy.push((()=>a()));let l,{ship:c=$t("ship")}=e;r();let o;let i;return t.$$set=t=>{"ship"in t&&r(s(0,c=t.ship))},t.$$.update=()=>{64&t.$$.dirty&&s(1,l=n.general),64&t.$$.dirty&&s(2,o=n.general.ship_type),64&t.$$.dirty&&s(3,i=Yt(n.general.mass,n.carrier.bays>0).map((({name:t})=>t)))},[c,l,o,i,t=>c.dispatch(c.actions.set_ship_class(t.target.value)),({target:{value:t}})=>c.dispatch.set_ship_type(t),n]}class Ks extends l{constructor(t){super(),c(this,t,Zs,Xs,o,{ship:0})}}function Qs(t){let e,s,n=-t[1]+"";return{c(){e=$("excessive mass: "),s=$(n)},l(t){e=f(t,"excessive mass: "),s=f(t,n)},m(t,n){v(t,e,n),v(t,s,n)},p(t,e){2&e&&n!==(n=-t[1]+"")&&C(s,n)},d(t){t&&m(e),t&&m(s)}}}function tn(t){let e,s;return{c(){e=$("mass unused: "),s=$(t[1])},l(n){e=f(n,"mass unused: "),s=f(n,t[1])},m(t,n){v(t,e,n),v(t,s,n)},p(t,e){2&e&&C(s,t[1])},d(t){t&&m(e),t&&m(s)}}}function en(t){let e,s,n,a,r,l,c,o;function $(t,e){return t[3]?tn:Qs}let f=$(t),_=f(t);return{c(){e=i("input"),n=u(),a=i("span"),r=u(),l=i("div"),_.c(),this.h()},l(t){e=h(t,"INPUT",{value:!0,type:!0,min:!0,max:!0,class:!0}),n=d(t),a=h(t,"SPAN",{class:!0}),p(a).forEach(m),r=d(t),l=h(t,"DIV",{class:!0});var s=p(l);_.l(s),s.forEach(m),this.h()},h(){e.value=s=t[2].general.mass,g(e,"type","number"),g(e,"min","10"),g(e,"max","300"),g(e,"class","svelte-15yh1sv"),g(a,"class","mass_symbol svelte-15yh1sv"),g(l,"class","note svelte-15yh1sv"),Z(l,"warning",!t[3])},m(s,i){v(s,e,i),v(s,n,i),v(s,a,i),v(s,r,i),v(s,l,i),_.m(l,null),c||(o=K(e,"change",t[4]),c=!0)},p(t,n){4&n&&s!==(s=t[2].general.mass)&&(e.value=s),f===(f=$(t))&&_?_.p(t,n):(_.d(1),_=f(t),_&&(_.c(),_.m(l,null))),8&n&&Z(l,"warning",!t[3])},d(t){t&&m(e),t&&m(n),t&&m(a),t&&m(r),t&&m(l),_.d(),c=!1,o()}}}function sn(t){let e,s,n=t[2].general.cost+"";return{c(){e=i("span"),s=$(n),this.h()},l(t){e=h(t,"SPAN",{class:!0});var a=p(e);s=f(a,n),a.forEach(m),this.h()},h(){g(e,"class","cost svelte-15yh1sv")},m(t,n){v(t,e,n),y(e,s)},p(t,e){4&e&&n!==(n=t[2].general.cost+"")&&C(s,n)},d(t){t&&m(e)}}}function nn(t){let e,s,n,a,r,l;return s=new Rs({props:{label:"ship tonnage",$$slots:{default:[en]},$$scope:{ctx:t}}}),r=new Rs({props:{label:"cost",$$slots:{default:[sn]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),a=i("div"),z(r.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var l=p(e);B(s.$$.fragment,l),l.forEach(m),n=d(t),a=h(t,"DIV",{class:!0});var c=p(a);B(r.$$.fragment,c),c.forEach(m),this.h()},h(){g(e,"class","mass svelte-15yh1sv"),g(a,"class","cost svelte-15yh1sv")},m(t,c){v(t,e,c),H(s,e,null),v(t,n,c),v(t,a,c),H(r,a,null),l=!0},p(t,[e]){const n={};46&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n);const a={};36&e&&(a.$$scope={dirty:e,ctx:t}),r.$set(a)},i(t){l||(G(s.$$.fragment,t),G(r.$$.fragment,t),l=!0)},o(t){R(s.$$.fragment,t),R(r.$$.fragment,t),l=!1},d(t){t&&m(e),W(s),t&&m(n),t&&m(a),W(r)}}}function an(t,e,s){let n,a=b,r=()=>(a(),a=ut(l,(t=>s(2,n=t))),l);t.$$.on_destroy.push((()=>a()));let{ship:l=$t("ship")}=e;r();let c,o=!0;return t.$$set=t=>{"ship"in t&&r(s(0,l=t.ship))},t.$$.update=()=>{4&t.$$.dirty&&s(1,c=n.general.mass-n.general.used_mass),2&t.$$.dirty&&s(3,o=c>=0)},[l,c,n,o,({target:{value:t}})=>l.dispatch(l.actions.set_ship_mass(parseInt(t)))]}class rn extends l{constructor(t){super(),c(this,t,an,nn,o,{ship:0})}}function ln(t){let e,s,n,a;return e=new Ks({}),n=new rn({}),{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment)},l(t){B(e.$$.fragment,t),s=d(t),B(n.$$.fragment,t)},m(t,r){H(e,t,r),v(t,s,r),H(n,t,r),a=!0},p:b,i(t){a||(G(e.$$.fragment,t),G(n.$$.fragment,t),a=!0)},o(t){R(e.$$.fragment,t),R(n.$$.fragment,t),a=!1},d(t){W(e,t),t&&m(s),W(n,t)}}}class cn extends l{constructor(t){super(),c(this,t,null,ln,o,{})}}function on(t){let e,s,n,a,r,l,c,o,_,w,x,E,I,k,D,M,P,T,N,O,V,A,S,q,C,U,j,z,B,H,G,R,W;return{c(){e=i("aside"),s=i("div"),n=i("input"),a=u(),r=i("h3"),l=$("welcome to the docks"),c=u(),o=i("p"),_=$("This app is a ship builder for the game\n "),w=i("a"),x=$("Full Thrust"),E=$("\n ."),I=u(),k=i("p"),D=$("The app, beside any exception mentioned here, is trying to follow the\n "),M=i("a"),P=$("Cross Dimensions rules"),T=$("\n as closely as possible."),N=u(),O=i("p"),V=$("The app is mostly developed for Firefox. I also check as much as I\n can that I don't mess things too badly on Chrome. For the other\n browsers... caveat emptor."),A=u(),S=i("p"),q=$("Written by\n "),C=i("a"),U=$("Yanick Champoux"),j=$("\n . Code available on\n "),z=i("a"),B=$("Github"),this.h()},l(t){e=h(t,"ASIDE",{class:!0});var i=p(e);s=h(i,"DIV",{class:!0});var $=p(s);n=h($,"INPUT",{type:!0,class:!0,value:!0}),$.forEach(m),a=d(i),r=h(i,"H3",{class:!0});var u=p(r);l=f(u,"welcome to the docks"),u.forEach(m),c=d(i),o=h(i,"P",{});var g=p(o);_=f(g,"This app is a ship builder for the game\n "),w=h(g,"A",{href:!0});var v=p(w);x=f(v,"Full Thrust"),v.forEach(m),E=f(g,"\n ."),g.forEach(m),I=d(i),k=h(i,"P",{});var y=p(k);D=f(y,"The app, beside any exception mentioned here, is trying to follow the\n "),M=h(y,"A",{href:!0});var b=p(M);P=f(b,"Cross Dimensions rules"),b.forEach(m),T=f(y,"\n as closely as possible."),y.forEach(m),N=d(i),O=h(i,"P",{});var L=p(O);V=f(L,"The app is mostly developed for Firefox. I also check as much as I\n can that I don't mess things too badly on Chrome. For the other\n browsers... caveat emptor."),L.forEach(m),A=d(i),S=h(i,"P",{});var F=p(S);q=f(F,"Written by\n "),C=h(F,"A",{href:!0});var H=p(C);U=f(H,"Yanick Champoux"),H.forEach(m),j=f(F,"\n . Code available on\n "),z=h(F,"A",{href:!0});var G=p(z);B=f(G,"Github"),G.forEach(m),F.forEach(m),i.forEach(m),this.h()},h(){g(n,"type","button"),g(n,"class","button small red"),n.value="close",g(s,"class","svelte-16mfw8u"),g(r,"class","svelte-16mfw8u"),g(w,"href","https://shop.groundzerogames.co.uk/rules.html"),g(M,"href","http://members.ozemail.com.au/~laranzu/fullthrust/rules/"),g(C,"href","https://twitter.com/yenzie"),g(z,"href","https://github.com/yanick/aotds-shipyard"),g(e,"class","svelte-16mfw8u")},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(e,r),y(r,l),y(e,c),y(e,o),y(o,_),y(o,w),y(w,x),y(o,E),y(e,I),y(e,k),y(k,D),y(k,M),y(M,P),y(k,T),y(e,N),y(e,O),y(O,V),y(e,A),y(e,S),y(S,q),y(S,C),y(C,U),y(S,j),y(S,z),y(z,B),G=!0,R||(W=K(n,"click",t[0]),R=!0)},p:b,i(t){G||(L((()=>{H||(H=F(e,pt,{x:-800,opacity:1},!0)),H.run(1)})),G=!0)},o(t){H||(H=F(e,pt,{x:-800,opacity:1},!1)),H.run(0),G=!1},d(t){t&&m(e),t&&H&&H.end(),R=!1,W()}}}function $n(t){const e=j();return[()=>e("close")]}class un extends l{constructor(t){super(),c(this,t,$n,on,o,{})}}function hn(t){let e,s,n,a,r,l,c,o;const _=t[5].default,b=et(_,t,t[4],null);return{c(){e=i("div"),b&&b.c(),s=u(),n=i("div"),a=$(t[0]),r=u(),l=i("div"),c=$(t[1]),this.h()},l(o){e=h(o,"DIV",{class:!0});var i=p(e);b&&b.l(i),i.forEach(m),s=d(o),n=h(o,"DIV",{class:!0});var $=p(n);a=f($,t[0]),$.forEach(m),r=d(o),l=h(o,"DIV",{class:!0});var u=p(l);c=f(u,t[1]),u.forEach(m),this.h()},h(){g(e,"class","svelte-14c1p7f"),g(n,"class","mass svelte-14c1p7f"),g(l,"class","cost svelte-14c1p7f")},m(i,$){v(i,e,$),b&&b.m(e,null),v(i,s,$),v(i,n,$),y(n,a),t[6](n),v(i,r,$),v(i,l,$),y(l,c),t[7](l),o=!0},p(t,[e]){b&&b.p&&(!o||16&e)&&rt(b,_,t,t[4],e,null,null),(!o||1&e)&&C(a,t[0]),(!o||2&e)&&C(c,t[1])},i(t){o||(G(b,t),o=!0)},o(t){R(b,t),o=!1},d(a){a&&m(e),b&&b.d(a),a&&m(s),a&&m(n),t[6](null),a&&m(r),a&&m(l),t[7](null)}}}function pn(t,e,s){let n,a,{$$slots:r={},$$scope:l}=e,{mass:c}=e,{cost:o}=e;const i=async t=>{t&&(t.classList.remove("updated"),t.offsetWidth,t.classList.add("updated"))};return t.$$set=t=>{"mass"in t&&s(0,c=t.mass),"cost"in t&&s(1,o=t.cost),"$$scope"in t&&s(4,l=t.$$scope)},t.$$.update=()=>{5&t.$$.dirty&&i(n),10&t.$$.dirty&&i(a)},[c,o,n,a,l,r,function(t){ft[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){ft[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class fn extends l{constructor(t){super(),c(this,t,pn,hn,o,{mass:0,cost:1})}}function mn(t){let e,s,n,a,r,l,c;const o=t[2].default,_=et(o,t,t[1],null);return{c(){e=i("div"),s=i("h2"),n=$(t[0]),a=u(),r=i("hr"),l=u(),_&&_.c(),this.h()},l(c){e=h(c,"DIV",{class:!0});var o=p(e);s=h(o,"H2",{});var i=p(s);n=f(i,t[0]),i.forEach(m),a=d(o),r=h(o,"HR",{class:!0}),o.forEach(m),l=d(c),_&&_.l(c),this.h()},h(){g(r,"class","svelte-12m93xd"),g(e,"class","svelte-12m93xd")},m(t,o){v(t,e,o),y(e,s),y(s,n),y(e,a),y(e,r),v(t,l,o),_&&_.m(t,o),c=!0},p(t,[e]){(!c||1&e)&&C(n,t[0]),_&&_.p&&(!c||2&e)&&rt(_,o,t,t[1],e,null,null)},i(t){c||(G(_,t),c=!0)},o(t){R(_,t),c=!1},d(t){t&&m(e),t&&m(l),_&&_.d(t)}}}function dn(t,e,s){let{$$slots:n={},$$scope:a}=e,{label:r}=e;return t.$$set=t=>{"label"in t&&s(0,r=t.label),"$$scope"in t&&s(1,a=t.$$scope)},[r,a,n]}class gn extends l{constructor(t){super(),c(this,t,dn,mn,o,{label:0})}}function vn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-11x6jvv")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function _n(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-11x6jvv")},m(a,r){v(a,e,r),dt(e,t[1]),s||(n=K(e,"input",t[5]),s=!0)},p(t,s){2&s&&mt(e.value)!==t[1]&&dt(e,t[1])},d(t){t&&m(e),s=!1,n()}}}function yn(t){let e,s,n,a,r;return s=new Rs({props:{label:"screens",$$slots:{default:[vn]},$$scope:{ctx:t}}}),a=new Rs({props:{label:"advanced screens",$$slots:{default:[_n]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),z(a.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);B(s.$$.fragment,r),n=d(r),B(a.$$.fragment,r),r.forEach(m),this.h()},h(){g(e,"class","svelte-11x6jvv")},m(t,l){v(t,e,l),H(s,e,null),y(e,n),H(a,e,null),r=!0},p(t,e){const n={};513&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n);const r={};514&e&&(r.$$scope={dirty:e,ctx:t}),a.$set(r)},i(t){r||(G(s.$$.fragment,t),G(a.$$.fragment,t),r=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),r=!1},d(t){t&&m(e),W(s),W(a)}}}function bn(t){let e,s;return e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[yn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),515&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function wn(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:l=0}=e;const c=j();return t.$$set=t=>{"cost"in t&&s(2,n=t.cost),"mass"in t&&s(3,a=t.mass),"standard"in t&&s(0,r=t.standard),"advanced"in t&&s(1,l=t.advanced)},t.$$.update=()=>{3&t.$$.dirty&&c("set_screens",{standard:r,advanced:l})},[r,l,n,a,function(){r=mt(this.value),s(0,r)},function(){l=mt(this.value),s(1,l)}]}class xn extends l{constructor(t){super(),c(this,t,wn,bn,o,{cost:2,mass:3,standard:0,advanced:1})}}function En(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-qworsx")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[2]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function In(t){let e,s;return e=new Rs({props:{label:`layer ${t[1]}`,$$slots:{default:[En]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.label=`layer ${t[1]}`),17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function kn(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=j();return t.$$set=t=>{"layer"in t&&s(1,n=t.layer),"rating"in t&&s(0,a=t.rating)},t.$$.update=()=>{3&t.$$.dirty&&r("ship_change",ee.actions.set_armour_layer({layer:n,rating:a}))},[a,n,function(){a=mt(this.value),s(0,a)}]}class Dn extends l{constructor(t){super(),c(this,t,kn,In,o,{layer:1,rating:0})}}function Mn(t,e,s){const n=t.slice();return n[7]=e[s],n}function Pn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-1bx91qz")},m(a,r){v(a,e,r),dt(e,t[3]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){8&s&&mt(e.value)!==t[3]&&dt(e,t[3])},d(t){t&&m(e),s=!1,n()}}}function Tn(t,e){let s,n,a;const r=[e[7]];let l={};for(let c=0;c<r.length;c+=1)l=it(l,r[c]);return n=new Dn({props:l}),n.$on("ship_change",e[5]),{key:t,first:null,c(){s=tt(),z(n.$$.fragment),this.h()},l(t){s=tt(),B(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){v(t,s,e),H(n,t,e),a=!0},p(t,s){e=t;const a=4&s?lt(r,[ct(e[7])]):{};n.$set(a)},i(t){a||(G(n.$$.fragment,t),a=!0)},o(t){R(n.$$.fragment,t),a=!1},d(t){t&&m(s),W(n,t)}}}function Nn(t){let e,s,n,a,r,l,c=[],o=new Map;n=new Rs({props:{label:"armour layers",$$slots:{default:[Pn]},$$scope:{ctx:t}}});let $=t[2];const f=t=>t[7].layer;for(let i=0;i<$.length;i+=1){let e=Mn(t,$,i),s=f(e);o.set(s,c[i]=Tn(s,e))}return{c(){e=i("div"),s=i("div"),z(n.$$.fragment),a=u(),r=i("div");for(let t=0;t<c.length;t+=1)c[t].c();this.h()},l(t){e=h(t,"DIV",{});var l=p(e);s=h(l,"DIV",{class:!0});var o=p(s);B(n.$$.fragment,o),o.forEach(m),a=d(l),r=h(l,"DIV",{class:!0});var i=p(r);for(let e=0;e<c.length;e+=1)c[e].l(i);i.forEach(m),l.forEach(m),this.h()},h(){g(s,"class","nbr_layers"),g(r,"class","layers svelte-1bx91qz")},m(t,o){v(t,e,o),y(e,s),H(n,s,null),y(e,a),y(e,r);for(let e=0;e<c.length;e+=1)c[e].m(r,null);l=!0},p(t,e){const s={};1032&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s),4&e&&($=t[2],st(),c=Y(c,e,f,1,t,$,o,r,nt,Tn,null,Mn),at())},i(t){if(!l){G(n.$$.fragment,t);for(let t=0;t<$.length;t+=1)G(c[t]);l=!0}},o(t){R(n.$$.fragment,t);for(let e=0;e<c.length;e+=1)R(c[e]);l=!1},d(t){t&&m(e),W(n);for(let e=0;e<c.length;e+=1)c[e].d()}}}function On(t){let e,s;return e=new fn({props:{cost:t[0],mass:t[1],$$slots:{default:[Nn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};1&s&&(n.cost=t[0]),2&s&&(n.mass=t[1]),1036&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Vn(t,e,s){let{armour:n=[]}=e,{cost:a=0}=e,{mass:r=0}=e,l=n.length;const c=j();return t.$$set=t=>{"armour"in t&&s(2,n=t.armour),"cost"in t&&s(0,a=t.cost),"mass"in t&&s(1,r=t.mass)},t.$$.update=()=>{4&t.$$.dirty&&s(0,a=O.sum(O.map(n,"cost"))),4&t.$$.dirty&&s(1,r=O.sum(O.map(n,"mass"))),8&t.$$.dirty&&c("ship_change",ee.actions.set_armour_nbr_layers(l))},[a,r,n,l,function(){l=mt(this.value),s(3,l)},function(e){Q(t,e)}]}class An extends l{constructor(t){super(),c(this,t,Vn,On,o,{armour:2,cost:0,mass:1})}}function Sn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"class","svelte-qworsx")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[3]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function qn(t){let e,s;return e=new Rs({props:{label:"cargo",$$slots:{default:[Sn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Cn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[qn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ln(t,e,s){$t("ship");let{space:n=0}=e,{cost:a=0}=e,{mass:r=0}=e;const l=j();return t.$$set=t=>{"space"in t&&s(0,n=t.space),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},t.$$.update=()=>{1&t.$$.dirty&&l("set_cargo",re.actions.set_cargo(n))},[n,a,r,function(){n=mt(this.value),s(0,n)}]}class Fn extends l{constructor(t){super(),c(this,t,Ln,Cn,o,{space:0,cost:1,mass:2})}}function Un(t){let e,s,n,a,r,l,c,o,_,b,w,x,E,I;return{c(){e=i("div"),s=i("label"),n=i("input"),a=$("\n none"),r=u(),l=i("label"),c=i("input"),o=$("\n partial"),_=u(),b=i("label"),w=i("input"),x=$("\n full"),this.h()},l(t){e=h(t,"DIV",{class:!0});var i=p(e);s=h(i,"LABEL",{class:!0});var $=p(s);n=h($,"INPUT",{type:!0,value:!0}),a=f($,"\n none"),$.forEach(m),r=d(i),l=h(i,"LABEL",{class:!0});var u=p(l);c=h(u,"INPUT",{type:!0,value:!0}),o=f(u,"\n partial"),u.forEach(m),_=d(i),b=h(i,"LABEL",{class:!0});var g=p(b);w=h(g,"INPUT",{type:!0,value:!0}),x=f(g,"\n full"),g.forEach(m),i.forEach(m),this.h()},h(){g(n,"type","radio"),n.__value="none",n.value=n.__value,t[5][0].push(n),g(s,"class","svelte-6w28yb"),g(c,"type","radio"),c.__value="partial",c.value=c.__value,t[5][0].push(c),g(l,"class","svelte-6w28yb"),g(w,"type","radio"),w.__value="full",w.value=w.__value,t[5][0].push(w),g(b,"class","svelte-6w28yb"),g(e,"class","svelte-6w28yb")},m(i,$){v(i,e,$),y(e,s),y(s,n),n.checked=n.__value===t[0],y(s,a),y(e,r),y(e,l),y(l,c),c.checked=c.__value===t[0],y(l,o),y(e,_),y(e,b),y(b,w),w.checked=w.__value===t[0],y(b,x),E||(I=[K(n,"change",t[4]),K(c,"change",t[6]),K(w,"change",t[7])],E=!0)},p(t,e){1&e&&(n.checked=n.__value===t[0]),1&e&&(c.checked=c.__value===t[0]),1&e&&(w.checked=w.__value===t[0])},d(s){s&&m(e),t[5][0].splice(t[5][0].indexOf(n),1),t[5][0].splice(t[5][0].indexOf(c),1),t[5][0].splice(t[5][0].indexOf(w),1),E=!1,gt(I)}}}function jn(t){let e,s;return e=new Rs({props:{label:"streamlining",$$slots:{default:[Un]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function zn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[jn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Bn(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:l=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"type"in t&&s(0,n=t.type),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass),"ship_change"in t&&s(3,l=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&l(ie.actions.set_streamlining(n))},[n,a,r,l,function(){n=this.__value,s(0,n)},[[]],function(){n=this.__value,s(0,n)},function(){n=this.__value,s(0,n)}]}class Hn extends l{constructor(t){super(),c(this,t,Bn,zn,o,{type:0,cost:1,mass:2,ship_change:3})}}function Gn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,max:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min",t[7]),g(e,"max",t[8]),g(e,"class","svelte-x10nn1")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[10]),s=!0)},p(t,s){128&s&&g(e,"min",t[7]),256&s&&g(e,"max",t[8]),1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Rn(t){let e,s;return e=new Rs({props:{label:"integrity",$$slots:{default:[Gn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Wn(t){let e,s,n,a,r,l,c,o,i,$;e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Rn]},$$scope:{ctx:t}}});const h=[t[3]];let p={};for(let u=0;u<h.length;u+=1)p=it(p,h[u]);n=new xn({props:p}),n.$on("set_screens",t[11]),r=new An({props:{armour:t[4]}}),r.$on("ship_change",t[12]);const f=[t[5]];let g={};for(let u=0;u<f.length;u+=1)g=it(g,f[u]);c=new Fn({props:g}),c.$on("set_cargo",t[13]);const _=[t[6]];let y={};for(let u=0;u<_.length;u+=1)y=it(y,_[u]);return i=new Hn({props:y}),{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment),a=u(),z(r.$$.fragment),l=u(),z(c.$$.fragment),o=u(),z(i.$$.fragment)},l(t){B(e.$$.fragment,t),s=d(t),B(n.$$.fragment,t),a=d(t),B(r.$$.fragment,t),l=d(t),B(c.$$.fragment,t),o=d(t),B(i.$$.fragment,t)},m(t,u){H(e,t,u),v(t,s,u),H(n,t,u),v(t,a,u),H(r,t,u),v(t,l,u),H(c,t,u),v(t,o,u),H(i,t,u),$=!0},p(t,s){const a={};2&s&&(a.cost=t[1]),4&s&&(a.mass=t[2]),33153&s&&(a.$$scope={dirty:s,ctx:t}),e.$set(a);const l=8&s?lt(h,[ct(t[3])]):{};n.$set(l);const o={};16&s&&(o.armour=t[4]),r.$set(o);const $=32&s?lt(f,[ct(t[5])]):{};c.$set($);const u=64&s?lt(_,[ct(t[6])]):{};i.$set(u)},i(t){$||(G(e.$$.fragment,t),G(n.$$.fragment,t),G(r.$$.fragment,t),G(c.$$.fragment,t),G(i.$$.fragment,t),$=!0)},o(t){R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t),R(c.$$.fragment,t),R(i.$$.fragment,t),$=!1},d(t){W(e,t),t&&m(s),W(n,t),t&&m(a),W(r,t),t&&m(l),W(c,t),t&&m(o),W(i,t)}}}function Yn(t){let e,s;return e=new gn({props:{label:"hull",$$slots:{default:[Wn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};33279&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Jn(t,e,s){let n,a,{cost:r}=e,{mass:l}=e,{ship_mass:c}=e,{rating:o}=e,{screens:i}=e,{armour:$=[]}=e,{cargo:u={}}=e,{streamlining:h={}}=e;const p=j();return t.$$set=t=>{"cost"in t&&s(1,r=t.cost),"mass"in t&&s(2,l=t.mass),"ship_mass"in t&&s(9,c=t.ship_mass),"rating"in t&&s(0,o=t.rating),"screens"in t&&s(3,i=t.screens),"armour"in t&&s(4,$=t.armour),"cargo"in t&&s(5,u=t.cargo),"streamlining"in t&&s(6,h=t.streamlining)},t.$$.update=()=>{512&t.$$.dirty&&s(7,n=Math.ceil(c/10)),512&t.$$.dirty&&s(8,a=c),1&t.$$.dirty&&p("change_hull",{rating:o})},[o,r,l,i,$,u,h,n,a,c,function(){o=mt(this.value),s(0,o)},function(e){Q(t,e)},function(e){Q(t,e)},function(e){Q(t,e)}]}class Xn extends l{constructor(t){super(),c(this,t,Jn,Yn,o,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function Zn(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"class","short")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[3]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Kn(t){let e,s;return e=new Rs({props:{label:"firecons",$$slots:{default:[Zn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Qn(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ta(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const l=j();return t.$$set=t=>{"nbr"in t&&s(0,n=t.nbr),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},t.$$.update=()=>{1&t.$$.dirty&&l("change_firecons",n)},[n,a,r,function(){n=mt(this.value),s(0,n)}]}class ea extends l{constructor(t){super(),c(this,t,ta,Qn,o,{nbr:0,cost:1,mass:2})}}function sa(t,e,s){const n=t.slice();return n[8]=e[s],n}function na(t,e){let s,n,a,r,l,c,o,_=e[8]+"";return{key:t,first:null,c(){s=i("label"),n=i("input"),a=u(),r=$(_),l=u(),this.h()},l(t){s=h(t,"LABEL",{class:!0});var e=p(s);n=h(e,"INPUT",{type:!0,value:!0}),a=d(e),r=f(e,_),l=d(e),e.forEach(m),this.h()},h(){g(n,"type","radio"),n.__value=e[8],n.value=n.__value,e[6][0].push(n),g(s,"class","svelte-1ozsoxu"),this.first=s},m(t,i){v(t,s,i),y(s,n),n.checked=n.__value===e[0],y(s,a),y(s,r),y(s,l),c||(o=[K(n,"change",e[5]),K(n,"change",e[3])],c=!0)},p(t,s){e=t,1&s&&(n.checked=n.__value===e[0])},d(t){t&&m(s),e[6][0].splice(e[6][0].indexOf(n),1),c=!1,gt(o)}}}function aa(t){let e,s=[],n=new Map,a=t[4];const r=t=>t[8];for(let l=0;l<a.length;l+=1){let e=sa(t,a,l),c=r(e);n.set(c,s[l]=na(c,e))}return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=tt()},l(t){for(let e=0;e<s.length;e+=1)s[e].l(t);e=tt()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);v(t,e,n)},p(t,l){25&l&&(a=t[4],s=Y(s,l,r,1,t,a,n,e.parentNode,J,na,e,sa))},d(t){for(let e=0;e<s.length;e+=1)s[e].d(t);t&&m(e)}}}function ra(t){let e,s;return e=new Rs({props:{label:"FTL drive",$$slots:{default:[aa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function la(t){let e,s;return e=new fn({props:{mass:t[2],cost:t[1],$$slots:{default:[ra]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.mass=t[2]),2&s&&(n.cost=t[1]),2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ca(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e;const l=j();return t.$$set=t=>{"type"in t&&s(0,n=t.type),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass)},[n,a,r,()=>l("change_ftl",n),["none","standard","advanced"],function(){n=this.__value,s(0,n)},[[]]]}class oa extends l{constructor(t){super(),c(this,t,ca,la,o,{type:0,cost:1,mass:2})}}function ia(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0"),g(e,"max","20"),g(e,"step","1"),g(e,"class","svelte-3grq2v")},m(a,r){v(a,e,r),dt(e,t[1]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){2&s&&mt(e.value)!==t[1]&&dt(e,t[1])},d(t){t&&m(e),s=!1,n()}}}function $a(t){let e,s,n,a,r,l,c,o,_;return s=new Rs({props:{label:"thrust rating",$$slots:{default:[ia]},$$scope:{ctx:t}}}),{c(){e=i("div"),z(s.$$.fragment),n=u(),a=i("label"),r=i("input"),l=$(" advanced"),this.h()},l(t){e=h(t,"DIV",{class:!0});var c=p(e);B(s.$$.fragment,c),n=d(c),a=h(c,"LABEL",{class:!0});var o=p(a);r=h(o,"INPUT",{type:!0}),l=f(o," advanced"),o.forEach(m),c.forEach(m),this.h()},h(){g(r,"type","checkbox"),g(a,"class","svelte-3grq2v"),g(e,"class","svelte-3grq2v")},m(i,$){v(i,e,$),H(s,e,null),y(e,n),y(e,a),y(a,r),r.checked=t[0],y(a,l),c=!0,o||(_=K(r,"change",t[5]),o=!0)},p(t,e){const n={};130&e&&(n.$$scope={dirty:e,ctx:t}),s.$set(n),1&e&&(r.checked=t[0])},i(t){c||(G(s.$$.fragment,t),c=!0)},o(t){R(s.$$.fragment,t),c=!1},d(t){t&&m(e),W(s),o=!1,_()}}}function ua(t){let e,s;return e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[$a]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),131&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ha(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:l=0}=e;const c=j();return console.log(r),t.$$set=t=>{"cost"in t&&s(2,n=t.cost),"mass"in t&&s(3,a=t.mass),"advanced"in t&&s(0,r=t.advanced),"rating"in t&&s(1,l=t.rating)},t.$$.update=()=>{3&t.$$.dirty&&c("change_engine",{rating:l,advanced:r})},[r,l,n,a,function(){l=mt(this.value),s(1,l)},function(){r=this.checked,s(0,r)}]}class pa extends l{constructor(t){super(),c(this,t,ha,ua,o,{cost:2,mass:3,advanced:0,rating:1})}}function fa(t){let e,s,n,a;const r=[t[1]];let l={};for(let i=0;i<r.length;i+=1)l=it(l,r[i]);e=new pa({props:l}),e.$on("change_engine",t[2]);const c=[t[0]];let o={};for(let i=0;i<c.length;i+=1)o=it(o,c[i]);return n=new oa({props:o}),n.$on("change_ftl",t[3]),{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment)},l(t){B(e.$$.fragment,t),s=d(t),B(n.$$.fragment,t)},m(t,r){H(e,t,r),v(t,s,r),H(n,t,r),a=!0},p(t,s){const a=2&s?lt(r,[ct(t[1])]):{};e.$set(a);const l=1&s?lt(c,[ct(t[0])]):{};n.$set(l)},i(t){a||(G(e.$$.fragment,t),G(n.$$.fragment,t),a=!0)},o(t){R(e.$$.fragment,t),R(n.$$.fragment,t),a=!1},d(t){W(e,t),t&&m(s),W(n,t)}}}function ma(t){let e,s;return e=new gn({props:{label:"propulsion",$$slots:{default:[fa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};19&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function da(t,e,s){let{ftl:n={}}=e,{engine:a={}}=e;return t.$$set=t=>{"ftl"in t&&s(0,n=t.ftl),"engine"in t&&s(1,a=t.engine)},[n,a,function(e){Q(t,e)},function(e){Q(t,e)}]}class ga extends l{constructor(t){super(),c(this,t,da,ma,o,{ftl:0,engine:1})}}function va(t,e,s){const n=t.slice();return n[2]=e[s],n}function _a(t){let e,s,n,a,r,l,c,o,u,d,g;return{c(){e=i("select"),s=i("option"),n=$("1"),a=i("option"),r=$("2"),l=i("option"),c=$("3"),o=i("option"),u=$("4"),this.h()},l(t){e=h(t,"SELECT",{});var i=p(e);s=h(i,"OPTION",{value:!0});var $=p(s);n=f($,"1"),$.forEach(m),a=h(i,"OPTION",{value:!0});var d=p(a);r=f(d,"2"),d.forEach(m),l=h(i,"OPTION",{value:!0});var g=p(l);c=f(g,"3"),g.forEach(m),o=h(i,"OPTION",{value:!0});var v=p(o);u=f(v,"4"),v.forEach(m),i.forEach(m),this.h()},h(){s.__value="1",s.value=s.__value,a.__value="2",a.value=a.__value,l.__value="3",l.value=l.__value,o.__value="4",o.value=o.__value,void 0===t[0]&&L((()=>t[10].call(e)))},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(a,r),y(e,l),y(l,c),y(e,o),y(o,u),ht(e,t[0]),d||(g=K(e,"change",t[10]),d=!0)},p(t,s){1&s&&ht(e,t[0])},d(t){t&&m(e),d=!1,g()}}}function ya(t,e){let s,n,a,r=e[2]+"";return{key:t,first:null,c(){s=i("option"),n=$(r),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,r),e.forEach(m),this.h()},h(){s.__value=a=e[2],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,l){e=t,1&l&&r!==(r=e[2]+"")&&C(n,r),1&l&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&m(s)}}}function ba(t){let e,s,n,a=[],r=new Map,l=t[3][t[0]]||[];const c=t=>t[2];for(let o=0;o<l.length;o+=1){let e=va(t,l,o),s=c(e);r.set(s,a[o]=ya(s,e))}return{c(){e=i("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=h(t,"SELECT",{});var s=p(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(m),this.h()},h(){void 0===t[2]&&L((()=>t[11].call(e)))},m(r,l){v(r,e,l);for(let t=0;t<a.length;t+=1)a[t].m(e,null);ht(e,t[2]),s||(n=K(e,"change",t[11]),s=!0)},p(t,s){9&s&&(l=t[3][t[0]]||[],a=Y(a,s,c,1,t,l,r,e,J,ya,null,va)),13&s&&ht(e,t[2])},d(t){t&&m(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function wa(t){let e,s,n,a,r,l,c,o,g;return a=new Rs({props:{label:"beam class",$$slots:{default:[_a]},$$scope:{ctx:t}}}),l=new Rs({props:{label:"arcs",$$slots:{default:[ba]},$$scope:{ctx:t}}}),o=new ms({props:{selected:t[1]}}),o.$on("click_arc",t[12]),{c(){e=i("label"),s=$("beam"),n=u(),z(a.$$.fragment),r=u(),z(l.$$.fragment),c=u(),z(o.$$.fragment)},l(t){e=h(t,"LABEL",{});var i=p(e);s=f(i,"beam"),i.forEach(m),n=d(t),B(a.$$.fragment,t),r=d(t),B(l.$$.fragment,t),c=d(t),B(o.$$.fragment,t)},m(t,i){v(t,e,i),y(e,s),v(t,n,i),H(a,t,i),v(t,r,i),H(l,t,i),v(t,c,i),H(o,t,i),g=!0},p(t,[e]){const s={};131073&e&&(s.$$scope={dirty:e,ctx:t}),a.$set(s);const n={};131077&e&&(n.$$scope={dirty:e,ctx:t}),l.$set(n);const r={};2&e&&(r.selected=t[1]),o.$set(r)},i(t){g||(G(a.$$.fragment,t),G(l.$$.fragment,t),G(o.$$.fragment,t),g=!0)},o(t){R(a.$$.fragment,t),R(l.$$.fragment,t),R(o.$$.fragment,t),g=!1},d(t){t&&m(e),t&&m(n),W(a,t),t&&m(r),W(l,t),t&&m(c),W(o,t)}}}function xa(t,e,s){const n=["FS","F","FP","AP","A","AS"];let{weapon_type:a}=e,{id:r}=e,{weapon_class:l=1}=e,{arcs:c=["F"]}=e,{ship_change:o=$t("ship_change")||(()=>{})}=e,i={1:[6],2:[3,6],3:[1,2,3,4,5,6,"broadside"],4:[1,2,3,4,5,6,"broadside"]},$=6;const u=t=>{if("broadside"===$)return;let e=n.findIndex((e=>e===t));const a=[];O.range($).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,c=a)};let h=1,p="";const f=j();return t.$$set=t=>{"weapon_type"in t&&s(5,a=t.weapon_type),"id"in t&&s(6,r=t.id),"weapon_class"in t&&s(0,l=t.weapon_class),"arcs"in t&&s(1,c=t.arcs),"ship_change"in t&&s(7,o=t.ship_change)},t.$$.update=()=>{if(1&t.$$.dirty&&s(2,$=i[l][0]),6&t.$$.dirty&&c.length!==$)if("broadside"===$)s(1,c=n.filter((t=>1===t.length)));else{let t=n.findIndex((t=>c[0]));-1===t&&(t=0);const e=[];O.range($).forEach((s=>{e.push(n[t]),t=(t+1)%n.length})),s(1,c=e)}6&t.$$.dirty&&console.log({arcs:c,nbr_arcs:$}),1&t.$$.dirty&&l&&s(8,h=1),2&t.$$.dirty&&s(9,p=c.join(":")),513&t.$$.dirty&&f("change",{weapon_class:l,arcs:p.split(":")})},[l,c,$,i,u,a,r,o,h,p,function(){l=vt(this),s(0,l)},function(){$=vt(this),s(2,$),s(3,i),s(0,l),s(3,i),s(0,l)},({detail:t})=>u(t)]}class Ea extends l{constructor(t){super(),c(this,t,xa,wa,o,{weapon_type:5,id:6,weapon_class:0,arcs:1,ship_change:7})}}function Ia(t){let e,s,n,a,r;return a=new ms({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=i("label"),s=$("submunition pack"),n=u(),z(a.$$.fragment)},l(t){e=h(t,"LABEL",{});var r=p(e);s=f(r,"submunition pack"),r.forEach(m),n=d(t),B(a.$$.fragment,t)},m(t,l){v(t,e,l),y(e,s),v(t,n,l),H(a,t,l),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(G(a.$$.fragment,t),r=!0)},o(t){R(a.$$.fragment,t),r=!1},d(t){t&&m(e),t&&m(n),W(a,t)}}}function ka(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},l=j();let c;return t.$$set=t=>{"arcs"in t&&s(0,n=t.arcs),"ship_change"in t&&s(2,a=t.ship_change)},t.$$.update=()=>{1&t.$$.dirty&&s(3,c=n.join(":")),8&t.$$.dirty&&l("change",{arcs:c.split(":")})},[n,r,a,c,({detail:t})=>r(t)]}class Da extends l{constructor(t){super(),c(this,t,ka,Ia,o,{arcs:0,ship_change:2})}}function Ma(t){let e,s;return{c(){e=i("label"),s=$("point defence system")},l(t){e=h(t,"LABEL",{});var n=p(e);s=f(n,"point defence system"),n.forEach(m)},m(t,n){v(t,e,n),y(e,s)},p:b,i:b,o:b,d(t){t&&m(e)}}}class Pa extends l{constructor(t){super(),c(this,t,null,Ma,o,{})}}function Ta(t){let e,s;return{c(){e=i("label"),s=$("scattergun")},l(t){e=h(t,"LABEL",{});var n=p(e);s=f(n,"scattergun"),n.forEach(m)},m(t,n){v(t,e,n),y(e,s)},p:b,i:b,o:b,d(t){t&&m(e)}}}class Na extends l{constructor(t){super(),c(this,t,null,Ta,o,{})}}function Oa(t){let e,s,n,a,r;return a=new ms({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=i("label"),s=$("needle weapon"),n=u(),z(a.$$.fragment)},l(t){e=h(t,"LABEL",{});var r=p(e);s=f(r,"needle weapon"),r.forEach(m),n=d(t),B(a.$$.fragment,t)},m(t,l){v(t,e,l),y(e,s),v(t,n,l),H(a,t,l),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(G(a.$$.fragment,t),r=!0)},o(t){R(a.$$.fragment,t),r=!1},d(t){t&&m(e),t&&m(n),W(a,t)}}}function Va(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},l=j();let c;return t.$$set=t=>{"arcs"in t&&s(0,n=t.arcs),"ship_change"in t&&s(2,a=t.ship_change)},t.$$.update=()=>{1&t.$$.dirty&&s(3,c=n.join(":")),8&t.$$.dirty&&l("change",{arcs:c.split(":")})},[n,r,a,c,({detail:t})=>r(t)]}class Aa extends l{constructor(t){super(),c(this,t,Va,Oa,o,{arcs:0,ship_change:2})}}function Sa(t){let e,s,n,a,r,l,c;const o=[t[0]];var $=t[3][t[4]];function f(t){let e={};for(let s=0;s<o.length;s+=1)e=it(e,o[s]);return{props:e}}return $&&(a=new $(f()),a.$on("change",t[6])),{c(){e=i("div"),s=i("input"),n=u(),a&&z(a.$$.fragment),this.h()},l(t){e=h(t,"DIV",{class:!0});var r=p(e);s=h(r,"INPUT",{type:!0,class:!0,value:!0}),n=d(r),a&&B(a.$$.fragment,r),r.forEach(m),this.h()},h(){g(s,"type","button"),g(s,"class","button small red remove"),s.value="remove",g(e,"class","weapon_row svelte-1vypk50")},m(o,i){v(o,e,i),y(e,s),y(e,n),a&&H(a,e,null),r=!0,l||(c=K(s,"click",t[5]),l=!0)},p(t,s){const n=1&s?lt(o,[ct(t[0])]):{};if($!==($=t[3][t[4]])){if(a){st();const t=a;R(t.$$.fragment,1,0,(()=>{W(t,1)})),at()}$?(a=new $(f()),a.$on("change",t[6]),z(a.$$.fragment),G(a.$$.fragment,1),H(a,e,null)):a=null}else $&&a.$set(n)},i(t){r||(a&&G(a.$$.fragment,t),r=!0)},o(t){a&&R(a.$$.fragment,t),r=!1},d(t){t&&m(e),a&&W(a),l=!1,c()}}}function qa(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[Sa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ca(t,e,s){const n={beam:Ea,submunition:Da,pds:Pa,scattergun:Na,needle:Aa};let{weapon:a={}}=e,{id:l}=e,{cost:c}=e,{mass:o}=e,{ship_change:i=$t("ship_change")||(()=>{})}=e,$=a.weapon_type;return t.$$set=t=>{"weapon"in t&&s(0,a=t.weapon),"id"in t&&s(7,l=t.id),"cost"in t&&s(1,c=t.cost),"mass"in t&&s(2,o=t.mass),"ship_change"in t&&s(8,i=t.ship_change)},[a,c,o,n,$,()=>i(Ee.actions.remove_weapon(l)),({detail:t})=>{i(Ee.actions.set_weapon(r({id:l,weapon_type:$},t)))},l,i]}class La extends l{constructor(t){super(),c(this,t,Ca,qa,o,{weapon:0,id:7,cost:1,mass:2,ship_change:8})}}function Fa(t,e,s){const n=t.slice();return n[0]=e[s],n}function Ua(t,e){let s,n,a=e[0]+"";return{key:t,first:null,c(){s=i("option"),n=$(a),this.h()},l(t){s=h(t,"OPTION",{value:!0});var e=p(s);n=f(e,a),e.forEach(m),this.h()},h(){s.__value=e[0],s.value=s.__value,this.first=s},m(t,e){v(t,s,e),y(s,n)},p(t,s){e=t},d(t){t&&m(s)}}}function ja(t){let e,s,n,a=[],r=new Map,l=t[4];const c=t=>t[0];for(let o=0;o<l.length;o+=1){let e=Fa(t,l,o),s=c(e);r.set(s,a[o]=Ua(s,e))}return{c(){e=i("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=h(t,"SELECT",{});var s=p(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(m),this.h()},h(){void 0===t[0]&&L((()=>t[7].call(e)))},m(r,l){v(r,e,l);for(let t=0;t<a.length;t+=1)a[t].m(e,null);ht(e,t[0]),s||(n=K(e,"change",t[7]),s=!0)},p(t,s){16&s&&(l=t[4],a=Y(a,s,c,1,t,l,r,e,J,Ua,null,Fa)),17&s&&ht(e,t[0])},d(t){t&&m(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function za(t){let e,s;return e=new Rs({props:{label:`squadron ${t[1]}`,$$slots:{default:[ja]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.label=`squadron ${t[1]}`),1025&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ba(t){let e,s;return e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[za]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};4&s&&(n.cost=t[2]),8&s&&(n.mass=t[3]),1027&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ha(t,e,s){const n=$e.map((({type:t})=>t));let{id:a=1}=e,{type:r="standard"}=e,{ftl:l=!1}=e,{cost:c=0}=e,{mass:o=0}=e,{ship_change:i=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"id"in t&&s(1,a=t.id),"type"in t&&s(0,r=t.type),"ftl"in t&&s(5,l=t.ftl),"cost"in t&&s(2,c=t.cost),"mass"in t&&s(3,o=t.mass),"ship_change"in t&&s(6,i=t.ship_change)},t.$$.update=()=>{67&t.$$.dirty&&i(fe.actions.set_squadron({id:a,type:r}))},[r,a,c,o,n,l,i,function(){r=vt(this),s(0,r),s(4,n)}]}class Ga extends l{constructor(t){super(),c(this,t,Ha,Ba,o,{id:1,type:0,ftl:5,cost:2,mass:3,ship_change:6})}}function Ra(t,e,s){const n=t.slice();return n[6]=e[s],n}function Wa(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,min:!0}),this.h()},h(){g(e,"type","number"),g(e,"min","0")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[5]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function Ya(t){let e,s;return e=new Rs({props:{label:"bays",$$slots:{default:[Wa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ja(t,e){let s,n,a;const r=[e[6]];let l={};for(let c=0;c<r.length;c+=1)l=it(l,r[c]);return n=new Ga({props:l}),{key:t,first:null,c(){s=tt(),z(n.$$.fragment),this.h()},l(t){s=tt(),B(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){v(t,s,e),H(n,t,e),a=!0},p(t,s){e=t;const a=2&s?lt(r,[ct(e[6])]):{};n.$set(a)},i(t){a||(G(n.$$.fragment,t),a=!0)},o(t){R(n.$$.fragment,t),a=!1},d(t){t&&m(s),W(n,t)}}}function Xa(t){let e,s,n,a,r=[],l=new Map;e=new fn({props:{cost:t[2],mass:t[3],$$slots:{default:[Ya]},$$scope:{ctx:t}}});let c=t[1];const o=t=>t[6].id;for(let i=0;i<c.length;i+=1){let e=Ra(t,c,i),s=o(e);l.set(s,r[i]=Ja(s,e))}return{c(){z(e.$$.fragment),s=u();for(let t=0;t<r.length;t+=1)r[t].c();n=tt()},l(t){B(e.$$.fragment,t),s=d(t);for(let e=0;e<r.length;e+=1)r[e].l(t);n=tt()},m(t,l){H(e,t,l),v(t,s,l);for(let e=0;e<r.length;e+=1)r[e].m(t,l);v(t,n,l),a=!0},p(t,s){const a={};4&s&&(a.cost=t[2]),8&s&&(a.mass=t[3]),513&s&&(a.$$scope={dirty:s,ctx:t}),e.$set(a),2&s&&(c=t[1],st(),r=Y(r,s,o,1,t,c,l,n.parentNode,nt,Ja,n,Ra),at())},i(t){if(!a){G(e.$$.fragment,t);for(let t=0;t<c.length;t+=1)G(r[t]);a=!0}},o(t){R(e.$$.fragment,t);for(let e=0;e<r.length;e+=1)R(r[e]);a=!1},d(t){W(e,t),t&&m(s);for(let e=0;e<r.length;e+=1)r[e].d(t);t&&m(n)}}}function Za(t){let e,s;return e=new gn({props:{label:"carrier",$$slots:{default:[Xa]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};527&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function Ka(t,e,s){let{bays:n=0}=e,{squadrons:a=[]}=e,{cost:r=0}=e,{mass:l=0}=e,{ship_change:c=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"bays"in t&&s(0,n=t.bays),"squadrons"in t&&s(1,a=t.squadrons),"cost"in t&&s(2,r=t.cost),"mass"in t&&s(3,l=t.mass),"ship_change"in t&&s(4,c=t.ship_change)},t.$$.update=()=>{17&t.$$.dirty&&c(fe.actions.set_carrier_bays(n))},[n,a,r,l,c,function(){n=mt(this.value),s(0,n)}]}class Qa extends l{constructor(t){super(),c(this,t,Ka,Za,o,{bays:0,squadrons:1,cost:2,mass:3,ship_change:4})}}function tr(t){let e,s,n;return{c(){e=i("input"),this.h()},l(t){e=h(t,"INPUT",{type:!0,class:!0}),this.h()},h(){g(e,"type","number"),g(e,"class","short")},m(a,r){v(a,e,r),dt(e,t[0]),s||(n=K(e,"input",t[4]),s=!0)},p(t,s){1&s&&mt(e.value)!==t[0]&&dt(e,t[0])},d(t){t&&m(e),s=!1,n()}}}function er(t){let e,s;return e=new Rs({props:{label:"ADFC",$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function sr(t){let e,s;return e=new fn({props:{cost:t[1],mass:t[2],$$slots:{default:[er]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};2&s&&(n.cost=t[1]),4&s&&(n.mass=t[2]),33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function nr(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:l=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"rating"in t&&s(0,n=t.rating),"cost"in t&&s(1,a=t.cost),"mass"in t&&s(2,r=t.mass),"ship_change"in t&&s(3,l=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&l(Ee.actions.set_adfc(n))},[n,a,r,l,function(){n=mt(this.value),s(0,n)}]}class ar extends l{constructor(t){super(),c(this,t,nr,sr,o,{rating:0,cost:1,mass:2,ship_change:3})}}function rr(t){let e,s,n,a,r,l,c,o,_,b,w,x,E,I,k;return{c(){e=i("select"),s=i("option"),n=$("beam"),a=i("option"),r=$("submunition pack"),l=i("option"),c=$("point defence system"),o=i("option"),_=$("scattergun"),b=i("option"),w=$("needle weapon"),x=u(),E=i("input"),this.h()},l(t){e=h(t,"SELECT",{});var i=p(e);s=h(i,"OPTION",{value:!0});var $=p(s);n=f($,"beam"),$.forEach(m),a=h(i,"OPTION",{value:!0});var u=p(a);r=f(u,"submunition pack"),u.forEach(m),l=h(i,"OPTION",{value:!0});var g=p(l);c=f(g,"point defence system"),g.forEach(m),o=h(i,"OPTION",{value:!0});var v=p(o);_=f(v,"scattergun"),v.forEach(m),b=h(i,"OPTION",{value:!0});var y=p(b);w=f(y,"needle weapon"),y.forEach(m),i.forEach(m),x=d(t),E=h(t,"INPUT",{type:!0,value:!0,class:!0}),this.h()},h(){s.__value="beam",s.value=s.__value,a.__value="submunition",a.value=a.__value,l.__value="pds",l.value=l.__value,o.__value="scattergun",o.value=o.__value,b.__value="needle",b.value=b.__value,void 0===t[0]&&L((()=>t[3].call(e))),g(E,"type","button"),E.value="add weapon",g(E,"class","button small blue")},m(i,$){v(i,e,$),y(e,s),y(s,n),y(e,a),y(a,r),y(e,l),y(l,c),y(e,o),y(o,_),y(e,b),y(b,w),ht(e,t[0]),v(i,x,$),v(i,E,$),I||(k=[K(e,"change",t[3]),K(E,"click",t[1])],I=!0)},p(t,s){1&s&&ht(e,t[0])},d(t){t&&m(e),t&&m(x),t&&m(E),I=!1,gt(k)}}}function lr(t){let e,s;return e=new Rs({props:{label:"weapon type",$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function cr(t,e,s){let{weapon_type:n="beam"}=e,{ship_change:a=$t("ship_change")||(()=>{})}=e;return t.$$set=t=>{"weapon_type"in t&&s(0,n=t.weapon_type),"ship_change"in t&&s(2,a=t.ship_change)},[n,()=>a(Ee.actions.add_weapon(n)),a,function(){n=vt(this),s(0,n)}]}class or extends l{constructor(t){super(),c(this,t,cr,lr,o,{weapon_type:0,ship_change:2})}}function ir(t,e,s){const n=t.slice();return n[23]=e[s],n}function $r(t){let e,s;return e=new un({props:{show:t[2]}}),e.$on("close",t[12]),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function ur(t){let e,s,n,a,r,l,c,o,_,b,w,x,E,I,k,D,M,P,T;s=new cn({}),a=new ga({props:{ftl:t[1].ftl,engine:t[1].engine}}),a.$on("change_ftl",t[5]),a.$on("change_engine",t[6]);const N=[{ship_mass:t[1].general.mass},t[1].structure.hull,{screens:t[1].structure.screens},{armour:t[1].structure.armour},{cargo:t[1].cargo},{streamlining:t[1].streamlining}];let O={};for(let i=0;i<N.length;i+=1)O=it(O,N[i]);l=new Xn({props:O}),l.$on("change_hull",t[7]),l.$on("set_screens",t[10]),l.$on("set_cargo",t[11]),l.$on("ship_change",t[11]),o=new gn({props:{label:"weaponry",$$slots:{default:[mr]},$$scope:{ctx:t}}});const V=[t[1].carrier];let A={};for(let i=0;i<V.length;i+=1)A=it(A,V[i]);return b=new Qa({props:A}),{c(){e=i("main"),z(s.$$.fragment),n=u(),z(a.$$.fragment),r=u(),z(l.$$.fragment),c=u(),z(o.$$.fragment),_=u(),z(b.$$.fragment),w=u(),x=i("footer"),E=$("Written by "),I=i("a"),k=$("Yanick Champoux"),D=$(".\n Code available on "),M=i("a"),P=$("Github"),this.h()},l(t){e=h(t,"MAIN",{class:!0});var i=p(e);B(s.$$.fragment,i),n=d(i),B(a.$$.fragment,i),r=d(i),B(l.$$.fragment,i),c=d(i),B(o.$$.fragment,i),_=d(i),B(b.$$.fragment,i),i.forEach(m),w=d(t),x=h(t,"FOOTER",{class:!0});var $=p(x);E=f($,"Written by "),I=h($,"A",{href:!0});var u=p(I);k=f(u,"Yanick Champoux"),u.forEach(m),D=f($,".\n Code available on "),M=h($,"A",{href:!0});var g=p(M);P=f(g,"Github"),g.forEach(m),$.forEach(m),this.h()},h(){g(e,"class","svelte-4zjur4"),g(I,"href","https://twitter.com/yenzie"),g(M,"href","https://github.com/yanick/aotds-shipyard"),g(x,"class","svelte-4zjur4")},m(t,i){v(t,e,i),H(s,e,null),y(e,n),H(a,e,null),y(e,r),H(l,e,null),y(e,c),H(o,e,null),y(e,_),H(b,e,null),v(t,w,i),v(t,x,i),y(x,E),y(x,I),y(I,k),y(x,D),y(x,M),y(M,P),T=!0},p(t,e){const s={};2&e&&(s.ftl=t[1].ftl),2&e&&(s.engine=t[1].engine),a.$set(s);const n=2&e?lt(N,[{ship_mass:t[1].general.mass},ct(t[1].structure.hull),{screens:t[1].structure.screens},{armour:t[1].structure.armour},{cargo:t[1].cargo},{streamlining:t[1].streamlining}]):{};l.$set(n);const r={};67108867&e&&(r.$$scope={dirty:e,ctx:t}),o.$set(r);const c=2&e?lt(V,[ct(t[1].carrier)]):{};b.$set(c)},i(t){T||(G(s.$$.fragment,t),G(a.$$.fragment,t),G(l.$$.fragment,t),G(o.$$.fragment,t),G(b.$$.fragment,t),T=!0)},o(t){R(s.$$.fragment,t),R(a.$$.fragment,t),R(l.$$.fragment,t),R(o.$$.fragment,t),R(b.$$.fragment,t),T=!1},d(t){t&&m(e),W(s),W(a),W(l),W(o),W(b),t&&m(w),t&&m(x)}}}function hr(t){let e,s;return e=new zs({props:{ship:t[1]}}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function pr(t){let e,s;return e=new Me({props:{ship:t[1]}}),e.$on("close",t[17]),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}function fr(t,e){let s,n,a;return n=new La({props:{weapon:e[23],id:e[23].id,cost:e[23].cost,mass:e[23].mass}}),{key:t,first:null,c(){s=tt(),z(n.$$.fragment),this.h()},l(t){s=tt(),B(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){v(t,s,e),H(n,t,e),a=!0},p(t,s){e=t;const a={};1&s&&(a.weapon=e[23]),1&s&&(a.id=e[23].id),1&s&&(a.cost=e[23].cost),1&s&&(a.mass=e[23].mass),n.$set(a)},i(t){a||(G(n.$$.fragment,t),a=!0)},o(t){R(n.$$.fragment,t),a=!1},d(t){t&&m(s),W(n,t)}}}function mr(t){let e,s,n,a,r,l,c,o,i=[],$=new Map;const h=[t[1].weaponry.firecons];let p={};for(let u=0;u<h.length;u+=1)p=it(p,h[u]);e=new ea({props:p}),e.$on("change_firecons",t[8]);const f=[t[1].weaponry.adfc];let g={};for(let u=0;u<f.length;u+=1)g=it(g,f[u]);n=new ar({props:g}),r=new or({});let _=t[0];const y=t=>t[23].id;for(let u=0;u<_.length;u+=1){let e=ir(t,_,u),s=y(e);$.set(s,i[u]=fr(s,e))}return{c(){z(e.$$.fragment),s=u(),z(n.$$.fragment),a=u(),z(r.$$.fragment),l=u();for(let t=0;t<i.length;t+=1)i[t].c();c=tt()},l(t){B(e.$$.fragment,t),s=d(t),B(n.$$.fragment,t),a=d(t),B(r.$$.fragment,t),l=d(t);for(let e=0;e<i.length;e+=1)i[e].l(t);c=tt()},m(t,$){H(e,t,$),v(t,s,$),H(n,t,$),v(t,a,$),H(r,t,$),v(t,l,$);for(let e=0;e<i.length;e+=1)i[e].m(t,$);v(t,c,$),o=!0},p(t,s){const a=2&s?lt(h,[ct(t[1].weaponry.firecons)]):{};e.$set(a);const r=2&s?lt(f,[ct(t[1].weaponry.adfc)]):{};n.$set(r),1&s&&(_=t[0],st(),i=Y(i,s,y,1,t,_,$,c.parentNode,nt,fr,c,ir),at())},i(t){if(!o){G(e.$$.fragment,t),G(n.$$.fragment,t),G(r.$$.fragment,t);for(let t=0;t<_.length;t+=1)G(i[t]);o=!0}},o(t){R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t);for(let e=0;e<i.length;e+=1)R(i[e]);o=!1},d(t){W(e,t),t&&m(s),W(n,t),t&&m(a),W(r,t),t&&m(l);for(let e=0;e<i.length;e+=1)i[e].d(t);t&&m(c)}}}function dr(t){let e,s,n,a,r,l,c,o,$,f,_,b,w,x,E,I,k,D,M,P,T,N,O;e=new wt({});let V=t[2]&&$r(t);const A=[pr,hr,ur],S=[];function q(t,e){return"json"===t[3]?0:"print"===t[3]?1:2}return D=q(t),M=S[D]=A[D](t),{c(){z(e.$$.fragment),s=u(),n=i("nav"),a=i("input"),r=u(),l=i("div"),c=u(),o=i("input"),$=u(),f=i("ul"),_=i("input"),b=u(),w=i("input"),x=u(),E=i("input"),I=u(),V&&V.c(),k=u(),M.c(),P=tt(),this.h()},l(t){B(e.$$.fragment,t),s=d(t),n=h(t,"NAV",{class:!0});var i=p(n);a=h(i,"INPUT",{class:!0,type:!0,value:!0}),r=d(i),l=h(i,"DIV",{class:!0}),p(l).forEach(m),c=d(i),o=h(i,"INPUT",{type:!0,class:!0,value:!0}),$=d(i),f=h(i,"UL",{class:!0});var u=p(f);_=h(u,"INPUT",{type:!0,class:!0,value:!0}),b=d(u),w=h(u,"INPUT",{type:!0,class:!0,value:!0}),x=d(u),E=h(u,"INPUT",{type:!0,class:!0,value:!0}),u.forEach(m),i.forEach(m),I=d(t),V&&V.l(t),k=d(t),M.l(t),P=tt(),this.h()},h(){g(a,"class","reset button small red svelte-4zjur4"),g(a,"type","button"),a.value="reset",g(l,"class","spacer svelte-4zjur4"),g(o,"type","button"),g(o,"class","button small notes svelte-4zjur4"),o.value="notes",g(_,"type","button"),g(_,"class","button small green"),_.value="editor",g(w,"type","button"),g(w,"class","button small green"),w.value="json",g(E,"type","button"),g(E,"class","button small green"),E.value="print",g(f,"class","button-group"),g(n,"class","svelte-4zjur4")},m(i,u){H(e,i,u),v(i,s,u),v(i,n,u),y(n,a),y(n,r),y(n,l),y(n,c),y(n,o),y(n,$),y(n,f),y(f,_),y(f,b),y(f,w),y(f,x),y(f,E),v(i,I,u),V&&V.m(i,u),v(i,k,u),S[D].m(i,u),v(i,P,u),T=!0,N||(O=[K(a,"click",t[9]),K(o,"click",t[12]),K(_,"click",t[14]),K(w,"click",t[15]),K(E,"click",t[16])],N=!0)},p(t,[e]){t[2]?V?(V.p(t,e),4&e&&G(V,1)):(V=$r(t),V.c(),G(V,1),V.m(k.parentNode,k)):V&&(st(),R(V,1,1,(()=>{V=null})),at());let s=D;D=q(t),D===s?S[D].p(t,e):(st(),R(S[s],1,1,(()=>{S[s]=null})),at(),M=S[D],M?M.p(t,e):(M=S[D]=A[D](t),M.c()),G(M,1),M.m(P.parentNode,P))},i(t){T||(G(e.$$.fragment,t),G(V),G(M),T=!0)},o(t){R(e.$$.fragment,t),R(V),R(M),T=!1},d(t){W(e,t),t&&m(s),t&&m(n),t&&m(I),V&&V.d(t),t&&m(k),S[D].d(t),t&&m(P),N=!1,gt(O)}}}function gr(t,e,s){let n;const a=(()=>{let t;t=window.localStorage.getItem("aotds-shipyard"),t=t?JSON.parse(t):void 0,console.log(t);const e=Ee.createStore(t,(t=>Ie(A(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Et(e.getState()))),Object.entries(e.actions).forEach((([t,s])=>{e.dispatch[t]=t=>e.dispatch(s(t))})),e.subscribe((()=>{let t=e.getState();s!==t&&(s=t,console.log(t),window.localStorage.setItem("aotds-shipyard",JSON.stringify(t)))})),{subscribe:S(e.getState(),(t=>e.subscribe((()=>{t(e.getState())})))).subscribe,dispatch:e.dispatch,actions:e.actions,selectors:e.selectors}})();_t(t,a,(t=>s(1,n=t))),yt("ship",a),n.general.name;let r=[];const l=a.dispatch.reset;yt("ship_change",a.dispatch);let c=!1;let o=null;const i=t=>s(3,o=t);return t.$$.update=()=>{2&t.$$.dirty&&s(0,r=n.weaponry.weapons),1&t.$$.dirty&&console.log(r)},[r,n,c,o,a,({detail:t})=>a.dispatch.set_ftl(t),({detail:t})=>a.dispatch.set_engine(t),({detail:t})=>a.dispatch.set_hull(t),({detail:t})=>a.dispatch.set_firecons(t),l,({detail:t})=>a.dispatch.set_screens(t),({detail:t})=>a.dispatch(t),()=>s(2,c=!c),i,()=>i(null),()=>i("json"),()=>i("print"),()=>i(null)]}class vr extends l{constructor(t){super(),c(this,t,gr,dr,o,{})}}function _r(t){let e,s;return e=new vr({}),{c(){z(e.$$.fragment)},l(t){B(e.$$.fragment,t)},m(t,n){H(e,t,n),s=!0},p:b,i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){R(e.$$.fragment,t),s=!1},d(t){W(e,t)}}}export default class extends l{constructor(t){super(),c(this,t,null,_r,o,{})}}
|