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