2 lines
85 KiB
JavaScript
2 lines
85 KiB
JavaScript
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 u,s as $,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,O as q,_ as O,P as V,Q as A,R as S,T as C,h as L,U as F,V as U,W as j,X as z,j as B,m as H,o as G,v as R,r as W,w as Y,Y as J,Z as X,$ as Z,a0 as K,a1 as Q,a2 as tt,l as et,D as st,B as nt,a3 as at,u as rt,E as ct,p as lt,q as ot,a4 as it,A as ut,a5 as $t,a6 as ht,a7 as pt,a8 as ft,a9 as mt,aa as dt,ab as gt,ac as vt,ad as yt,ae as _t,x as bt}from"../chunks/vendor-7686ecbd.js";import wt,{Updux as xt}from"updux";function Et(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 u=d(e);s=m(u,"H1",{class:!0});var $=d(s);n=g($,"The Docks"),$.forEach(v),a=y(u),r=m(u,"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),u.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,u){w(t,e,u),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 It extends i{constructor(t){super(),u(this,t,null,Et,$,{})}}const kt=(t={})=>[T(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>kt(t)))];function Dt(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(kt,k,D(P("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:M("mass",i),cost:M("cost",i)}}const Pt=t=>Math.ceil(Math.round(10*t)/10);const Mt=require("@yanick/updeep").default,Tt=N("set_ftl",q()),Nt=N("set_ftl_reqs",q()),qt=new wt({initial:{mass:0,cost:0,type:"none"}});qt.addMutation(Tt,(t=>Mt.update({type:t}))),qt.addMutation(Nt,(t=>Mt.update(t)));var Ot=qt.asDux;const Vt=require("@yanick/updeep").default,At=N("set_engine",q()),St=N("set_drive_reqs",q()),Ct=new xt({initial:{mass:1,cost:2,rating:1}});Ct.addMutation(At,(t=>Vt.update(t))),Ct.addMutation(St,(t=>Vt.update(t)));var Lt=Ct.asDux;function Ft(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 jt=require("@yanick/updeep").default,zt=N("add_weapon",q()),Bt=N("remove_weapon",q()),Ht=(Gt=t=>jt(Ft(t)),t=>Gt(t)(t));var Gt;const Rt=new wt({initial:[]}),Wt={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"]}};Rt.addMutation(zt,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},Ht(Wt[t])),{id:s})]})),Rt.addMutation(Bt,(t=>e=>e.filter((e=>e.id!==t))));const Yt=N("set_weapon",q());Rt.addMutation(Yt,(t=>jt.map(jt.if(_.matches({id:t.id}),(e=>Ht(jt(t,e)))))));var Jt=Rt.asDux;const Xt=require("@yanick/updeep").default,Zt=new wt({initial:{rating:0,cost:0,mass:0}});Zt.addMutation(N("set_adfc",q()),(t=>Xt.update({rating:t,mass:2*t,cost:8*t})));var Kt=Zt.asDux;require("@yanick/updeep").default;var Qt=new wt({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Jt,adfc:Kt}}).asDux;const te=[{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 ee(t=0,e=!1){return console.log({carrier:e}),te.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const se=require("@yanick/updeep").default,ne=new wt({initial:{standard:0,advanced:0,cost:0,mass:0}}),ae=N("set_screens",q());ne.addMutation(ae,(t=>se.update(t)));const re=N("set_screens_reqs",q());ne.addMutation(re,(t=>se.update(t)));var ce=ne.asDux;const le=require("@yanick/updeep").default,oe=new wt({initial:[]}),ie=N("set_armour_nbr_layers",q());oe.addMutation(ie,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length<t&&(e=[e,O.times(t-e.length,(()=>[]))].flat()),e=le.map(((t,e)=>l({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),oe.addMutation(N("set_armour_layer",q()),(({layer:t,rating:e})=>le.map(le.if(O.matches({layer:t}),le({rating:e,cost:2*t*e,mass:2*e})))));var ue=oe.asDux;require("@yanick/updeep").default;var $e=new wt({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:ce,armour:ue}}).asDux;require("@yanick/updeep").default;const he=new wt({initial:{space:0,cost:0,mass:0}}),pe=N("set_cargo",q());he.addMutation(pe,(t=>()=>({space:t,cost:0,mass:t})));var fe=he.asDux;const me=require("@yanick/updeep").default,de=new wt({initial:{type:"none",cost:0,mass:0}}),ge=N("set_streamlining",q());de.addMutation(ge,(t=>me.update({type:t})));const ve=N("set_streamlining_cost_mass",q());de.addMutation(ve,(t=>me.update(t)));var ye=de.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 be=require("@yanick/updeep").default,we=new wt({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),xe=N("set_squadron",q());we.addMutation(xe,(({id:t,type:e})=>be.update({squadrons:be.map(be.if(O.matches({id:t}),be({type:e,cost:6*O.find(_e,{type:e}).cost,mass:6})))})));const Ee=N("set_carrier_bays",q());we.addMutation(Ee,(t=>e=>((e=be.update({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=be.update({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length<t&&(e=be.update({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 Ie=we.asDux;const ke=require("@yanick/updeep").default,De=N("set_ship_mass",q()),Pe=N("set_name",q()),Me=N("set_ship_reqs",q()),Te=N("set_hull",q()),Ne=N("set_ship_type",q()),qe=N("reset"),Oe={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}};console.log(wt);const Ve=new wt({subduxes:{ftl:Ot,engine:Lt,weaponry:Qt,structure:$e,cargo:fe,streamlining:ye,carrier:Ie},initial:Oe});Ve.addMutation(qe,(()=>()=>Oe)),Ve.addMutation(Te,(({rating:t})=>e=>ke.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),Ve.addMutation(De,(t=>ke.updateIn("general",{mass:t}))),Ve.addMutation(Pe,(t=>ke.updateIn("general",{name:t}))),Ve.addMutation(N("set_ship_class",q()),(t=>ke.updateIn("general",{ship_class:t}))),Ve.addMutation(Me,(({cost:t,mass:e})=>ke.updateIn("general",{cost:t,used_mass:e}))),Ve.addSubscription((t=>V(Dt,(e=>t.dispatch(Me(e)))))),Ve.addSubscription((t=>V((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=Pt(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(Ve.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),Ve.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=ee(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)))})))),Ve.addMutation(Ne,(t=>ke.updateIn("general.ship_type",t))),Ve.addSubscription((t=>V([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Ot.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))))))),Ve.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,Pt(.05*e)),r=n*Math.max(4,Pt(.075*e));t.dispatch(Ve.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),Ve.addSubscription((t=>V([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(Ve.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 Ae=N("set_firecons",q());Ve.addMutation(Ae,(t=>ke.updateIn("weaponry.firecons",l({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var Se=Ve.asDux;let Ce=C;Ce=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function Le(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)&&L(a,t[0])},i(t){c||(F((()=>{r||(r=U(e,j,{},!0)),r.run(1)})),c=!0)},o(t){r||(r=U(e,j,{},!1)),r.run(0),c=!1},d(t){t&&v(e),t&&r&&r.end()}}}function Fe(t,e,s){let n,{ship:a={}}=e;return z(),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 Ue extends i{constructor(t){super(),u(this,t,Fe,Le,$,{ship:1})}}function je(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&&L(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function ze(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Be extends i{constructor(t){super(),u(this,t,ze,je,$,{cost:0})}}function He(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&&L(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function Ge(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class Re extends i{constructor(t){super(),u(this,t,Ge,He,$,{mass:0})}}function We(t){let e,s,n,a,r,c,l,o,i,u,$,_,E,I,k;return _=new Be({props:{cost:t[2]}}),I=new Re({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]),u=f(),$=h("div"),B(_.$$.fragment),E=p("\n \n "),B(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),u=y(f),$=m(f,"DIV",{class:!0});var w=d($);H(_.$$.fragment,w),E=g(w,"\n \n "),H(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($,"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,u),x(r,$),G(_,$,null),x($,E),G(I,$,null),k=!0},p(t,[e]){(!k||1&e)&&L(l,t[0]),(!k||2&e)&&L(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||(R(_.$$.fragment,t),R(I.$$.fragment,t),k=!0)},o(t){W(_.$$.fragment,t),W(I.$$.fragment,t),k=!1},d(t){t&&v(e),t&&v(a),t&&v(r),Y(_),Y(I)}}}function Ye(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(),u(this,t,Ye,We,$,{ship_class:0,ship_type:1,cost:2,mass:3})}}function Xe(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 Ze(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&&L(s,t[1])},d(t){t&&v(e)}}}function Ke(t){let e,s,n,a,r,c="none"!==t[0]&&Xe(),l=t[1]>0&&Ze(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=Xe(),c.c(),c.m(e,s)):c&&(c.d(1),c=null),t[1]>0?l?l.p(t,a):(l=Ze(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 Qe(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 ts extends i{constructor(t){super(),u(this,t,Qe,Ke,$,{ftl:0,engine:1})}}function es(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function ss(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function ns(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 as(t,e){let s,n=e[10]&&ns();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=ns(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&v(s),n&&n.d()}}}function rs(t,e){let s,n,a=[],r=new Map,c=e[7];const l=t=>t[12];for(let o=0;o<c.length;o+=1){let t=ss(e,c,o),s=l(t);r.set(s,a[o]=as(s,t))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=f(),this.h()},l(t){s=m(t,"DIV",{class:!0});var e=d(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=y(e),e.forEach(v),this.h()},h(){b(s,"class","row svelte-qekx9g"),this.first=s},m(t,e){w(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);x(s,n)},p(t,o){e=t,1&o&&(c=e[7],a=J(a,o,l,1,e,c,r,s,X,as,n,ss))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function cs(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[9];for(let c=0;c<a.length;c+=1){let e=es(t,a,c),l=r(e);n.set(l,s[c]=rs(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c()},l(t){e=m(t,"DIV",{});var n=d(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(v)},m(t,n){w(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[c]){1&c&&(a=t[0],s=J(s,c,r,1,t,a,n,e,X,rs,null,es))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function ls(t,e){if(e<=1)return[t];let s=t.length/e;return t.length%e&&s++,[t.slice(0,s),...ls(t.slice(s),e-1)]}function os(t,e,s){let n,a,r,{ship_mass:c=0}=e,{rating:l=0}=e,{advanced:o=!1}=e,i=[];return t.$$set=t=>{"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=Pt(c/20)),96&t.$$.dirty&&s(5,a=ls(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=ls(a,n))},[i,c,l,o,n,a,r]}class is extends i{constructor(t){super(),u(this,t,os,cs,$,{ship_mass:1,rating:2,advanced:3})}}function us(t,e,s){const n=t.slice();return n[1]=e[s],n}function $s(t,e,s){const n=t.slice();return n[4]=e[s],n}function hs(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 ps(t,e){let s,n,a=[],r=new Map,c=O.range(e[1].rating);const l=t=>t[4];for(let o=0;o<c.length;o+=1){let t=$s(e,c,o),s=l(t);r.set(s,a[o]=hs(s))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=f(),this.h()},l(t){s=m(t,"DIV",{class:!0});var e=d(s);for(let s=0;s<a.length;s+=1)a[s].l(e);n=y(e),e.forEach(v),this.h()},h(){b(s,"class","layer"),this.first=s},m(t,e){w(t,s,e);for(let n=0;n<a.length;n+=1)a[n].m(s,null);x(s,n)},p(t,o){e=t,1&o&&(c=O.range(e[1].rating),a=J(a,o,l,0,e,c,r,s,X,hs,n,$s))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function fs(t){let e,s=[],n=new Map,a=t[0];const r=t=>t[1];for(let c=0;c<a.length;c+=1){let e=us(t,a,c),l=r(e);n.set(l,s[c]=ps(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);for(let e=0;e<s.length;e+=1)s[e].l(n);n.forEach(v),this.h()},h(){b(e,"class","layers svelte-15e5q3d")},m(t,n){w(t,e,n);for(let a=0;a<s.length;a+=1)s[a].m(e,null)},p(t,[c]){1&c&&(a=t[0],s=J(s,c,r,1,t,a,n,e,X,ps,null,us))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function ms(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 ds extends i{constructor(t){super(),u(this,t,ms,fs,$,{armour:0})}}function gs(t){let e,s,n,a,r;return s=new ds({props:{armour:t[0].armour}}),a=new is({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment)},l(t){e=m(t,"DIV",{});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v)},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(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||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function vs(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 ys extends i{constructor(t){super(),u(this,t,vs,gs,$,{structure:0,ship_mass:1})}}function _s(t){let e,s,n,a;return{c(){e=Z("g"),s=Z("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"),K(s,"active",t[0]),b(e,"transform",t[2])},m(r,c){w(r,e,c),x(e,s),n||(a=Q(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&b(s,"d",t[1]),1&n&&K(s,"active",t[0]),4&n&&b(e,"transform",t[2])},i:E,o:E,d(t){t&&v(e),n=!1,a()}}}function bs(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,u;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,u=`rotate(${c[n]},${a},${a})`)},[r,i,u,n,a,l,o,function(e){tt(t,e)}]}class ws extends i{constructor(t){super(),u(this,t,bs,_s,$,{arc:3,radius:4,active:0})}}function xs(t,e,s){const n=t.slice();return n[8]=e[s],n}function Es(t,e){let s,n,a;return n=new ws({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=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(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||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function Is(t){let e,s,n,a,r,c,l=[],o=new Map,i=t[2];const u=t=>t[8];for(let p=0;p<i.length;p+=1){let e=xs(t,i,p),s=u(e);o.set(s,l[p]=Es(s,e))}const $=t[5].default,h=st($,t,t[4],null);return{c(){e=Z("svg");for(let t=0;t<l.length;t+=1)l[t].c();s=Z("circle"),h&&h.c(),this.h()},l(t){e=m(t,"svg",{width:!0,height:!0},1);var n=d(e);for(let e=0;e<l.length;e+=1)l[e].l(n);s=m(n,"circle",{cx:!0,cy:!0,r:!0,class:!0},1),d(s).forEach(v),h&&h.l(n),n.forEach(v),this.h()},h(){b(s,"cx","50%"),b(s,"cy","50%"),b(s,"r",n=t[1]/3),b(s,"class","svelte-qqgo8u"),b(e,"width",a=t[1]+"px"),b(e,"height",r=t[1]+"px")},m(t,n){w(t,e,n);for(let s=0;s<l.length;s+=1)l[s].m(e,null);x(e,s),h&&h.m(e,null),c=!0},p(t,[p]){15&p&&(i=t[2],nt(),l=J(l,p,u,1,t,i,o,e,at,Es,s,xs),rt()),(!c||2&p&&n!==(n=t[1]/3))&&b(s,"r",n),h&&h.p&&(!c||16&p)&&ct(h,$,t,t[4],p,null,null),(!c||2&p&&a!==(a=t[1]+"px"))&&b(e,"width",a),(!c||2&p&&r!==(r=t[1]+"px"))&&b(e,"height",r)},i(t){if(!c){for(let t=0;t<i.length;t+=1)R(l[t]);R(h,t),c=!0}},o(t){for(let e=0;e<l.length;e+=1)W(l[e]);W(h,t),c=!1},d(t){t&&v(e);for(let e=0;e<l.length;e+=1)l[e].d();h&&h.d(t)}}}function ks(t,e,s){let{$$slots:n={},$$scope:a}=e;let{selected:r=[]}=e,{size:c=60}=e;const l=z(),o=t=>l("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 Ds extends i{constructor(t){super(),u(this,t,ks,Is,$,{selected:0,size:1})}}function Ps(t){let e,s;return{c(){e=Z("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&&L(s,t[0])},d(t){t&&v(e)}}}function Ms(t){let e,s,n;return s=new Ds({props:{selected:t[1],size:"40",$$slots:{default:[Ps]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);H(s.$$.fragment,n),n.forEach(v),this.h()},h(){b(e,"class","svelte-1u8rlr5")},m(t,a){w(t,e,a),G(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||(R(s.$$.fragment,t),n=!0)},o(t){W(s.$$.fragment,t),n=!1},d(t){t&&v(e),Y(s)}}}function Ts(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 Ns extends i{constructor(t){super(),u(this,t,Ts,Ms,$,{weapon_class:0,arcs:1})}}function qs(t,e,s){const n=t.slice();return n[2]=e[s],n}function Os(t){let e,s;const n=[t[2]];let a={};for(let r=0;r<n.length;r+=1)a=ut(a,n[r]);return e=new Ns({props:a}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const a=1&s?lt(n,[ot(t[2])]):{};e.$set(a)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Vs(t){let e,s,n,a=t[0],r=[];for(let l=0;l<a.length;l+=1)r[l]=Os(qs(t,a,l));const c=t=>W(r[t],1,1,(()=>{r[t]=null}));return{c(){e=h("div"),s=h("div");for(let t=0;t<r.length;t+=1)r[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);s=m(n,"DIV",{class:!0});var a=d(s);for(let e=0;e<r.length;e+=1)r[e].l(a);a.forEach(v),n.forEach(v),this.h()},h(){b(s,"class","beams svelte-18nuiwu"),b(e,"class","weapons svelte-18nuiwu")},m(t,a){w(t,e,a),x(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 c=qs(t,a,n);r[n]?(r[n].p(c,e),R(r[n],1)):(r[n]=Os(c),r[n].c(),R(r[n],1),r[n].m(s,null))}for(nt(),n=a.length;n<r.length;n+=1)c(n);rt()}},i(t){if(!n){for(let t=0;t<a.length;t+=1)R(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)W(r[e]);n=!1},d(t){t&&v(e),it(r,t)}}}function As(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 Ss extends i{constructor(t){super(),u(this,t,As,Vs,$,{weapons:1})}}function Cs(t,e,s){const n=t.slice();return n[1]=e[s],n}function Ls(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 Fs(t){let e,s=_.range(t[0]),n=[];for(let a=0;a<s.length;a+=1)n[a]=Ls(Cs(t,s,a));return{c(){e=h("div");for(let t=0;t<n.length;t+=1)n[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var s=d(e);for(let e=0;e<n.length;e+=1)n[e].l(s);s.forEach(v),this.h()},h(){b(e,"class","svelte-10x4b15")},m(t,s){w(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)Cs(t,s,r),n[r]||(n[r]=Ls(),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:E,o:E,d(t){t&&v(e),it(n,t)}}}function Us(t,e,s){let{firecons:n=0}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons)},[n]}class js extends i{constructor(t){super(),u(this,t,Us,Fs,$,{firecons:0})}}function zs(t,e,s){const n=t.slice();return n[2]=e[s],n}function Bs(t,e,s){const n=t.slice();return n[2]=e[s],n}function Hs(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 Gs(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 Rs(t){let e,s,n=O.range(t[0]),a=[];for(let l=0;l<n.length;l+=1)a[l]=Hs(Bs(t,n,l));let r=O.range(t[1]),c=[];for(let l=0;l<r.length;l+=1)c[l]=Gs(zs(t,r,l));return{c(){e=h("div");for(let t=0;t<a.length;t+=1)a[t].c();s=f();for(let t=0;t<c.length;t+=1)c[t].c();this.h()},l(t){e=m(t,"DIV",{class:!0});var n=d(e);for(let e=0;e<a.length;e+=1)a[e].l(n);s=y(n);for(let e=0;e<c.length;e+=1)c[e].l(n);n.forEach(v),this.h()},h(){b(e,"class","svelte-kh7po5")},m(t,n){w(t,e,n);for(let s=0;s<a.length;s+=1)a[s].m(e,null);x(e,s);for(let s=0;s<c.length;s+=1)c[s].m(e,null)},p(t,[l]){if(1&l){const r=n.length;let c;for(n=O.range(t[0]),c=r;c<n.length;c+=1)Bs(t,n,c),a[c]||(a[c]=Hs(),a[c].c(),a[c].m(e,s));for(c=n.length;c<r;c+=1)a[c].d(1);a.length=n.length}if(2&l){const s=r.length;let n;for(r=O.range(t[1]),n=s;n<r.length;n+=1)zs(t,r,n),c[n]||(c[n]=Gs(),c[n].c(),c[n].m(e,null));for(n=r.length;n<s;n+=1)c[n].d(1);c.length=r.length}},i:E,o:E,d(t){t&&v(e),it(a,t),it(c,t)}}}function Ws(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 Ys extends i{constructor(t){super(),u(this,t,Ws,Rs,$,{standard:0,advanced:1})}}function Js(t){let e,s,n,a,r;s=new js({props:{firecons:t[0]}});const c=[t[1]];let l={};for(let o=0;o<c.length;o+=1)l=ut(l,c[o]);return a=new Ys({props:l}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-ytgy37")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.firecons=t[0]),s.$set(n);const r=2&e?lt(c,[ot(t[1])]):{};a.$set(r)},i(t){r||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function Xs(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 Zs extends i{constructor(t){super(),u(this,t,Xs,Js,$,{firecons:0,screens:1})}}function Ks(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=ut(E,_[h]);return s=new Je({props:E}),a=new Ss({props:{weapons:t[0].weaponry.weapons}}),l=new ys({props:{structure:t[0].structure,ship_mass:t[0].general.mass}}),i=new Zs({props:{firecons:t[0].weaponry.firecons.nbr,screens:t[0].structure.screens}}),$=new ts({props:{ftl:t[0].ftl.type,engine:t[0].engine.rating}}),{c(){e=h("aside"),B(s.$$.fragment),n=f(),B(a.$$.fragment),r=f(),c=h("div"),B(l.$$.fragment),o=f(),B(i.$$.fragment),u=f(),B($.$$.fragment),this.h()},l(t){e=m(t,"ASIDE",{class:!0});var h=d(e);H(s.$$.fragment,h),n=y(h),H(a.$$.fragment,h),r=y(h),c=m(h,"DIV",{class:!0});var p=d(c);H(l.$$.fragment,p),o=y(p),H(i.$$.fragment,p),p.forEach(v),u=y(h),H($.$$.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),G(s,e,null),x(e,n),G(a,e,null),x(e,r),x(e,c),G(l,c,null),x(c,o),G(i,c,null),x(e,u),G($,e,null),g=!0},p(t,[e]){const n=1&e?lt(_,[ot(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 u={};1&e&&(u.ftl=t[0].ftl.type),1&e&&(u.engine=t[0].engine.rating),$.$set(u)},i(t){g||(R(s.$$.fragment,t),R(a.$$.fragment,t),R(l.$$.fragment,t),R(i.$$.fragment,t),R($.$$.fragment,t),F((()=>{p||(p=U(e,j,{},!0)),p.run(1)})),g=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),W(l.$$.fragment,t),W(i.$$.fragment,t),W($.$$.fragment,t),p||(p=U(e,j,{},!1)),p.run(0),g=!1},d(t){t&&v(e),Y(s),Y(a),Y(l),Y(i),Y($),t&&p&&p.end()}}}function Qs(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class tn extends i{constructor(t){super(),u(this,t,Qs,Ks,$,{ship:0})}}function en(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&&L(s,t[0])},d(t){t&&v(e)}}}function sn(t){let e,s,n,a=t[0]&&en(t);const r=t[4].default,c=st(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=Q(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=en(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),c?c.p&&(!n||8&o)&&ct(c,r,t,t[3],o,null,null):l&&l.p&&6&o&&l.p(t,o)},i(t){n||(R(l,t),n=!0)},o(t){W(l,t),n=!1},d(t){t&&v(e),a&&a.d(),l&&l.d(t)}}}function nn(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){tt(t,e)}]}class an extends i{constructor(t){super(),u(this,t,nn,sn,$,{label:0,value:1,placeholder:2})}}function rn(t,e,s){const n=t.slice();return n[7]=e[s],n}function cn(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]+"")&&L(n,r),8&c&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function ln(t){let e,s,n,a=[],r=new Map,c=t[3];const l=t=>t[7];for(let o=0;o<c.length;o+=1){let e=rn(t,c,o),s=l(e);r.set(s,a[o]=cn(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c()},l(t){e=m(t,"SELECT",{value:!0});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v)},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[2]),s||(n=Q(e,"change",t[5]),s=!0)},p(t,s){8&s&&(c=t[3],a=J(a,s,l,1,t,c,r,e,X,cn,null,rn)),12&s&&pt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function on(t){let e,s,n,a,r;return s=new an({props:{label:"ship class",value:t[1].ship_class}}),s.$on("change",t[4]),a=new an({props:{label:"ship type",$$slots:{default:[ln]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-fc2507")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(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||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function un(t,e,s){let n,a=E,r=()=>(a(),a=ht(l,(t=>s(6,n=t))),l);t.$$.on_destroy.push((()=>a()));let c,{ship:l=$t("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=ee(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 $n extends i{constructor(t){super(),u(this,t,un,on,$,{ship:0})}}function hn(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]+"")&&L(s,n)},d(t){t&&v(e),t&&v(s)}}}function pn(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&&L(s,t[1])},d(t){t&&v(e),t&&v(s)}}}function fn(t){let e,s,n,a,r,c,l,o;function i(t,e){return t[3]?pn:hn}let u=i(t),$=u(t);return{c(){e=h("input"),n=f(),a=h("span"),r=f(),c=h("div"),$.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);$.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"),K(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),$.m(c,null),l||(o=Q(e,"change",t[4]),l=!0)},p(t,n){4&n&&s!==(s=t[2].general.mass)&&(e.value=s),u===(u=i(t))&&$?$.p(t,n):($.d(1),$=u(t),$&&($.c(),$.m(c,null))),8&n&&K(c,"warning",!t[3])},d(t){t&&v(e),t&&v(n),t&&v(a),t&&v(r),t&&v(c),$.d(),l=!1,o()}}}function mn(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+"")&&L(s,n)},d(t){t&&v(e)}}}function dn(t){let e,s,n,a,r,c;return s=new an({props:{label:"ship tonnage",$$slots:{default:[fn]},$$scope:{ctx:t}}}),r=new an({props:{label:"cost",$$slots:{default:[mn]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),a=h("div"),B(r.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var c=d(e);H(s.$$.fragment,c),c.forEach(v),n=y(t),a=m(t,"DIV",{class:!0});var l=d(a);H(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),G(s,e,null),w(t,n,l),w(t,a,l),G(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||(R(s.$$.fragment,t),R(r.$$.fragment,t),c=!0)},o(t){W(s.$$.fragment,t),W(r.$$.fragment,t),c=!1},d(t){t&&v(e),Y(s),t&&v(n),t&&v(a),Y(r)}}}function gn(t,e,s){let n,a=E,r=()=>(a(),a=ht(c,(t=>s(2,n=t))),c);t.$$.on_destroy.push((()=>a()));let{ship:c=$t("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 vn extends i{constructor(t){super(),u(this,t,gn,dn,$,{ship:0})}}function yn(t){let e,s,n,a;return e=new $n({}),n=new vn({}),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t)},m(t,r){G(e,t,r),w(t,s,r),G(n,t,r),a=!0},p:E,i(t){a||(R(e.$$.fragment,t),R(n.$$.fragment,t),a=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),a=!1},d(t){Y(e,t),t&&v(s),Y(n,t)}}}class _n extends i{constructor(t){super(),u(this,t,null,yn,$,{})}}function bn(t){let e,s,n,a,r,c,l,o,i,u,$,_,I,k,D,P,M,T,N,q,O,V,A,S,C,L,j,z,B,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 "),u=h("a"),$=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(),q=h("p"),O=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."),V=f(),A=h("p"),S=p("Written by\n "),C=h("a"),L=p("Yanick Champoux"),j=p("\n . Code available on\n "),z=h("a"),B=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 "),u=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),q=m(h,"P",{});var F=d(q);O=g(F,"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."),F.forEach(v),V=y(h),A=m(h,"P",{});var U=d(A);S=g(U,"Written by\n "),C=m(U,"A",{href:!0});var H=d(C);L=g(H,"Yanick Champoux"),H.forEach(v),j=g(U,"\n . Code available on\n "),z=m(U,"A",{href:!0});var G=d(z);B=g(G,"Github"),G.forEach(v),U.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(u,"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(z,"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,u),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,q),x(q,O),x(e,V),x(e,A),x(A,S),x(A,C),x(C,L),x(A,j),x(A,z),x(z,B),G=!0,R||(W=Q(n,"click",t[0]),R=!0)},p:E,i(t){G||(F((()=>{H||(H=U(e,ft,{x:-800,opacity:1},!0)),H.run(1)})),G=!0)},o(t){H||(H=U(e,ft,{x:-800,opacity:1},!1)),H.run(0),G=!1},d(t){t&&v(e),t&&H&&H.end(),R=!1,W()}}}function wn(t){const e=z();return[()=>e("close")]}class xn extends i{constructor(t){super(),u(this,t,wn,bn,$,{})}}function En(t){let e,s,n,a,r,c,l,o;const i=t[5].default,u=st(i,t,t[4],null);return{c(){e=h("div"),u&&u.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);u&&u.l(i),i.forEach(v),s=y(o),n=m(o,"DIV",{class:!0});var $=d(n);a=g($,t[0]),$.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,$){w(i,e,$),u&&u.m(e,null),w(i,s,$),w(i,n,$),x(n,a),t[6](n),w(i,r,$),w(i,c,$),x(c,l),t[7](c),o=!0},p(t,[e]){u&&u.p&&(!o||16&e)&&ct(u,i,t,t[4],e,null,null),(!o||1&e)&&L(a,t[0]),(!o||2&e)&&L(l,t[1])},i(t){o||(R(u,t),o=!0)},o(t){W(u,t),o=!1},d(a){a&&v(e),u&&u.d(a),a&&v(s),a&&v(n),t[6](null),a&&v(r),a&&v(c),t[7](null)}}}function In(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){mt[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){mt[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class kn extends i{constructor(t){super(),u(this,t,In,En,$,{mass:0,cost:1})}}function Dn(t){let e,s,n,a,r,c,l;const o=t[2].default,i=st(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 u=d(s);n=g(u,t[0]),u.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)&&L(n,t[0]),i&&i.p&&(!l||2&e)&&ct(i,o,t,t[1],e,null,null)},i(t){l||(R(i,t),l=!0)},o(t){W(i,t),l=!1},d(t){t&&v(e),t&&v(c),i&&i.d(t)}}}function Pn(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 Mn extends i{constructor(t){super(),u(this,t,Pn,Dn,$,{label:0})}}function Tn(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),gt(e,t[0]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Nn(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),gt(e,t[1]),s||(n=Q(e,"input",t[5]),s=!0)},p(t,s){2&s&&dt(e.value)!==t[1]&>(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function qn(t){let e,s,n,a,r;return s=new an({props:{label:"screens",$$slots:{default:[Tn]},$$scope:{ctx:t}}}),a=new an({props:{label:"advanced screens",$$slots:{default:[Nn]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(s.$$.fragment),n=f(),B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);H(s.$$.fragment,r),n=y(r),H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-11x6jvv")},m(t,c){w(t,e,c),G(s,e,null),x(e,n),G(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||(R(s.$$.fragment,t),R(a.$$.fragment,t),r=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),r=!1},d(t){t&&v(e),Y(s),Y(a)}}}function On(t){let e,s;return e=new kn({props:{cost:t[2],mass:t[3],$$slots:{default:[qn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Vn(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:c=0}=e;const l=z();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=dt(this.value),s(0,r)},function(){c=dt(this.value),s(1,c)}]}class An extends i{constructor(t){super(),u(this,t,Vn,On,$,{cost:2,mass:3,standard:0,advanced:1})}}function Sn(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),gt(e,t[0]),s||(n=Q(e,"input",t[2]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Cn(t){let e,s;return e=new an({props:{label:`layer ${t[1]}`,$$slots:{default:[Sn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ln(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=z();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",ue.actions.set_armour_layer({layer:n,rating:a}))},[a,n,function(){a=dt(this.value),s(0,a)}]}class Fn extends i{constructor(t){super(),u(this,t,Ln,Cn,$,{layer:1,rating:0})}}function Un(t,e,s){const n=t.slice();return n[7]=e[s],n}function jn(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),gt(e,t[3]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){8&s&&dt(e.value)!==t[3]&>(e,t[3])},d(t){t&&v(e),s=!1,n()}}}function zn(t,e){let s,n,a;const r=[e[7]];let c={};for(let l=0;l<r.length;l+=1)c=ut(c,r[l]);return n=new Fn({props:c}),n.$on("ship_change",e[5]),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(n,t,e),a=!0},p(t,s){e=t;const a=4&s?lt(r,[ot(e[7])]):{};n.$set(a)},i(t){a||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function Bn(t){let e,s,n,a,r,c,l=[],o=new Map;n=new an({props:{label:"armour layers",$$slots:{default:[jn]},$$scope:{ctx:t}}});let i=t[2];const u=t=>t[7].layer;for(let $=0;$<i.length;$+=1){let e=Un(t,i,$),s=u(e);o.set(s,l[$]=zn(s,e))}return{c(){e=h("div"),s=h("div"),B(n.$$.fragment),a=f(),r=h("div");for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=m(t,"DIV",{});var c=d(e);s=m(c,"DIV",{class:!0});var o=d(s);H(n.$$.fragment,o),o.forEach(v),a=y(c),r=m(c,"DIV",{class:!0});var i=d(r);for(let e=0;e<l.length;e+=1)l[e].l(i);i.forEach(v),c.forEach(v),this.h()},h(){b(s,"class","nbr_layers"),b(r,"class","layers svelte-1bx91qz")},m(t,o){w(t,e,o),x(e,s),G(n,s,null),x(e,a),x(e,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);c=!0},p(t,e){const s={};1032&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s),4&e&&(i=t[2],nt(),l=J(l,e,u,1,t,i,o,r,at,zn,null,Un),rt())},i(t){if(!c){R(n.$$.fragment,t);for(let t=0;t<i.length;t+=1)R(l[t]);c=!0}},o(t){W(n.$$.fragment,t);for(let e=0;e<l.length;e+=1)W(l[e]);c=!1},d(t){t&&v(e),Y(n);for(let e=0;e<l.length;e+=1)l[e].d()}}}function Hn(t){let e,s;return e=new kn({props:{cost:t[0],mass:t[1],$$slots:{default:[Bn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Gn(t,e,s){let{armour:n=[]}=e,{cost:a=0}=e,{mass:r=0}=e,c=n.length;const l=z();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&&l("ship_change",ue.actions.set_armour_nbr_layers(c))},[a,r,n,c,function(){c=dt(this.value),s(3,c)},function(e){tt(t,e)}]}class Rn extends i{constructor(t){super(),u(this,t,Gn,Hn,$,{armour:2,cost:0,mass:1})}}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-qworsx")},m(a,r){w(a,e,r),gt(e,t[0]),s||(n=Q(e,"input",t[3]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Yn(t){let e,s;return e=new an({props:{label:"cargo",$$slots:{default:[Wn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Jn(t){let e,s;return e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[Yn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Xn(t,e,s){$t("ship");let{space:n=0}=e,{cost:a=0}=e,{mass:r=0}=e;const c=z();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",fe.actions.set_cargo(n))},[n,a,r,function(){n=dt(this.value),s(0,n)}]}class Zn extends i{constructor(t){super(),u(this,t,Xn,Jn,$,{space:0,cost:1,mass:2})}}function Kn(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(),u=h("label"),$=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),u=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($,"type","radio"),$.__value="full",$.value=$.__value,t[5][0].push($),b(u,"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,u),x(u,$),$.checked=$.__value===t[0],x(u,_),E||(I=[Q(n,"change",t[4]),Q(l,"change",t[6]),Q($,"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&&($.checked=$.__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($),1),E=!1,vt(I)}}}function Qn(t){let e,s;return e=new an({props:{label:"streamlining",$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ta(t){let e,s;return e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[Qn]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ea(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=$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,c=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&c(ye.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 sa extends i{constructor(t){super(),u(this,t,ea,ta,$,{type:0,cost:1,mass:2,ship_change:3})}}function na(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),gt(e,t[0]),s||(n=Q(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&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function aa(t){let e,s;return e=new an({props:{label:"integrity",$$slots:{default:[na]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ra(t){let e,s,n,a,r,c,l,o,i,u;e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[aa]},$$scope:{ctx:t}}});const $=[t[3]];let h={};for(let f=0;f<$.length;f+=1)h=ut(h,$[f]);n=new An({props:h}),n.$on("set_screens",t[11]),r=new Rn({props:{armour:t[4]}}),r.$on("ship_change",t[12]);const p=[t[5]];let m={};for(let f=0;f<p.length;f+=1)m=ut(m,p[f]);l=new Zn({props:m}),l.$on("set_cargo",t[13]);const d=[t[6]];let g={};for(let f=0;f<d.length;f+=1)g=ut(g,d[f]);return i=new sa({props:g}),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment),a=f(),B(r.$$.fragment),c=f(),B(l.$$.fragment),o=f(),B(i.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t),a=y(t),H(r.$$.fragment,t),c=y(t),H(l.$$.fragment,t),o=y(t),H(i.$$.fragment,t)},m(t,$){G(e,t,$),w(t,s,$),G(n,t,$),w(t,a,$),G(r,t,$),w(t,c,$),G(l,t,$),w(t,o,$),G(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 c=8&s?lt($,[ot(t[3])]):{};n.$set(c);const o={};16&s&&(o.armour=t[4]),r.$set(o);const u=32&s?lt(p,[ot(t[5])]):{};l.$set(u);const h=64&s?lt(d,[ot(t[6])]):{};i.$set(h)},i(t){u||(R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t),R(l.$$.fragment,t),R(i.$$.fragment,t),u=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),W(r.$$.fragment,t),W(l.$$.fragment,t),W(i.$$.fragment,t),u=!1},d(t){Y(e,t),t&&v(s),Y(n,t),t&&v(a),Y(r,t),t&&v(c),Y(l,t),t&&v(o),Y(i,t)}}}function ca(t){let e,s;return e=new Mn({props:{label:"hull",$$slots:{default:[ra]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};33279&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function la(t,e,s){let n,a,{cost:r}=e,{mass:c}=e,{ship_mass:l}=e,{rating:o}=e,{screens:i}=e,{armour:u=[]}=e,{cargo:$={}}=e,{streamlining:h={}}=e;const p=z();return t.$$set=t=>{"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,u=t.armour),"cargo"in t&&s(5,$=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=dt(this.value),s(0,o)},function(e){tt(t,e)},function(e){tt(t,e)},function(e){tt(t,e)}]}class oa extends i{constructor(t){super(),u(this,t,la,ca,$,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function ia(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),gt(e,t[0]),s||(n=Q(e,"input",t[3]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function ua(t){let e,s;return e=new an({props:{label:"firecons",$$slots:{default:[ia]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function $a(t){let e,s;return e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[ua]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ha(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const c=z();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=dt(this.value),s(0,n)}]}class pa extends i{constructor(t){super(),u(this,t,ha,$a,$,{nbr:0,cost:1,mass:2})}}function fa(t,e,s){const n=t.slice();return n[8]=e[s],n}function ma(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=[Q(n,"change",e[5]),Q(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,vt(o)}}}function da(t){let e,s=[],n=new Map,a=t[4];const r=t=>t[8];for(let c=0;c<a.length;c+=1){let e=fa(t,a,c),l=r(e);n.set(l,s[c]=ma(l,e))}return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=et()},l(t){for(let e=0;e<s.length;e+=1)s[e].l(t);e=et()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);w(t,e,n)},p(t,c){25&c&&(a=t[4],s=J(s,c,r,1,t,a,n,e.parentNode,X,ma,e,fa))},d(t){for(let e=0;e<s.length;e+=1)s[e].d(t);t&&v(e)}}}function ga(t){let e,s;return e=new an({props:{label:"FTL drive",$$slots:{default:[da]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function va(t){let e,s;return e=new kn({props:{mass:t[2],cost:t[1],$$slots:{default:[ga]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ya(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e;const c=z();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,()=>c("change_ftl",n),["none","standard","advanced"],function(){n=this.__value,s(0,n)},[[]]]}class _a extends i{constructor(t){super(),u(this,t,ya,va,$,{type:0,cost:1,mass:2})}}function ba(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),gt(e,t[1]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){2&s&&dt(e.value)!==t[1]&>(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function wa(t){let e,s,n,a,r,c,l,o,i;return s=new an({props:{label:"thrust rating",$$slots:{default:[ba]},$$scope:{ctx:t}}}),{c(){e=h("div"),B(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);H(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(u,e,$),G(s,e,null),x(e,n),x(e,a),x(a,r),r.checked=t[0],x(a,c),l=!0,o||(i=Q(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||(R(s.$$.fragment,t),l=!0)},o(t){W(s.$$.fragment,t),l=!1},d(t){t&&v(e),Y(s),o=!1,i()}}}function xa(t){let e,s;return e=new kn({props:{cost:t[2],mass:t[3],$$slots:{default:[wa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ea(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:c=0}=e;const l=z();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=dt(this.value),s(1,c)},function(){r=this.checked,s(0,r)}]}class Ia extends i{constructor(t){super(),u(this,t,Ea,xa,$,{cost:2,mass:3,advanced:0,rating:1})}}function ka(t){let e,s,n,a;const r=[t[1]];let c={};for(let i=0;i<r.length;i+=1)c=ut(c,r[i]);e=new Ia({props:c}),e.$on("change_engine",t[2]);const l=[t[0]];let o={};for(let i=0;i<l.length;i+=1)o=ut(o,l[i]);return n=new _a({props:o}),n.$on("change_ftl",t[3]),{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment)},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t)},m(t,r){G(e,t,r),w(t,s,r),G(n,t,r),a=!0},p(t,s){const a=2&s?lt(r,[ot(t[1])]):{};e.$set(a);const c=1&s?lt(l,[ot(t[0])]):{};n.$set(c)},i(t){a||(R(e.$$.fragment,t),R(n.$$.fragment,t),a=!0)},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),a=!1},d(t){Y(e,t),t&&v(s),Y(n,t)}}}function Da(t){let e,s;return e=new Mn({props:{label:"propulsion",$$slots:{default:[ka]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};19&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Pa(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){tt(t,e)},function(e){tt(t,e)}]}class Ma extends i{constructor(t){super(),u(this,t,Pa,Da,$,{ftl:0,engine:1})}}function Ta(t,e,s){const n=t.slice();return n[2]=e[s],n}function Na(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 u=d(e);s=m(u,"OPTION",{value:!0});var $=d(s);n=g($,"1"),$.forEach(v),a=m(u,"OPTION",{value:!0});var h=d(a);r=g(h,"2"),h.forEach(v),c=m(u,"OPTION",{value:!0});var p=d(c);l=g(p,"3"),p.forEach(v),o=m(u,"OPTION",{value:!0});var f=d(o);i=g(f,"4"),f.forEach(v),u.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]&&F((()=>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),pt(e,t[0]),u||($=Q(e,"change",t[10]),u=!0)},p(t,s){1&s&&pt(e,t[0])},d(t){t&&v(e),u=!1,$()}}}function qa(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]+"")&&L(n,r),1&c&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function Oa(t){let e,s,n,a=[],r=new Map,c=t[3][t[0]]||[];const l=t=>t[2];for(let o=0;o<c.length;o+=1){let e=Ta(t,c,o),s=l(e);r.set(s,a[o]=qa(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=m(t,"SELECT",{});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[2]&&F((()=>t[11].call(e)))},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[2]),s||(n=Q(e,"change",t[11]),s=!0)},p(t,s){9&s&&(c=t[3][t[0]]||[],a=J(a,s,l,1,t,c,r,e,X,qa,null,Ta)),13&s&&pt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Va(t){let e,s,n,a,r,c,l,o,i;return a=new an({props:{label:"beam class",$$slots:{default:[Na]},$$scope:{ctx:t}}}),c=new an({props:{label:"arcs",$$slots:{default:[Oa]},$$scope:{ctx:t}}}),o=new Ds({props:{selected:t[1]}}),o.$on("click_arc",t[12]),{c(){e=h("label"),s=p("beam"),n=f(),B(a.$$.fragment),r=f(),B(c.$$.fragment),l=f(),B(o.$$.fragment)},l(t){e=m(t,"LABEL",{});var i=d(e);s=g(i,"beam"),i.forEach(v),n=y(t),H(a.$$.fragment,t),r=y(t),H(c.$$.fragment,t),l=y(t),H(o.$$.fragment,t)},m(t,u){w(t,e,u),x(e,s),w(t,n,u),G(a,t,u),w(t,r,u),G(c,t,u),w(t,l,u),G(o,t,u),i=!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}),c.$set(n);const r={};2&e&&(r.selected=t[1]),o.$set(r)},i(t){i||(R(a.$$.fragment,t),R(c.$$.fragment,t),R(o.$$.fragment,t),i=!0)},o(t){W(a.$$.fragment,t),W(c.$$.fragment,t),W(o.$$.fragment,t),i=!1},d(t){t&&v(e),t&&v(n),Y(a,t),t&&v(r),Y(c,t),t&&v(l),Y(o,t)}}}function Aa(t,e,s){const n=["FS","F","FP","AP","A","AS"];let{weapon_type:a}=e,{id:r}=e,{weapon_class:c=1}=e,{arcs:l=["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"]},u=6;const $=t=>{if("broadside"===u)return;let e=n.findIndex((e=>e===t));const a=[];O.range(u).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,l=a)};let h=1,p="";const f=z();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,u=i[c][0]),6&t.$$.dirty&&l.length!==u)if("broadside"===u)s(1,l=n.filter((t=>1===t.length)));else{let t=n.findIndex((t=>l[0]));-1===t&&(t=0);const e=[];O.range(u).forEach((s=>{e.push(n[t]),t=(t+1)%n.length})),s(1,l=e)}6&t.$$.dirty&&console.log({arcs:l,nbr_arcs:u}),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,u,i,$,a,r,o,h,p,function(){c=yt(this),s(0,c)},function(){u=yt(this),s(2,u),s(3,i),s(0,c),s(3,i),s(0,c)},({detail:t})=>$(t)]}class Sa extends i{constructor(t){super(),u(this,t,Aa,Va,$,{weapon_type:5,id:6,weapon_class:0,arcs:1,ship_change:7})}}function Ca(t){let e,s,n,a,r;return a=new Ds({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=p("submunition pack"),n=f(),B(a.$$.fragment)},l(t){e=m(t,"LABEL",{});var r=d(e);s=g(r,"submunition pack"),r.forEach(v),n=y(t),H(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),G(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(R(a.$$.fragment,t),r=!0)},o(t){W(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),Y(a,t)}}}function La(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])},c=z();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 Fa extends i{constructor(t){super(),u(this,t,La,Ca,$,{arcs:0,ship_change:2})}}function Ua(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 ja extends i{constructor(t){super(),u(this,t,null,Ua,$,{})}}function za(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 Ba extends i{constructor(t){super(),u(this,t,null,za,$,{})}}function Ha(t){let e,s,n,a,r;return a=new Ds({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=p("needle weapon"),n=f(),B(a.$$.fragment)},l(t){e=m(t,"LABEL",{});var r=d(e);s=g(r,"needle weapon"),r.forEach(v),n=y(t),H(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),G(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(R(a.$$.fragment,t),r=!0)},o(t){W(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),Y(a,t)}}}function Ga(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])},c=z();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 Ra extends i{constructor(t){super(),u(this,t,Ga,Ha,$,{arcs:0,ship_change:2})}}function Wa(t){let e,s,n,a,r,c,l;const o=[t[0]];var i=t[3][t[4]];function u(t){let e={};for(let s=0;s<o.length;s+=1)e=ut(e,o[s]);return{props:e}}return i&&(a=new i(u()),a.$on("change",t[6])),{c(){e=h("div"),s=h("input"),n=f(),a&&B(a.$$.fragment),this.h()},l(t){e=m(t,"DIV",{class:!0});var r=d(e);s=m(r,"INPUT",{type:!0,class:!0,value:!0}),n=y(r),a&&H(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(s,"type","button"),b(s,"class","button small red remove"),s.value="remove",b(e,"class","weapon_row svelte-1vypk50")},m(o,i){w(o,e,i),x(e,s),x(e,n),a&&G(a,e,null),r=!0,c||(l=Q(s,"click",t[5]),c=!0)},p(t,s){const n=1&s?lt(o,[ot(t[0])]):{};if(i!==(i=t[3][t[4]])){if(a){nt();const t=a;W(t.$$.fragment,1,0,(()=>{Y(t,1)})),rt()}i?(a=new i(u()),a.$on("change",t[6]),B(a.$$.fragment),R(a.$$.fragment,1),G(a,e,null)):a=null}else i&&a.$set(n)},i(t){r||(a&&R(a.$$.fragment,t),r=!0)},o(t){a&&W(a.$$.fragment,t),r=!1},d(t){t&&v(e),a&&Y(a),c=!1,l()}}}function Ya(t){let e,s;return e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[Wa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ja(t,e,s){const n={beam:Sa,submunition:Fa,pds:ja,scattergun:Ba,needle:Ra};let{weapon:a={}}=e,{id:r}=e,{cost:c}=e,{mass:o}=e,{ship_change:i=$t("ship_change")||(()=>{})}=e,u=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,u,()=>i(Se.actions.remove_weapon(r)),({detail:t})=>{i(Se.actions.set_weapon(l({id:r,weapon_type:u},t)))},r,i]}class Xa extends i{constructor(t){super(),u(this,t,Ja,Ya,$,{weapon:0,id:7,cost:1,mass:2,ship_change:8})}}function Za(t,e,s){const n=t.slice();return n[0]=e[s],n}function Ka(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 Qa(t){let e,s,n,a=[],r=new Map,c=t[4];const l=t=>t[0];for(let o=0;o<c.length;o+=1){let e=Za(t,c,o),s=l(e);r.set(s,a[o]=Ka(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=m(t,"SELECT",{});var s=d(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[0]&&F((()=>t[7].call(e)))},m(r,c){w(r,e,c);for(let t=0;t<a.length;t+=1)a[t].m(e,null);pt(e,t[0]),s||(n=Q(e,"change",t[7]),s=!0)},p(t,s){16&s&&(c=t[4],a=J(a,s,l,1,t,c,r,e,X,Ka,null,Za)),17&s&&pt(e,t[0])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function tr(t){let e,s;return e=new an({props:{label:`squadron ${t[1]}`,$$slots:{default:[Qa]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function er(t){let e,s;return e=new kn({props:{cost:t[2],mass:t[3],$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function sr(t,e,s){const n=_e.map((({type:t})=>t));let{id:a=1}=e,{type:r="standard"}=e,{ftl:c=!1}=e,{cost:l=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,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(Ie.actions.set_squadron({id:a,type:r}))},[r,a,l,o,n,c,i,function(){r=yt(this),s(0,r),s(4,n)}]}class nr extends i{constructor(t){super(),u(this,t,sr,er,$,{id:1,type:0,ftl:5,cost:2,mass:3,ship_change:6})}}function ar(t,e,s){const n=t.slice();return n[6]=e[s],n}function rr(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),gt(e,t[0]),s||(n=Q(e,"input",t[5]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function cr(t){let e,s;return e=new an({props:{label:"bays",$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function lr(t,e){let s,n,a;const r=[e[6]];let c={};for(let l=0;l<r.length;l+=1)c=ut(c,r[l]);return n=new nr({props:c}),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(n,t,e),a=!0},p(t,s){e=t;const a=2&s?lt(r,[ot(e[6])]):{};n.$set(a)},i(t){a||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function or(t){let e,s,n,a,r=[],c=new Map;e=new kn({props:{cost:t[2],mass:t[3],$$slots:{default:[cr]},$$scope:{ctx:t}}});let l=t[1];const o=t=>t[6].id;for(let i=0;i<l.length;i+=1){let e=ar(t,l,i),s=o(e);c.set(s,r[i]=lr(s,e))}return{c(){B(e.$$.fragment),s=f();for(let t=0;t<r.length;t+=1)r[t].c();n=et()},l(t){H(e.$$.fragment,t),s=y(t);for(let e=0;e<r.length;e+=1)r[e].l(t);n=et()},m(t,c){G(e,t,c),w(t,s,c);for(let e=0;e<r.length;e+=1)r[e].m(t,c);w(t,n,c),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&&(l=t[1],nt(),r=J(r,s,o,1,t,l,c,n.parentNode,at,lr,n,ar),rt())},i(t){if(!a){R(e.$$.fragment,t);for(let t=0;t<l.length;t+=1)R(r[t]);a=!0}},o(t){W(e.$$.fragment,t);for(let e=0;e<r.length;e+=1)W(r[e]);a=!1},d(t){Y(e,t),t&&v(s);for(let e=0;e<r.length;e+=1)r[e].d(t);t&&v(n)}}}function ir(t){let e,s;return e=new Mn({props:{label:"carrier",$$slots:{default:[or]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};527&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function ur(t,e,s){let{bays:n=0}=e,{squadrons:a=[]}=e,{cost:r=0}=e,{mass:c=0}=e,{ship_change:l=$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,c=t.mass),"ship_change"in t&&s(4,l=t.ship_change)},t.$$.update=()=>{17&t.$$.dirty&&l(Ie.actions.set_carrier_bays(n))},[n,a,r,c,l,function(){n=dt(this.value),s(0,n)}]}class $r extends i{constructor(t){super(),u(this,t,ur,ir,$,{bays:0,squadrons:1,cost:2,mass:3,ship_change:4})}}function hr(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),gt(e,t[0]),s||(n=Q(e,"input",t[4]),s=!0)},p(t,s){1&s&&dt(e.value)!==t[0]&>(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function pr(t){let e,s;return e=new an({props:{label:"ADFC",$$slots:{default:[hr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function fr(t){let e,s;return e=new kn({props:{cost:t[1],mass:t[2],$$slots:{default:[pr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(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||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function mr(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=$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,c=t.ship_change)},t.$$.update=()=>{9&t.$$.dirty&&c(Se.actions.set_adfc(n))},[n,a,r,c,function(){n=dt(this.value),s(0,n)}]}class dr extends i{constructor(t){super(),u(this,t,mr,fr,$,{rating:0,cost:1,mass:2,ship_change:3})}}function gr(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"),u=h("option"),$=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),u=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,u.__value="needle",u.value=u.__value,void 0===t[0]&&F((()=>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,u),x(u,$),pt(e,t[0]),w(h,_,p),w(h,E,p),I||(k=[Q(e,"change",t[3]),Q(E,"click",t[1])],I=!0)},p(t,s){1&s&&pt(e,t[0])},d(t){t&&v(e),t&&v(_),t&&v(E),I=!1,vt(k)}}}function vr(t){let e,s;return e=new an({props:{label:"weapon type",$$slots:{default:[gr]},$$scope:{ctx:t}}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function yr(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(Se.actions.add_weapon(n)),a,function(){n=yt(this),s(0,n)}]}class _r extends i{constructor(t){super(),u(this,t,yr,vr,$,{weapon_type:0,ship_change:2})}}function br(t,e,s){const n=t.slice();return n[23]=e[s],n}function wr(t){let e,s;return e=new xn({props:{show:t[2]}}),e.$on("close",t[12]),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function xr(t){let e,s,n,a,r,c,l,o,i,u,$,_,E,I,k,D,P,M,T;s=new _n({}),a=new Ma({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 q={};for(let h=0;h<N.length;h+=1)q=ut(q,N[h]);c=new oa({props:q}),c.$on("change_hull",t[7]),c.$on("set_screens",t[10]),c.$on("set_cargo",t[11]),c.$on("ship_change",t[11]),o=new Mn({props:{label:"weaponry",$$slots:{default:[Dr]},$$scope:{ctx:t}}});const O=[t[1].carrier];let V={};for(let h=0;h<O.length;h+=1)V=ut(V,O[h]);return u=new $r({props:V}),{c(){e=h("main"),B(s.$$.fragment),n=f(),B(a.$$.fragment),r=f(),B(c.$$.fragment),l=f(),B(o.$$.fragment),i=f(),B(u.$$.fragment),$=f(),_=h("footer"),E=p("Written by "),I=h("a"),k=p("Yanick Champoux"),D=p(".\n Code available on "),P=h("a"),M=p("Github"),this.h()},l(t){e=m(t,"MAIN",{class:!0});var h=d(e);H(s.$$.fragment,h),n=y(h),H(a.$$.fragment,h),r=y(h),H(c.$$.fragment,h),l=y(h),H(o.$$.fragment,h),i=y(h),H(u.$$.fragment,h),h.forEach(v),$=y(t),_=m(t,"FOOTER",{class:!0});var p=d(_);E=g(p,"Written by "),I=m(p,"A",{href:!0});var f=d(I);k=g(f,"Yanick Champoux"),f.forEach(v),D=g(p,".\n Code available on "),P=m(p,"A",{href:!0});var b=d(P);M=g(b,"Github"),b.forEach(v),p.forEach(v),this.h()},h(){b(e,"class","svelte-4zjur4"),b(I,"href","https://twitter.com/yenzie"),b(P,"href","https://github.com/yanick/aotds-shipyard"),b(_,"class","svelte-4zjur4")},m(t,h){w(t,e,h),G(s,e,null),x(e,n),G(a,e,null),x(e,r),G(c,e,null),x(e,l),G(o,e,null),x(e,i),G(u,e,null),w(t,$,h),w(t,_,h),x(_,E),x(_,I),x(I,k),x(_,D),x(_,P),x(P,M),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},ot(t[1].structure.hull),{screens:t[1].structure.screens},{armour:t[1].structure.armour},{cargo:t[1].cargo},{streamlining:t[1].streamlining}]):{};c.$set(n);const r={};67108867&e&&(r.$$scope={dirty:e,ctx:t}),o.$set(r);const l=2&e?lt(O,[ot(t[1].carrier)]):{};u.$set(l)},i(t){T||(R(s.$$.fragment,t),R(a.$$.fragment,t),R(c.$$.fragment,t),R(o.$$.fragment,t),R(u.$$.fragment,t),T=!0)},o(t){W(s.$$.fragment,t),W(a.$$.fragment,t),W(c.$$.fragment,t),W(o.$$.fragment,t),W(u.$$.fragment,t),T=!1},d(t){t&&v(e),Y(s),Y(a),Y(c),Y(o),Y(u),t&&v($),t&&v(_)}}}function Er(t){let e,s;return e=new tn({props:{ship:t[1]}}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function Ir(t){let e,s;return e=new Ue({props:{ship:t[1]}}),e.$on("close",t[17]),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}function kr(t,e){let s,n,a;return n=new Xa({props:{weapon:e[23],id:e[23].id,cost:e[23].cost,mass:e[23].mass}}),{key:t,first:null,c(){s=et(),B(n.$$.fragment),this.h()},l(t){s=et(),H(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),G(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||(R(n.$$.fragment,t),a=!0)},o(t){W(n.$$.fragment,t),a=!1},d(t){t&&v(s),Y(n,t)}}}function Dr(t){let e,s,n,a,r,c,l,o,i=[],u=new Map;const $=[t[1].weaponry.firecons];let h={};for(let f=0;f<$.length;f+=1)h=ut(h,$[f]);e=new pa({props:h}),e.$on("change_firecons",t[8]);const p=[t[1].weaponry.adfc];let m={};for(let f=0;f<p.length;f+=1)m=ut(m,p[f]);n=new dr({props:m}),r=new _r({});let d=t[0];const g=t=>t[23].id;for(let f=0;f<d.length;f+=1){let e=br(t,d,f),s=g(e);u.set(s,i[f]=kr(s,e))}return{c(){B(e.$$.fragment),s=f(),B(n.$$.fragment),a=f(),B(r.$$.fragment),c=f();for(let t=0;t<i.length;t+=1)i[t].c();l=et()},l(t){H(e.$$.fragment,t),s=y(t),H(n.$$.fragment,t),a=y(t),H(r.$$.fragment,t),c=y(t);for(let e=0;e<i.length;e+=1)i[e].l(t);l=et()},m(t,u){G(e,t,u),w(t,s,u),G(n,t,u),w(t,a,u),G(r,t,u),w(t,c,u);for(let e=0;e<i.length;e+=1)i[e].m(t,u);w(t,l,u),o=!0},p(t,s){const a=2&s?lt($,[ot(t[1].weaponry.firecons)]):{};e.$set(a);const r=2&s?lt(p,[ot(t[1].weaponry.adfc)]):{};n.$set(r),1&s&&(d=t[0],nt(),i=J(i,s,g,1,t,d,u,l.parentNode,at,kr,l,br),rt())},i(t){if(!o){R(e.$$.fragment,t),R(n.$$.fragment,t),R(r.$$.fragment,t);for(let t=0;t<d.length;t+=1)R(i[t]);o=!0}},o(t){W(e.$$.fragment,t),W(n.$$.fragment,t),W(r.$$.fragment,t);for(let e=0;e<i.length;e+=1)W(i[e]);o=!1},d(t){Y(e,t),t&&v(s),Y(n,t),t&&v(a),Y(r,t),t&&v(c);for(let e=0;e<i.length;e+=1)i[e].d(t);t&&v(l)}}}function Pr(t){let e,s,n,a,r,c,l,o,i,u,$,p,g,_,E,I,k,D,P,M,T,N,q;e=new It({});let O=t[2]&&wr(t);const V=[Ir,Er,xr],A=[];function S(t,e){return"json"===t[3]?0:"print"===t[3]?1:2}return D=S(t),P=A[D]=V[D](t),{c(){B(e.$$.fragment),s=f(),n=h("nav"),a=h("input"),r=f(),c=h("div"),l=f(),o=h("input"),i=f(),u=h("ul"),$=h("input"),p=f(),g=h("input"),_=f(),E=h("input"),I=f(),O&&O.c(),k=f(),P.c(),M=et(),this.h()},l(t){H(e.$$.fragment,t),s=y(t),n=m(t,"NAV",{class:!0});var h=d(n);a=m(h,"INPUT",{class:!0,type:!0,value:!0}),r=y(h),c=m(h,"DIV",{class:!0}),d(c).forEach(v),l=y(h),o=m(h,"INPUT",{type:!0,class:!0,value:!0}),i=y(h),u=m(h,"UL",{class:!0});var f=d(u);$=m(f,"INPUT",{type:!0,class:!0,value:!0}),p=y(f),g=m(f,"INPUT",{type:!0,class:!0,value:!0}),_=y(f),E=m(f,"INPUT",{type:!0,class:!0,value:!0}),f.forEach(v),h.forEach(v),I=y(t),O&&O.l(t),k=y(t),P.l(t),M=et(),this.h()},h(){b(a,"class","reset button small red svelte-4zjur4"),b(a,"type","button"),a.value="reset",b(c,"class","spacer svelte-4zjur4"),b(o,"type","button"),b(o,"class","button small notes svelte-4zjur4"),o.value="notes",b($,"type","button"),b($,"class","button small green"),$.value="editor",b(g,"type","button"),b(g,"class","button small green"),g.value="json",b(E,"type","button"),b(E,"class","button small green"),E.value="print",b(u,"class","button-group"),b(n,"class","svelte-4zjur4")},m(h,f){G(e,h,f),w(h,s,f),w(h,n,f),x(n,a),x(n,r),x(n,c),x(n,l),x(n,o),x(n,i),x(n,u),x(u,$),x(u,p),x(u,g),x(u,_),x(u,E),w(h,I,f),O&&O.m(h,f),w(h,k,f),A[D].m(h,f),w(h,M,f),T=!0,N||(q=[Q(a,"click",t[9]),Q(o,"click",t[12]),Q($,"click",t[14]),Q(g,"click",t[15]),Q(E,"click",t[16])],N=!0)},p(t,[e]){t[2]?O?(O.p(t,e),4&e&&R(O,1)):(O=wr(t),O.c(),R(O,1),O.m(k.parentNode,k)):O&&(nt(),W(O,1,1,(()=>{O=null})),rt());let s=D;D=S(t),D===s?A[D].p(t,e):(nt(),W(A[s],1,1,(()=>{A[s]=null})),rt(),P=A[D],P?P.p(t,e):(P=A[D]=V[D](t),P.c()),R(P,1),P.m(M.parentNode,M))},i(t){T||(R(e.$$.fragment,t),R(O),R(P),T=!0)},o(t){W(e.$$.fragment,t),W(O),W(P),T=!1},d(t){Y(e,t),t&&v(s),t&&v(n),t&&v(I),O&&O.d(t),t&&v(k),A[D].d(t),t&&v(M),N=!1,vt(q)}}}function Mr(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=Se.createStore(t,(t=>Ce(A(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Dt(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))),bt("ship",a),n.general.name;let r=[];const c=a.dispatch.reset;bt("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 Tr extends i{constructor(t){super(),u(this,t,Mr,Pr,$,{})}}function Nr(t){let e,s;return e=new Tr({}),{c(){B(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,n){G(e,t,n),s=!0},p:E,i(t){s||(R(e.$$.fragment,t),s=!0)},o(t){W(e.$$.fragment,t),s=!1},d(t){Y(e,t)}}}export default class extends i{constructor(t){super(),u(this,t,null,Nr,$,{})}}
|