aotds-docks/docs/_app/pages/index.svelte-de0f4c9d.js
2021-06-13 13:04:00 -04:00

2 lines
93 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 f,k as p,c as d,a as m,g,d as v,n as y,b,f as w,F as x,G as E,H as I,I as O,J as k,K as D,L as A,M,N as P,O as S,P as T,Q as j,R as N,T as V,U as q,V as C,W as L,X as F,Y as U,Z as B,_ as z,$ as H,a0 as G,a1 as R,a2 as W,a3 as Y,a4 as J,a5 as X,a6 as Z,h as K,a7 as Q,a8 as tt,a9 as et,aa as st,j as nt,m as at,o as rt,v as ct,r as lt,w as ot,ab as it,ac as ut,ad as $t,ae as ht,af as ft,ag as pt,l as dt,D as mt,B as gt,ah as vt,u as yt,E as _t,p as bt,q as wt,ai as xt,A as Et,aj as It,ak as Ot,al as kt,am as Dt,an as At,ao as Mt,ap as Pt,aq as St,ar as Tt,as as jt,x as Nt}from"../chunks/vendor-d574e9c5.js";function Vt(t){let e,s,n,a,r,c,l,o,i;return{c(){e=h("header"),s=h("h1"),n=f("The Docks"),a=p(),r=h("h2"),c=f("a "),l=h("a"),o=f("Full Thrust"),i=f(" ship builder"),this.h()},l(t){e=d(t,"HEADER",{class:!0});var u=m(e);s=d(u,"H1",{class:!0});var $=m(s);n=g($,"The Docks"),$.forEach(v),a=y(u),r=d(u,"H2",{class:!0});var h=m(r);c=g(h,"a "),l=d(h,"A",{href:!0});var f=m(l);o=g(f,"Full Thrust"),f.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 qt extends i{constructor(t){super(),u(this,t,null,Vt,$,{})}}const Ct=(t={})=>[M(["cost","mass"],t),...Object.values(t||{}).filter((t=>"object"==typeof t)).map((t=>Ct(t)))];function Lt(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(Ct,O,k(D("cost")))(o(l({},c),{cost:s.mass,mass:0}));return{mass:A("mass",i),cost:A("cost",i)}}const Ft=t=>Math.ceil(Math.round(10*t)/10);function Ut(t){var e=t;return function(){return e}}function Bt(t){return Array.isArray(t)?t:P((""+t).split("."),(function(t){return!t}))}var zt=S.placeholder;function Ht(t,e){return void 0===e&&(e=t.length),S(t,e)}var Gt=Ht((function(t,e,s){for(var n=Bt(t),a=s,r=0;r<n.length;r+=1){if(void 0===a)return!1;a=a[n[r]]}return"function"==typeof e?e(a):e===a}));function Rt(t,e){return void 0===e&&(e=t.length),Ht((function(){for(var e=[],s=0;s<arguments.length;s++)e[s]=arguments[s];return t.apply(void 0,e)}),e)}var Wt=function(){return(Wt=Object.assign||function(t){for(var e,s=1,n=arguments.length;s<n;s++)for(var a in e=arguments[s])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)},Yt=function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;var n=Array(t),a=0;for(e=0;e<s;e++)for(var r=arguments[e],c=0,l=r.length;c<l;c++,a++)n[a]=r[c];return n},Jt={__omitted:!0},Xt=Ut(Jt);function Zt(t){return!Object.keys(t).length}function Kt(t,e){return function(t,e,s){return Object.keys(t).reduce((function(s,n){return e(s,t[n],n)}),s)}(t,(function(t,s,n){var a=s;return Array.isArray(s)||null===s||"object"!=typeof s?"function"==typeof s&&(a=s(e[n])):a=te(s,e[n]),e[n]!==a&&(t[n]=a),t}),{})}function Qt(t,e){var s=Yt(e);return Object.keys(t).forEach((function(e){s[e]=t[e]})),s}function te(t,e){for(var s=[],n=2;n<arguments.length;n++)s[n-2]=arguments[n];if("function"==typeof t)return t.apply(void 0,Yt([e],s));if(!T(t))return t;var a=null==e?{}:e,r=Kt(t,a);return Zt(r)?a:Array.isArray(a)?Qt(r,a).filter((function(t){return t!==Jt})):j(Wt(Wt({},a),r),(function(t){return t===Jt}))}var ee=Rt(te,2);var se=Rt((function(t,e,s,n){var a="function"==typeof t?t(n):"boolean"==typeof t?t:N(n,t);return ee(a?e:s,n)})),ne=Ht((function(t,e,s){return se(t,e,(function(t){return t}),s)}));var ae=Rt((function(t,e){var s="function"==typeof t?t:ee(t),n=(Array.isArray(e)?q:C)(e,s);return function(t,e){var s=!0;return V(e,(function(e,n){if(e!==t[n])return s=!1,!1})),s}(e,n)?e:n}));var re=Rt((function(t,e){return L(e,t)}));var ce=Rt((function(t,e){return j(e,t)}));var le=Rt((function(t,e){var s=P(e,t);return e.length===s.length?e:s}));function oe(t,e){var s;return"*"===e?function(e){var s;return Object.prototype.hasOwnProperty.call(e,"*")?ee(((s={})["*"]=t,s),e):ae(t,e)}:((s={})[e]=t,s)}var ie=Ht((function(t,e,s){var n=Bt(t).reduceRight(oe,e);return ee(n,s)}));var ue=Ht((function(t,e,s){return ee(e,void 0===s?t:s)}));var $e=Rt((function(t,e,s,n){"function"!=typeof e&&(e=ee(e)),"function"!=typeof s&&(s=ee(s));var a=!1,r=ae(ne(t,(function(t){return a=!0,e(t)})),n);return a?r:s(n)}));var he=Rt((function(t,e,s){return $e(t,e,(function(t){return t}),s)})),fe={constant:Ut,is:Gt,map:ae,omit:re,omitBy:ce,ifElse:se,if:ne,update:ee,updateIn:ie,withDefault:ue,reject:le,omitted:Xt,_:zt,mapWhen:he,mapWhenElse:$e},pe=ee;Object.assign(pe,fe);const de=t=>0==t.length?()=>t=>t:t.reduce(((t,e)=>(s=null,n)=>a=>e(s,n)(t(s,n)(a))));function me(t={},e={},s=[]){const n=Object.entries(e).map((([t,e])=>(s,n)=>pe.updateIn(t,e(n)))),a=s.map((t=>(e,s)=>t(s))),r=de([...n,...a]);let c={};return Object.entries(t).forEach((([t,e])=>{const[s,n]=Array.isArray(e)?e:[e,!1];c[t]=n?s:de([r,s])})),c["*"]||(c["*"]=r),c}const ge=()=>t=>e=>t(e);function ve(t=[],e=[],s={}){let n=[...e,...Object.entries(s).map((([t,e])=>function(t,e){return s=>e(Object.assign(Object.assign({},s),{getState:()=>F.get(t,s.getState())}))}(t,e)))],a=!1,r=t.flatMap((t=>t!==ge?t:(a=!0,n)));return a||(r=[...r,...n]),(t=>e=>s=>t.reduceRight(((t,s)=>s(e)(t)),s))(r)}function ye(t,e){return s=>n=>{void 0===n&&(n=t);const a=e[s.type]||e["*"];return a?a(s.payload,s)(n):n}}function _e([t,e]){return e?Object.entries(F.mapValues((e=>s=>e(s[t])))(e)):[]}class be{constructor(t={}){var e,s,n,a,r,c,l,o;this.localSelectors={},this.localEffects=[],this.localActions={},this.localMutations={},this.localSubscriptions=[],this.localInitial=null!==(e=t.initial)&&void 0!==e?e:{},this.localSelectors=null!==(s=t.selectors)&&void 0!==s?s:{},this.coduxes=null!==(n=t.coduxes)&&void 0!==n?n:[],this.subduxes=null!==(a=t.subduxes)&&void 0!==a?a:{},Object.entries(null!==(r=t.actions)&&void 0!==r?r:{}).forEach((t=>this.addAction(...t))),this.coduxes.forEach((t=>Object.entries(t.actions).forEach((t=>this.addAction(...t))))),Object.values(this.subduxes).forEach((t=>{Object.entries(t.actions).forEach((t=>{this.addAction(...t)}))})),t.subscriptions&&t.subscriptions.forEach((t=>this.addSubscription(t))),this.groomMutations=null!==(c=t.groomMutations)&&void 0!==c?c:t=>t;let i=null!==(l=t.effects)&&void 0!==l?l:[];Array.isArray(i)||(i=Object.entries(i)),i.forEach((t=>this.addEffect(...t)));let u=null!==(o=t.mutations)&&void 0!==o?o:[];Array.isArray(u)||(u=F.toPairs(u)),u.forEach((t=>this.addMutation(...t)))}get initial(){return function(t,e=[],s={}){return F.isPlainObject(t)?F.flow([pe(F.omit(["*"],s)),e.map((t=>pe(t))),pe(t)].flat())({}):t}(this.localInitial,this.coduxes.map((({initial:t})=>t)),F.mapValues("initial",this.subduxes))}get middleware(){const t=this.selectors,e=this.actions;return ve(this.localEffects.map((s=>((t,e,s)=>{let[n,a,r]=t;if(a===ge)return ge;r&&(a=a());const c=t=>a(Object.assign(Object.assign({},t),{actions:e,selectors:s}));return"*"===n?c:t=>e=>s=>s.type!==n?e(s):c(t)(e)(s)})(s,e,t))),this.coduxes.map(F.get("middleware")),F.mapValues("middleware",this.subduxes))}get actions(){return this.localActions}get upreducer(){return ye(this.initial,this.mutations)}get reducer(){return(t,e)=>this.upreducer(e)(t)}get mutations(){return me(this.localMutations,F.mapValues("upreducer",this.subduxes),F.map("upreducer",this.coduxes))}get subduxUpreducer(){return ye(this.initial,me({},this.subduxes))}createStore(...t){const e=function(t,e,s={}){return function(n,a){let r=a?a(e):U(e);const c=B(t,n,r);return c.actions=s,c}}(this.reducer,this.middleware,this.actions)(...t);return function(t,e=[]){e.forEach((e=>{const s=e(t);let n=t.subscribe((()=>{const e=t.getState();return s(e,n)}))}))}(e,this.subscriptions),e}get subscriptions(){return[this.localSubscriptions,Object.entries(this.subduxes).map((([t,e])=>e.subscriptions.map((e=>function(t,e){return s=>{const n=e(s);return(e,s)=>n(F.get(t,e),s)}}(t,e)))))].flat(1/0).map((t=>function(t){return e=>{const s=t(e);let n;return(t,e)=>{if(t!==n)return n=t,s(t,e)}}}(t)))}get asDux(){return{createStore:this.createStore.bind(this),upreducer:this.upreducer,subduxes:this.subduxes,coduxes:this.coduxes,middleware:this.middleware,actions:this.actions,reducer:this.reducer,mutations:this.mutations,initial:this.initial,selectors:this.selectors,subscriptions:this.subscriptions}}addMutation(t,e,s){const n=this.addAction(t);this.localMutations[n.type]=[this.groomMutations(e),s]}addEffect(t,e,s=!1){const n=this.addAction(t);this.localEffects.push([n.type,e,s])}addAction(t,e){var s;let n,a;"string"==typeof t?(n=t,a=e?e.type?e:z(n,((...t)=>({payload:e(...t)}))):null!==(s=this.localActions[n])&&void 0!==s?s:z(n,H())):(n=t.type,a=t);const r=this.localActions[n];if(!r)return this.localActions[n]=a;if(r!==a&&"*"!==r.type)throw new Error(`action ${n} already exists`);return r}get _middlewareEntries(){const t=t=>F.groupBy((([,,t])=>["^","$"].includes(t)?t:"middle"),t),e=F.flow([F.toPairs,F.map((([t,e])=>e._middlewareEntries.map((([e,s,...n])=>[e,[t,...s],...n])))),F.flatten,t])(this.subduxes),s=t(this.localEffects.map((t=>[this,[],...t])));return F.flatten([s["^"],e["^"],s.middle,e.middle,e.$,s.$].filter((t=>t)))}addSelector(t,e){this.localSelectors[t]=e}get selectors(){return function(t={},e=[],s={}){return Object.fromEntries([Object.entries(s).flatMap(_e),Object.entries(e),Object.entries(t)].flat())}(this.localSelectors,F.map("selectors",this.coduxes),F.mapValues("selectors",this.subduxes))}addSubscription(t){this.localSubscriptions=[...this.localSubscriptions,t]}}const we=G("set_ftl",R()),xe=G("set_ftl_reqs",R());console.log(be);const Ee=new be({initial:{mass:0,cost:0,type:"none"}});Ee.addMutation(we,(t=>pe.update({type:t}))),Ee.addMutation(xe,(t=>pe.update(t)));var Ie=Ee.asDux;const Oe=G("set_engine",R()),ke=G("set_drive_reqs",R()),De=new be({initial:{mass:1,cost:2,rating:1}});De.addMutation(Oe,(t=>pe.update(t))),De.addMutation(ke,(t=>pe.update(t)));var Ae=De.asDux;function Me(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,Pe(e)?s+=2:s+=e.length-1);4==t&&(s=8,Pe(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 Pe=t=>4===t.length&&!t.some((t=>1===t.length));const Se=G("add_weapon",R()),Te=G("remove_weapon",R()),je=(Ne=t=>pe(Me(t)),t=>Ne(t)(t));var Ne;const Ve=new be({initial:[]}),qe={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"]}};Ve.addMutation(Se,(t=>e=>{const s=1+Math.max(0,...e.map((({id:t})=>t)));return[...e,o(l({},je(qe[t])),{id:s})]})),Ve.addMutation(Te,(t=>e=>e.filter((e=>e.id!==t))));const Ce=G("set_weapon",R());Ve.addMutation(Ce,(t=>pe.map(pe.if(_.matches({id:t.id}),(e=>je(pe(t,e)))))));var Le=Ve.asDux;const Fe=new be({initial:{rating:0,cost:0,mass:0}});Fe.addMutation(G("set_adfc",R()),(t=>pe.update({rating:t,mass:2*t,cost:8*t})));var Ue=new be({initial:{firecons:{nbr:0,cost:0,mass:0}},subduxes:{weapons:Le,adfc:Fe.asDux}}).asDux;const Be=[{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 ze(t=0,e=!1){return console.log({carrier:e}),Be.filter((t=>e==!!t.carrier)).filter((e=>e.mass[0]<=t)).filter((e=>e.mass[1]>=t))}const He=new be({initial:{standard:0,advanced:0,cost:0,mass:0}}),Ge=G("set_screens",R());He.addMutation(Ge,(t=>pe.update(t)));const Re=G("set_screens_reqs",R());He.addMutation(Re,(t=>pe.update(t)));var We=He.asDux;const Ye=new be({initial:[]}),Je=G("set_armour_nbr_layers",R());Ye.addMutation(Je,(t=>e=>(e.length>t&&(e=e.slice(0,t)),e.length<t&&(e=[e,W.times(t-e.length,(()=>[]))].flat()),e=pe.map(((t,e)=>l({layer:e+1,rating:0,cost:0,mass:0},t)),e)))),Ye.addMutation(G("set_armour_layer",R()),(({layer:t,rating:e})=>pe.map(pe.if(W.matches({layer:t}),pe({rating:e,cost:2*t*e,mass:2*e})))));var Xe=Ye.asDux;var Ze=new be({initial:{mass:0,cost:0,hull:{rating:1,advanced:!1,cost:2,mass:1}},subduxes:{screens:We,armour:Xe}}).asDux;const Ke=new be({initial:{space:0,cost:0,mass:0}}),Qe=G("set_cargo",R());Ke.addMutation(Qe,(t=>()=>({space:t,cost:0,mass:t})));var ts=Ke.asDux;const es=new be({initial:{type:"none",cost:0,mass:0}}),ss=G("set_streamlining",R());es.addMutation(ss,(t=>pe.update({type:t})));const ns=G("set_streamlining_cost_mass",R());es.addMutation(ns,(t=>pe.update(t)));var as=es.asDux,rs=[{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 cs=new be({initial:{bays:0,cost:0,mass:0,squadrons:[]}}),ls=G("set_squadron",R());cs.addMutation(ls,(({id:t,type:e})=>pe.update({squadrons:pe.map(pe.if(W.matches({id:t}),pe({type:e,cost:6*W.find(rs,{type:e}).cost,mass:6})))})));const os=G("set_carrier_bays",R());cs.addMutation(os,(t=>e=>((e=pe.update({bays:t,mass:9*t,cost:27*t})(e)).squadrons.length>t&&(e=pe.update({squadrons:e=>e.slice(0,t)},e)),e.squadrons.length<t&&(e=pe.update({squadrons:s=>[...s,...W.times(t-e.squadrons.length,(t=>({id:1+t+e.squadrons.length,cost:6*rs[0].cost,mass:6,type:rs[0].type})))]},e)),e)));var is=cs.asDux;const us=G("set_ship_mass",R()),$s=G("set_name",R()),hs=G("set_ship_reqs",R()),fs=G("set_hull",R()),ps=G("set_ship_type",R()),ds=G("reset"),ms={general:{ship_class:"",name:"",ship_type:"",mass:10,used_mass:0,cost:10}};console.log(be);const gs=new be({subduxes:{ftl:Ie,engine:Ae,weaponry:Ue,structure:Ze,cargo:ts,streamlining:as,carrier:is},initial:ms});gs.addMutation(ds,(()=>()=>ms)),gs.addMutation(fs,(({rating:t})=>e=>pe.updateIn("structure.hull",{cost:2*t,rating:t,mass:t})(e))),gs.addMutation(us,(t=>pe.updateIn("general",{mass:t}))),gs.addMutation($s,(t=>pe.updateIn("general",{name:t}))),gs.addMutation(G("set_ship_class",R()),(t=>pe.updateIn("general",{ship_class:t}))),gs.addMutation(hs,(({cost:t,mass:e})=>pe.updateIn("general",{cost:t,used_mass:e}))),gs.addSubscription((t=>Y(Lt,(e=>t.dispatch(hs(e)))))),gs.addSubscription((t=>Y((t=>t.general.mass),(t=>t.streamlining.type),((e,s)=>{const n=Ft(e*("none"===s?0:"partial"===s?5:10)/100),a=2*n;t.dispatch(gs.actions.set_streamlining_cost_mass({cost:a,mass:n}))})))),gs.addSubscription((t=>Y((t=>t.general.mass),(t=>t.general.ship_type),(t=>t.carrier.bays),((e,s,n)=>{console.log({bays:n});const a=ze(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)))})))),gs.addMutation(ps,(t=>pe.updateIn("general.ship_type",t))),gs.addSubscription((t=>Y([t=>t.general.mass,t=>t.ftl.type],((e,s)=>t.dispatch(Ie.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))))))),gs.addSubscription((t=>Y((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,Ft(.05*e)),r=n*Math.max(4,Ft(.075*e));t.dispatch(gs.actions.set_screens_reqs({mass:a+r,cost:3*a+4*r}))})))),gs.addSubscription((t=>Y([t=>t.general.mass,t=>t.engine.rating,t=>t.engine.advanced],((e,s,n)=>t.dispatch(gs.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 vs=G("set_firecons",R());gs.addMutation(vs,(t=>pe.updateIn("weaponry.firecons",l({nbr:t},(t=>({cost:4*t,mass:t}))(t)))));var ys=gs.asDux;let _s=Z;_s=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;function bs(t){let e,s,n,a,r,c;return{c(){e=h("aside"),s=h("pre"),n=h("code"),a=f(t[0]),this.h()},l(r){e=d(r,"ASIDE",{class:!0});var c=m(e);s=d(c,"PRE",{class:!0});var l=m(s);n=d(l,"CODE",{});var o=m(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)&&K(a,t[0])},i(t){c||(Q((()=>{r||(r=tt(e,et,{},!0)),r.run(1)})),c=!0)},o(t){r||(r=tt(e,et,{},!1)),r.run(0),c=!1},d(t){t&&v(e),t&&r&&r.end()}}}function ws(t,e,s){let n,{ship:a={}}=e;return st(),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 xs extends i{constructor(t){super(),u(this,t,ws,bs,$,{ship:1})}}function Es(t){let e,s;return{c(){e=h("div"),s=f(t[0]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(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&&K(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function Is(t,e,s){let{cost:n=0}=e;return t.$$set=t=>{"cost"in t&&s(0,n=t.cost)},[n]}class Os extends i{constructor(t){super(),u(this,t,Is,Es,$,{cost:0})}}function ks(t){let e,s;return{c(){e=h("div"),s=f(t[0]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(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&&K(s,t[0])},i:E,o:E,d(t){t&&v(e)}}}function Ds(t,e,s){let{mass:n=0}=e;return t.$$set=t=>{"mass"in t&&s(0,n=t.mass)},[n]}class As extends i{constructor(t){super(),u(this,t,Ds,ks,$,{mass:0})}}function Ms(t){let e,s,n,a,r,c,l,o,i,u,$,_,E,I,O;return _=new Os({props:{cost:t[2]}}),I=new As({props:{mass:t[3]}}),{c(){e=h("h1"),s=f("ship name: "),n=h("div"),a=p(),r=h("div"),c=h("h2"),l=f(t[0]),o=f("-class, "),i=f(t[1]),u=p(),$=h("div"),nt(_.$$.fragment),E=f("\n  \n "),nt(I.$$.fragment),this.h()},l(h){e=d(h,"H1",{class:!0});var f=m(e);s=g(f,"ship name: "),n=d(f,"DIV",{class:!0}),m(n).forEach(v),f.forEach(v),a=y(h),r=d(h,"DIV",{class:!0});var p=m(r);c=d(p,"H2",{class:!0});var b=m(c);l=g(b,t[0]),o=g(b,"-class, "),i=g(b,t[1]),b.forEach(v),u=y(p),$=d(p,"DIV",{class:!0});var w=m($);at(_.$$.fragment,w),E=g(w,"\n  \n "),at(I.$$.fragment,w),w.forEach(v),p.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,$),rt(_,$,null),x($,E),rt(I,$,null),O=!0},p(t,[e]){(!O||1&e)&&K(l,t[0]),(!O||2&e)&&K(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){O||(ct(_.$$.fragment,t),ct(I.$$.fragment,t),O=!0)},o(t){lt(_.$$.fragment,t),lt(I.$$.fragment,t),O=!1},d(t){t&&v(e),t&&v(a),t&&v(r),ot(_),ot(I)}}}function Ps(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 Ss extends i{constructor(t){super(),u(this,t,Ps,Ms,$,{ship_class:0,ship_type:1,cost:2,mass:3})}}function Ts(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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 js(t){let e,s;return{c(){e=h("div"),s=f(t[1]),this.h()},l(n){e=d(n,"DIV",{class:!0});var a=m(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&&K(s,t[1])},d(t){t&&v(e)}}}function Ns(t){let e,s,n,a,r,c="none"!==t[0]&&Ts(),l=t[1]>0&&js(t);return{c(){e=h("div"),c&&c.c(),s=p(),l&&l.c(),n=p(),a=h("img"),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);c&&c.l(r),s=y(r),l&&l.l(r),n=y(r),a=d(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=Ts(),c.c(),c.m(e,s)):c&&(c.d(1),c=null),t[1]>0?l?l.p(t,a):(l=js(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 Vs(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 qs extends i{constructor(t){super(),u(this,t,Vs,Ns,$,{ftl:0,engine:1})}}function Cs(t,e,s){const n=t.slice();return n[7]=e[s],n[9]=s,n}function Ls(t,e,s){const n=t.slice();return n[10]=e[s],n[12]=s,n}function Fs(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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 Us(t,e){let s,n=e[10]&&Fs();return{key:t,first:null,c(){s=h("div"),n&&n.c(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(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=Fs(),n.c(),n.m(s,null)):n&&(n.d(1),n=null)},d(t){t&&v(s),n&&n.d()}}}function Bs(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=Ls(e,c,o),s=l(t);r.set(s,a[o]=Us(s,t))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=p(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(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=it(a,o,l,1,e,c,r,s,ut,Us,n,Ls))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function zs(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=Cs(t,a,c),l=r(e);n.set(l,s[c]=Bs(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c()},l(t){e=d(t,"DIV",{});var n=m(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=it(s,c,r,1,t,a,n,e,ut,Bs,null,Cs))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Hs(t,e){if(e<=1)return[t];let s=t.length/e;return t.length%e&&s++,[t.slice(0,s),...Hs(t.slice(s),e-1)]}function Gs(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=Ft(c/20)),96&t.$$.dirty&&s(5,a=Hs(a,r).map((t=>(t[t.length-1]=!0,t))).flat()),48&t.$$.dirty&&s(0,i=Hs(a,n))},[i,c,l,o,n,a,r]}class Rs extends i{constructor(t){super(),u(this,t,Gs,zs,$,{ship_mass:1,rating:2,advanced:3})}}function Ws(t,e,s){const n=t.slice();return n[1]=e[s],n}function Ys(t,e,s){const n=t.slice();return n[4]=e[s],n}function Js(t,e){let s;return{key:t,first:null,c(){s=h("div"),this.h()},l(t){s=d(t,"DIV",{class:!0}),m(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 Xs(t,e){let s,n,a=[],r=new Map,c=W.range(e[1].rating);const l=t=>t[4];for(let o=0;o<c.length;o+=1){let t=Ys(e,c,o),s=l(t);r.set(s,a[o]=Js(s))}return{key:t,first:null,c(){s=h("div");for(let t=0;t<a.length;t+=1)a[t].c();n=p(),this.h()},l(t){s=d(t,"DIV",{class:!0});var e=m(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=W.range(e[1].rating),a=it(a,o,l,0,e,c,r,s,ut,Js,n,Ys))},d(t){t&&v(s);for(let e=0;e<a.length;e+=1)a[e].d()}}}function Zs(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=Ws(t,a,c),l=r(e);n.set(l,s[c]=Xs(l,e))}return{c(){e=h("div");for(let t=0;t<s.length;t+=1)s[t].c();this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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=it(s,c,r,1,t,a,n,e,ut,Xs,null,Ws))},i:E,o:E,d(t){t&&v(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Ks(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 Qs extends i{constructor(t){super(),u(this,t,Ks,Zs,$,{armour:0})}}function tn(t){let e,s,n,a,r;return s=new Qs({props:{armour:t[0].armour}}),a=new Rs({props:{rating:t[0].hull.rating,advanced:t[0].hull.advanced,ship_mass:t[1]}}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment)},l(t){e=d(t,"DIV",{});var r=m(e);at(s.$$.fragment,r),n=y(r),at(a.$$.fragment,r),r.forEach(v)},m(t,c){w(t,e,c),rt(s,e,null),x(e,n),rt(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||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),r=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),ot(s),ot(a)}}}function en(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 sn extends i{constructor(t){super(),u(this,t,en,tn,$,{structure:0,ship_mass:1})}}function nn(t){let e,s,n,a;return{c(){e=$t("g"),s=$t("path"),this.h()},l(t){e=d(t,"g",{transform:!0},1);var n=m(e);s=d(n,"path",{d:!0,class:!0},1),m(s).forEach(v),n.forEach(v),this.h()},h(){b(s,"d",t[1]),b(s,"class","svelte-7q6uh5"),ht(s,"active",t[0]),b(e,"transform",t[2])},m(r,c){w(r,e,c),x(e,s),n||(a=ft(s,"click",t[7]),n=!0)},p(t,[n]){2&n&&b(s,"d",t[1]),1&n&&ht(s,"active",t[0]),4&n&&b(e,"transform",t[2])},i:E,o:E,d(t){t&&v(e),n=!1,a()}}}function an(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){pt(t,e)}]}class rn extends i{constructor(t){super(),u(this,t,an,nn,$,{arc:3,radius:4,active:0})}}function cn(t,e,s){const n=t.slice();return n[8]=e[s],n}function ln(t,e){let s,n,a;return n=new rn({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=dt(),nt(n.$$.fragment),this.h()},l(t){s=dt(),at(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),rt(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||(ct(n.$$.fragment,t),a=!0)},o(t){lt(n.$$.fragment,t),a=!1},d(t){t&&v(s),ot(n,t)}}}function on(t){let e,s,n,a,r,c,l=[],o=new Map,i=t[2];const u=t=>t[8];for(let f=0;f<i.length;f+=1){let e=cn(t,i,f),s=u(e);o.set(s,l[f]=ln(s,e))}const $=t[5].default,h=mt($,t,t[4],null);return{c(){e=$t("svg");for(let t=0;t<l.length;t+=1)l[t].c();s=$t("circle"),h&&h.c(),this.h()},l(t){e=d(t,"svg",{width:!0,height:!0},1);var n=m(e);for(let e=0;e<l.length;e+=1)l[e].l(n);s=d(n,"circle",{cx:!0,cy:!0,r:!0,class:!0},1),m(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,[f]){15&f&&(i=t[2],gt(),l=it(l,f,u,1,t,i,o,e,vt,ln,s,cn),yt()),(!c||2&f&&n!==(n=t[1]/3))&&b(s,"r",n),h&&h.p&&(!c||16&f)&&_t(h,$,t,t[4],f,null,null),(!c||2&f&&a!==(a=t[1]+"px"))&&b(e,"width",a),(!c||2&f&&r!==(r=t[1]+"px"))&&b(e,"height",r)},i(t){if(!c){for(let t=0;t<i.length;t+=1)ct(l[t]);ct(h,t),c=!0}},o(t){for(let e=0;e<l.length;e+=1)lt(l[e]);lt(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 un(t,e,s){let{$$slots:n={},$$scope:a}=e;let{selected:r=[]}=e,{size:c=60}=e;const l=st(),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 $n extends i{constructor(t){super(),u(this,t,un,on,$,{selected:0,size:1})}}function hn(t){let e,s;return{c(){e=$t("text"),s=f(t[0]),this.h()},l(n){e=d(n,"text",{x:!0,y:!0,class:!0},1);var a=m(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&&K(s,t[0])},d(t){t&&v(e)}}}function fn(t){let e,s,n;return s=new $n({props:{selected:t[1],size:"40",$$slots:{default:[hn]},$$scope:{ctx:t}}}),{c(){e=h("div"),nt(s.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(e);at(s.$$.fragment,n),n.forEach(v),this.h()},h(){b(e,"class","svelte-1u8rlr5")},m(t,a){w(t,e,a),rt(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||(ct(s.$$.fragment,t),n=!0)},o(t){lt(s.$$.fragment,t),n=!1},d(t){t&&v(e),ot(s)}}}function pn(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 dn extends i{constructor(t){super(),u(this,t,pn,fn,$,{weapon_class:0,arcs:1})}}function mn(t,e,s){const n=t.slice();return n[2]=e[s],n}function gn(t){let e,s;const n=[t[2]];let a={};for(let r=0;r<n.length;r+=1)a=Et(a,n[r]);return e=new dn({props:a}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const a=1&s?bt(n,[wt(t[2])]):{};e.$set(a)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function vn(t){let e,s,n,a=t[0],r=[];for(let l=0;l<a.length;l+=1)r[l]=gn(mn(t,a,l));const c=t=>lt(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=d(t,"DIV",{class:!0});var n=m(e);s=d(n,"DIV",{class:!0});var a=m(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=mn(t,a,n);r[n]?(r[n].p(c,e),ct(r[n],1)):(r[n]=gn(c),r[n].c(),ct(r[n],1),r[n].m(s,null))}for(gt(),n=a.length;n<r.length;n+=1)c(n);yt()}},i(t){if(!n){for(let t=0;t<a.length;t+=1)ct(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)lt(r[e]);n=!1},d(t){t&&v(e),xt(r,t)}}}function yn(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 _n extends i{constructor(t){super(),u(this,t,yn,vn,$,{weapons:1})}}function bn(t,e,s){const n=t.slice();return n[1]=e[s],n}function wn(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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 xn(t){let e,s=_.range(t[0]),n=[];for(let a=0;a<s.length;a+=1)n[a]=wn(bn(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=d(t,"DIV",{class:!0});var s=m(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)bn(t,s,r),n[r]||(n[r]=wn(),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),xt(n,t)}}}function En(t,e,s){let{firecons:n=0}=e;return t.$$set=t=>{"firecons"in t&&s(0,n=t.firecons)},[n]}class In extends i{constructor(t){super(),u(this,t,En,xn,$,{firecons:0})}}function On(t,e,s){const n=t.slice();return n[2]=e[s],n}function kn(t,e,s){const n=t.slice();return n[2]=e[s],n}function Dn(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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 An(t){let e,s;return{c(){e=h("img"),this.h()},l(t){e=d(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 Mn(t){let e,s,n=W.range(t[0]),a=[];for(let l=0;l<n.length;l+=1)a[l]=Dn(kn(t,n,l));let r=W.range(t[1]),c=[];for(let l=0;l<r.length;l+=1)c[l]=An(On(t,r,l));return{c(){e=h("div");for(let t=0;t<a.length;t+=1)a[t].c();s=p();for(let t=0;t<c.length;t+=1)c[t].c();this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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=W.range(t[0]),c=r;c<n.length;c+=1)kn(t,n,c),a[c]||(a[c]=Dn(),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=W.range(t[1]),n=s;n<r.length;n+=1)On(t,r,n),c[n]||(c[n]=An(),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),xt(a,t),xt(c,t)}}}function Pn(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 Sn extends i{constructor(t){super(),u(this,t,Pn,Mn,$,{standard:0,advanced:1})}}function Tn(t){let e,s,n,a,r;s=new In({props:{firecons:t[0]}});const c=[t[1]];let l={};for(let o=0;o<c.length;o+=1)l=Et(l,c[o]);return a=new Sn({props:l}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);at(s.$$.fragment,r),n=y(r),at(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-ytgy37")},m(t,c){w(t,e,c),rt(s,e,null),x(e,n),rt(a,e,null),r=!0},p(t,[e]){const n={};1&e&&(n.firecons=t[0]),s.$set(n);const r=2&e?bt(c,[wt(t[1])]):{};a.$set(r)},i(t){r||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),r=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),ot(s),ot(a)}}}function jn(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 Nn extends i{constructor(t){super(),u(this,t,jn,Tn,$,{firecons:0,screens:1})}}function Vn(t){let e,s,n,a,r,c,l,o,i,u,$,f,g;const _=[t[0].general];let E={};for(let h=0;h<_.length;h+=1)E=Et(E,_[h]);return s=new Ss({props:E}),a=new _n({props:{weapons:t[0].weaponry.weapons}}),l=new sn({props:{structure:t[0].structure,ship_mass:t[0].general.mass}}),i=new Nn({props:{firecons:t[0].weaponry.firecons.nbr,screens:t[0].structure.screens}}),$=new qs({props:{ftl:t[0].ftl.type,engine:t[0].engine.rating}}),{c(){e=h("aside"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment),r=p(),c=h("div"),nt(l.$$.fragment),o=p(),nt(i.$$.fragment),u=p(),nt($.$$.fragment),this.h()},l(t){e=d(t,"ASIDE",{class:!0});var h=m(e);at(s.$$.fragment,h),n=y(h),at(a.$$.fragment,h),r=y(h),c=d(h,"DIV",{class:!0});var f=m(c);at(l.$$.fragment,f),o=y(f),at(i.$$.fragment,f),f.forEach(v),u=y(h),at($.$$.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),rt(s,e,null),x(e,n),rt(a,e,null),x(e,r),x(e,c),rt(l,c,null),x(c,o),rt(i,c,null),x(e,u),rt($,e,null),g=!0},p(t,[e]){const n=1&e?bt(_,[wt(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||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),ct(l.$$.fragment,t),ct(i.$$.fragment,t),ct($.$$.fragment,t),Q((()=>{f||(f=tt(e,et,{},!0)),f.run(1)})),g=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),lt(l.$$.fragment,t),lt(i.$$.fragment,t),lt($.$$.fragment,t),f||(f=tt(e,et,{},!1)),f.run(0),g=!1},d(t){t&&v(e),ot(s),ot(a),ot(l),ot(i),ot($),t&&f&&f.end()}}}function qn(t,e,s){let{ship:n}=e;return t.$$set=t=>{"ship"in t&&s(0,n=t.ship)},[n]}class Cn extends i{constructor(t){super(),u(this,t,qn,Vn,$,{ship:0})}}function Ln(t){let e,s;return{c(){e=h("label"),s=f(t[0]),this.h()},l(n){e=d(n,"LABEL",{class:!0});var a=m(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&&K(s,t[0])},d(t){t&&v(e)}}}function Fn(t){let e,s,n,a=t[0]&&Ln(t);const r=t[4].default,c=mt(r,t,t[3],null),l=c||function(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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=ft(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=p(),l&&l.c(),this.h()},l(t){e=d(t,"DIV",{class:!0});var n=m(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=Ln(t),a.c(),a.m(e,s)):a&&(a.d(1),a=null),c?c.p&&(!n||8&o)&&_t(c,r,t,t[3],o,null,null):l&&l.p&&6&o&&l.p(t,o)},i(t){n||(ct(l,t),n=!0)},o(t){lt(l,t),n=!1},d(t){t&&v(e),a&&a.d(),l&&l.d(t)}}}function Un(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){pt(t,e)}]}class Bn extends i{constructor(t){super(),u(this,t,Un,Fn,$,{label:0,value:1,placeholder:2})}}function zn(t,e,s){const n=t.slice();return n[7]=e[s],n}function Hn(t,e){let s,n,a,r=e[7]+"";return{key:t,first:null,c(){s=h("option"),n=f(r),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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]+"")&&K(n,r),8&c&&a!==(a=e[7])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function Gn(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=zn(t,c,o),s=l(e);r.set(s,a[o]=Hn(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c()},l(t){e=d(t,"SELECT",{value:!0});var s=m(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);kt(e,t[2]),s||(n=ft(e,"change",t[5]),s=!0)},p(t,s){8&s&&(c=t[3],a=it(a,s,l,1,t,c,r,e,ut,Hn,null,zn)),12&s&&kt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function Rn(t){let e,s,n,a,r;return s=new Bn({props:{label:"ship class",value:t[1].ship_class}}),s.$on("change",t[4]),a=new Bn({props:{label:"ship type",$$slots:{default:[Gn]},$$scope:{ctx:t}}}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);at(s.$$.fragment,r),n=y(r),at(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-fc2507")},m(t,c){w(t,e,c),rt(s,e,null),x(e,n),rt(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||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),r=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),ot(s),ot(a)}}}function Wn(t,e,s){let n,a=E,r=()=>(a(),a=Ot(l,(t=>s(6,n=t))),l);t.$$.on_destroy.push((()=>a()));let c,{ship:l=It("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=ze(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 Yn extends i{constructor(t){super(),u(this,t,Wn,Rn,$,{ship:0})}}function Jn(t){let e,s,n=-t[1]+"";return{c(){e=f("excessive mass: "),s=f(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]+"")&&K(s,n)},d(t){t&&v(e),t&&v(s)}}}function Xn(t){let e,s;return{c(){e=f("mass unused: "),s=f(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&&K(s,t[1])},d(t){t&&v(e),t&&v(s)}}}function Zn(t){let e,s,n,a,r,c,l,o;function i(t,e){return t[3]?Xn:Jn}let u=i(t),$=u(t);return{c(){e=h("input"),n=p(),a=h("span"),r=p(),c=h("div"),$.c(),this.h()},l(t){e=d(t,"INPUT",{value:!0,type:!0,min:!0,max:!0,class:!0}),n=y(t),a=d(t,"SPAN",{class:!0}),m(a).forEach(v),r=y(t),c=d(t,"DIV",{class:!0});var s=m(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"),ht(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=ft(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&&ht(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 Kn(t){let e,s,n=t[2].general.cost+"";return{c(){e=h("span"),s=f(n),this.h()},l(t){e=d(t,"SPAN",{class:!0});var a=m(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+"")&&K(s,n)},d(t){t&&v(e)}}}function Qn(t){let e,s,n,a,r,c;return s=new Bn({props:{label:"ship tonnage",$$slots:{default:[Zn]},$$scope:{ctx:t}}}),r=new Bn({props:{label:"cost",$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),a=h("div"),nt(r.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var c=m(e);at(s.$$.fragment,c),c.forEach(v),n=y(t),a=d(t,"DIV",{class:!0});var l=m(a);at(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),rt(s,e,null),w(t,n,l),w(t,a,l),rt(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||(ct(s.$$.fragment,t),ct(r.$$.fragment,t),c=!0)},o(t){lt(s.$$.fragment,t),lt(r.$$.fragment,t),c=!1},d(t){t&&v(e),ot(s),t&&v(n),t&&v(a),ot(r)}}}function ta(t,e,s){let n,a=E,r=()=>(a(),a=Ot(c,(t=>s(2,n=t))),c);t.$$.on_destroy.push((()=>a()));let{ship:c=It("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 ea extends i{constructor(t){super(),u(this,t,ta,Qn,$,{ship:0})}}function sa(t){let e,s,n,a;return e=new Yn({}),n=new ea({}),{c(){nt(e.$$.fragment),s=p(),nt(n.$$.fragment)},l(t){at(e.$$.fragment,t),s=y(t),at(n.$$.fragment,t)},m(t,r){rt(e,t,r),w(t,s,r),rt(n,t,r),a=!0},p:E,i(t){a||(ct(e.$$.fragment,t),ct(n.$$.fragment,t),a=!0)},o(t){lt(e.$$.fragment,t),lt(n.$$.fragment,t),a=!1},d(t){ot(e,t),t&&v(s),ot(n,t)}}}class na extends i{constructor(t){super(),u(this,t,null,sa,$,{})}}function aa(t){let e,s,n,a,r,c,l,o,i,u,$,_,I,O,k,D,A,M,P,S,T,j,N,V,q,C,L,F,U,B,z,H,G;return{c(){e=h("aside"),s=h("div"),n=h("input"),a=p(),r=h("h3"),c=f("welcome to the docks"),l=p(),o=h("p"),i=f("This app is a ship builder for the game\n "),u=h("a"),$=f("Full Thrust"),_=f("\n ."),I=p(),O=h("p"),k=f("The app, beside any exception mentioned here, is trying to follow the\n "),D=h("a"),A=f("Cross Dimensions rules"),M=f("\n as closely as possible."),P=p(),S=h("p"),T=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."),j=p(),N=h("p"),V=f("Written by\n "),q=h("a"),C=f("Yanick Champoux"),L=f("\n . Code available on\n "),F=h("a"),U=f("Github"),this.h()},l(t){e=d(t,"ASIDE",{class:!0});var h=m(e);s=d(h,"DIV",{class:!0});var f=m(s);n=d(f,"INPUT",{type:!0,class:!0,value:!0}),f.forEach(v),a=y(h),r=d(h,"H3",{class:!0});var p=m(r);c=g(p,"welcome to the docks"),p.forEach(v),l=y(h),o=d(h,"P",{});var b=m(o);i=g(b,"This app is a ship builder for the game\n "),u=d(b,"A",{href:!0});var w=m(u);$=g(w,"Full Thrust"),w.forEach(v),_=g(b,"\n ."),b.forEach(v),I=y(h),O=d(h,"P",{});var x=m(O);k=g(x,"The app, beside any exception mentioned here, is trying to follow the\n "),D=d(x,"A",{href:!0});var E=m(D);A=g(E,"Cross Dimensions rules"),E.forEach(v),M=g(x,"\n as closely as possible."),x.forEach(v),P=y(h),S=d(h,"P",{});var B=m(S);T=g(B,"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."),B.forEach(v),j=y(h),N=d(h,"P",{});var z=m(N);V=g(z,"Written by\n "),q=d(z,"A",{href:!0});var H=m(q);C=g(H,"Yanick Champoux"),H.forEach(v),L=g(z,"\n . Code available on\n "),F=d(z,"A",{href:!0});var G=m(F);U=g(G,"Github"),G.forEach(v),z.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(D,"href","http://members.ozemail.com.au/~laranzu/fullthrust/rules/"),b(q,"href","https://twitter.com/yenzie"),b(F,"href","https://github.com/yanick/aotds-shipyard"),b(e,"class","svelte-16mfw8u")},m(h,f){w(h,e,f),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,O),x(O,k),x(O,D),x(D,A),x(O,M),x(e,P),x(e,S),x(S,T),x(e,j),x(e,N),x(N,V),x(N,q),x(q,C),x(N,L),x(N,F),x(F,U),z=!0,H||(G=ft(n,"click",t[0]),H=!0)},p:E,i(t){z||(Q((()=>{B||(B=tt(e,Dt,{x:-800,opacity:1},!0)),B.run(1)})),z=!0)},o(t){B||(B=tt(e,Dt,{x:-800,opacity:1},!1)),B.run(0),z=!1},d(t){t&&v(e),t&&B&&B.end(),H=!1,G()}}}function ra(t){const e=st();return[()=>e("close")]}class ca extends i{constructor(t){super(),u(this,t,ra,aa,$,{})}}function la(t){let e,s,n,a,r,c,l,o;const i=t[5].default,u=mt(i,t,t[4],null);return{c(){e=h("div"),u&&u.c(),s=p(),n=h("div"),a=f(t[0]),r=p(),c=h("div"),l=f(t[1]),this.h()},l(o){e=d(o,"DIV",{class:!0});var i=m(e);u&&u.l(i),i.forEach(v),s=y(o),n=d(o,"DIV",{class:!0});var $=m(n);a=g($,t[0]),$.forEach(v),r=y(o),c=d(o,"DIV",{class:!0});var h=m(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)&&_t(u,i,t,t[4],e,null,null),(!o||1&e)&&K(a,t[0]),(!o||2&e)&&K(l,t[1])},i(t){o||(ct(u,t),o=!0)},o(t){lt(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 oa(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){At[t?"unshift":"push"]((()=>{n=t,s(2,n)}))},function(t){At[t?"unshift":"push"]((()=>{a=t,s(3,a)}))}]}class ia extends i{constructor(t){super(),u(this,t,oa,la,$,{mass:0,cost:1})}}function ua(t){let e,s,n,a,r,c,l;const o=t[2].default,i=mt(o,t,t[1],null);return{c(){e=h("div"),s=h("h2"),n=f(t[0]),a=p(),r=h("hr"),c=p(),i&&i.c(),this.h()},l(l){e=d(l,"DIV",{class:!0});var o=m(e);s=d(o,"H2",{});var u=m(s);n=g(u,t[0]),u.forEach(v),a=y(o),r=d(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)&&K(n,t[0]),i&&i.p&&(!l||2&e)&&_t(i,o,t,t[1],e,null,null)},i(t){l||(ct(i,t),l=!0)},o(t){lt(i,t),l=!1},d(t){t&&v(e),t&&v(c),i&&i.d(t)}}}function $a(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 ha extends i{constructor(t){super(),u(this,t,$a,ua,$,{label:0})}}function fa(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[0]),s||(n=ft(e,"input",t[4]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function pa(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[1]),s||(n=ft(e,"input",t[5]),s=!0)},p(t,s){2&s&&Mt(e.value)!==t[1]&&Pt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function da(t){let e,s,n,a,r;return s=new Bn({props:{label:"screens",$$slots:{default:[fa]},$$scope:{ctx:t}}}),a=new Bn({props:{label:"advanced screens",$$slots:{default:[pa]},$$scope:{ctx:t}}}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);at(s.$$.fragment,r),n=y(r),at(a.$$.fragment,r),r.forEach(v),this.h()},h(){b(e,"class","svelte-11x6jvv")},m(t,c){w(t,e,c),rt(s,e,null),x(e,n),rt(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||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),r=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),ot(s),ot(a)}}}function ma(t){let e,s;return e=new ia({props:{cost:t[2],mass:t[3],$$slots:{default:[da]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function ga(t,e,s){let{cost:n=0}=e,{mass:a=0}=e,{standard:r=0}=e,{advanced:c=0}=e;const l=st();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=Mt(this.value),s(0,r)},function(){c=Mt(this.value),s(1,c)}]}class va extends i{constructor(t){super(),u(this,t,ga,ma,$,{cost:2,mass:3,standard:0,advanced:1})}}function ya(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[0]),s||(n=ft(e,"input",t[2]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function _a(t){let e,s;return e=new Bn({props:{label:`layer ${t[1]}`,$$slots:{default:[ya]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function ba(t,e,s){let{layer:n=1}=e,{rating:a=0}=e;const r=st();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",Xe.actions.set_armour_layer({layer:n,rating:a}))},[a,n,function(){a=Mt(this.value),s(0,a)}]}class wa extends i{constructor(t){super(),u(this,t,ba,_a,$,{layer:1,rating:0})}}function xa(t,e,s){const n=t.slice();return n[7]=e[s],n}function Ea(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[3]),s||(n=ft(e,"input",t[4]),s=!0)},p(t,s){8&s&&Mt(e.value)!==t[3]&&Pt(e,t[3])},d(t){t&&v(e),s=!1,n()}}}function Ia(t,e){let s,n,a;const r=[e[7]];let c={};for(let l=0;l<r.length;l+=1)c=Et(c,r[l]);return n=new wa({props:c}),n.$on("ship_change",e[5]),{key:t,first:null,c(){s=dt(),nt(n.$$.fragment),this.h()},l(t){s=dt(),at(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),rt(n,t,e),a=!0},p(t,s){e=t;const a=4&s?bt(r,[wt(e[7])]):{};n.$set(a)},i(t){a||(ct(n.$$.fragment,t),a=!0)},o(t){lt(n.$$.fragment,t),a=!1},d(t){t&&v(s),ot(n,t)}}}function Oa(t){let e,s,n,a,r,c,l=[],o=new Map;n=new Bn({props:{label:"armour layers",$$slots:{default:[Ea]},$$scope:{ctx:t}}});let i=t[2];const u=t=>t[7].layer;for(let $=0;$<i.length;$+=1){let e=xa(t,i,$),s=u(e);o.set(s,l[$]=Ia(s,e))}return{c(){e=h("div"),s=h("div"),nt(n.$$.fragment),a=p(),r=h("div");for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=d(t,"DIV",{});var c=m(e);s=d(c,"DIV",{class:!0});var o=m(s);at(n.$$.fragment,o),o.forEach(v),a=y(c),r=d(c,"DIV",{class:!0});var i=m(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),rt(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],gt(),l=it(l,e,u,1,t,i,o,r,vt,Ia,null,xa),yt())},i(t){if(!c){ct(n.$$.fragment,t);for(let t=0;t<i.length;t+=1)ct(l[t]);c=!0}},o(t){lt(n.$$.fragment,t);for(let e=0;e<l.length;e+=1)lt(l[e]);c=!1},d(t){t&&v(e),ot(n);for(let e=0;e<l.length;e+=1)l[e].d()}}}function ka(t){let e,s;return e=new ia({props:{cost:t[0],mass:t[1],$$slots:{default:[Oa]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Da(t,e,s){let{armour:n=[]}=e,{cost:a=0}=e,{mass:r=0}=e,c=n.length;const l=st();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=W.sum(W.map(n,"cost"))),4&t.$$.dirty&&s(1,r=W.sum(W.map(n,"mass"))),8&t.$$.dirty&&l("ship_change",Xe.actions.set_armour_nbr_layers(c))},[a,r,n,c,function(){c=Mt(this.value),s(3,c)},function(e){pt(t,e)}]}class Aa extends i{constructor(t){super(),u(this,t,Da,ka,$,{armour:2,cost:0,mass:1})}}function Ma(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[0]),s||(n=ft(e,"input",t[3]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Pa(t){let e,s;return e=new Bn({props:{label:"cargo",$$slots:{default:[Ma]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};65&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Sa(t){let e,s;return e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Pa]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ta(t,e,s){It("ship");let{space:n=0}=e,{cost:a=0}=e,{mass:r=0}=e;const c=st();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",ts.actions.set_cargo(n))},[n,a,r,function(){n=Mt(this.value),s(0,n)}]}class ja extends i{constructor(t){super(),u(this,t,Ta,Sa,$,{space:0,cost:1,mass:2})}}function Na(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=f("\n none"),r=p(),c=h("label"),l=h("input"),o=f("\n partial"),i=p(),u=h("label"),$=h("input"),_=f("\n full"),this.h()},l(t){e=d(t,"DIV",{class:!0});var h=m(e);s=d(h,"LABEL",{class:!0});var f=m(s);n=d(f,"INPUT",{type:!0,value:!0}),a=g(f,"\n none"),f.forEach(v),r=y(h),c=d(h,"LABEL",{class:!0});var p=m(c);l=d(p,"INPUT",{type:!0,value:!0}),o=g(p,"\n partial"),p.forEach(v),i=y(h),u=d(h,"LABEL",{class:!0});var b=m(u);$=d(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,f){w(h,e,f),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=[ft(n,"change",t[4]),ft(l,"change",t[6]),ft($,"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,St(I)}}}function Va(t){let e,s;return e=new Bn({props:{label:"streamlining",$$slots:{default:[Na]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};257&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function qa(t){let e,s;return e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Va]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ca(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=It("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(as.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 La extends i{constructor(t){super(),u(this,t,Ca,qa,$,{type:0,cost:1,mass:2,ship_change:3})}}function Fa(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[0]),s||(n=ft(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&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Ua(t){let e,s;return e=new Bn({props:{label:"integrity",$$slots:{default:[Fa]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};33153&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ba(t){let e,s,n,a,r,c,l,o,i,u;e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Ua]},$$scope:{ctx:t}}});const $=[t[3]];let h={};for(let p=0;p<$.length;p+=1)h=Et(h,$[p]);n=new va({props:h}),n.$on("set_screens",t[11]),r=new Aa({props:{armour:t[4]}}),r.$on("ship_change",t[12]);const f=[t[5]];let d={};for(let p=0;p<f.length;p+=1)d=Et(d,f[p]);l=new ja({props:d}),l.$on("set_cargo",t[13]);const m=[t[6]];let g={};for(let p=0;p<m.length;p+=1)g=Et(g,m[p]);return i=new La({props:g}),{c(){nt(e.$$.fragment),s=p(),nt(n.$$.fragment),a=p(),nt(r.$$.fragment),c=p(),nt(l.$$.fragment),o=p(),nt(i.$$.fragment)},l(t){at(e.$$.fragment,t),s=y(t),at(n.$$.fragment,t),a=y(t),at(r.$$.fragment,t),c=y(t),at(l.$$.fragment,t),o=y(t),at(i.$$.fragment,t)},m(t,$){rt(e,t,$),w(t,s,$),rt(n,t,$),w(t,a,$),rt(r,t,$),w(t,c,$),rt(l,t,$),w(t,o,$),rt(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?bt($,[wt(t[3])]):{};n.$set(c);const o={};16&s&&(o.armour=t[4]),r.$set(o);const u=32&s?bt(f,[wt(t[5])]):{};l.$set(u);const h=64&s?bt(m,[wt(t[6])]):{};i.$set(h)},i(t){u||(ct(e.$$.fragment,t),ct(n.$$.fragment,t),ct(r.$$.fragment,t),ct(l.$$.fragment,t),ct(i.$$.fragment,t),u=!0)},o(t){lt(e.$$.fragment,t),lt(n.$$.fragment,t),lt(r.$$.fragment,t),lt(l.$$.fragment,t),lt(i.$$.fragment,t),u=!1},d(t){ot(e,t),t&&v(s),ot(n,t),t&&v(a),ot(r,t),t&&v(c),ot(l,t),t&&v(o),ot(i,t)}}}function za(t){let e,s;return e=new ha({props:{label:"hull",$$slots:{default:[Ba]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,[s]){const n={};33279&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ha(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 f=st();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&&f("change_hull",{rating:o})},[o,r,c,i,u,$,h,n,a,l,function(){o=Mt(this.value),s(0,o)},function(e){pt(t,e)},function(e){pt(t,e)},function(e){pt(t,e)}]}class Ga extends i{constructor(t){super(),u(this,t,Ha,za,$,{cost:1,mass:2,ship_mass:9,rating:0,screens:3,armour:4,cargo:5,streamlining:6})}}function Ra(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){w(a,e,r),Pt(e,t[0]),s||(n=ft(e,"input",t[3]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Wa(t){let e,s;return e=new Bn({props:{label:"firecons",$$slots:{default:[Ra]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ya(t){let e,s;return e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Wa]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Ja(t,e,s){let{nbr:n}=e,{cost:a}=e,{mass:r=0}=e;const c=st();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=Mt(this.value),s(0,n)}]}class Xa extends i{constructor(t){super(),u(this,t,Ja,Ya,$,{nbr:0,cost:1,mass:2})}}function Za(t,e,s){const n=t.slice();return n[8]=e[s],n}function Ka(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=p(),r=f(i),c=p(),this.h()},l(t){s=d(t,"LABEL",{class:!0});var e=m(s);n=d(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=[ft(n,"change",e[5]),ft(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,St(o)}}}function Qa(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=Za(t,a,c),l=r(e);n.set(l,s[c]=Ka(l,e))}return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=dt()},l(t){for(let e=0;e<s.length;e+=1)s[e].l(t);e=dt()},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=it(s,c,r,1,t,a,n,e.parentNode,ut,Ka,e,Za))},d(t){for(let e=0;e<s.length;e+=1)s[e].d(t);t&&v(e)}}}function tr(t){let e,s;return e=new Bn({props:{label:"FTL drive",$$slots:{default:[Qa]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};2049&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function er(t){let e,s;return e=new ia({props:{mass:t[2],cost:t[1],$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function sr(t,e,s){let{type:n="none"}=e,{cost:a=0}=e,{mass:r=0}=e;const c=st();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 nr extends i{constructor(t){super(),u(this,t,sr,er,$,{type:0,cost:1,mass:2})}}function ar(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(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),Pt(e,t[1]),s||(n=ft(e,"input",t[4]),s=!0)},p(t,s){2&s&&Mt(e.value)!==t[1]&&Pt(e,t[1])},d(t){t&&v(e),s=!1,n()}}}function rr(t){let e,s,n,a,r,c,l,o,i;return s=new Bn({props:{label:"thrust rating",$$slots:{default:[ar]},$$scope:{ctx:t}}}),{c(){e=h("div"),nt(s.$$.fragment),n=p(),a=h("label"),r=h("input"),c=f(" advanced"),this.h()},l(t){e=d(t,"DIV",{class:!0});var l=m(e);at(s.$$.fragment,l),n=y(l),a=d(l,"LABEL",{class:!0});var o=m(a);r=d(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,$),rt(s,e,null),x(e,n),x(e,a),x(a,r),r.checked=t[0],x(a,c),l=!0,o||(i=ft(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||(ct(s.$$.fragment,t),l=!0)},o(t){lt(s.$$.fragment,t),l=!1},d(t){t&&v(e),ot(s),o=!1,i()}}}function cr(t){let e,s;return e=new ia({props:{cost:t[2],mass:t[3],$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function lr(t,e,s){let{cost:n}=e,{mass:a}=e,{advanced:r=!1}=e,{rating:c=0}=e;const l=st();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=Mt(this.value),s(1,c)},function(){r=this.checked,s(0,r)}]}class or extends i{constructor(t){super(),u(this,t,lr,cr,$,{cost:2,mass:3,advanced:0,rating:1})}}function ir(t){let e,s,n,a;const r=[t[1]];let c={};for(let i=0;i<r.length;i+=1)c=Et(c,r[i]);e=new or({props:c}),e.$on("change_engine",t[2]);const l=[t[0]];let o={};for(let i=0;i<l.length;i+=1)o=Et(o,l[i]);return n=new nr({props:o}),n.$on("change_ftl",t[3]),{c(){nt(e.$$.fragment),s=p(),nt(n.$$.fragment)},l(t){at(e.$$.fragment,t),s=y(t),at(n.$$.fragment,t)},m(t,r){rt(e,t,r),w(t,s,r),rt(n,t,r),a=!0},p(t,s){const a=2&s?bt(r,[wt(t[1])]):{};e.$set(a);const c=1&s?bt(l,[wt(t[0])]):{};n.$set(c)},i(t){a||(ct(e.$$.fragment,t),ct(n.$$.fragment,t),a=!0)},o(t){lt(e.$$.fragment,t),lt(n.$$.fragment,t),a=!1},d(t){ot(e,t),t&&v(s),ot(n,t)}}}function ur(t){let e,s;return e=new ha({props:{label:"propulsion",$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,[s]){const n={};19&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function $r(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){pt(t,e)},function(e){pt(t,e)}]}class hr extends i{constructor(t){super(),u(this,t,$r,ur,$,{ftl:0,engine:1})}}function fr(t,e,s){const n=t.slice();return n[2]=e[s],n}function pr(t){let e,s,n,a,r,c,l,o,i,u,$;return{c(){e=h("select"),s=h("option"),n=f("1"),a=h("option"),r=f("2"),c=h("option"),l=f("3"),o=h("option"),i=f("4"),this.h()},l(t){e=d(t,"SELECT",{});var u=m(e);s=d(u,"OPTION",{value:!0});var $=m(s);n=g($,"1"),$.forEach(v),a=d(u,"OPTION",{value:!0});var h=m(a);r=g(h,"2"),h.forEach(v),c=d(u,"OPTION",{value:!0});var f=m(c);l=g(f,"3"),f.forEach(v),o=d(u,"OPTION",{value:!0});var p=m(o);i=g(p,"4"),p.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]&&Q((()=>t[10].call(e)))},m(h,f){w(h,e,f),x(e,s),x(s,n),x(e,a),x(a,r),x(e,c),x(c,l),x(e,o),x(o,i),kt(e,t[0]),u||($=ft(e,"change",t[10]),u=!0)},p(t,s){1&s&&kt(e,t[0])},d(t){t&&v(e),u=!1,$()}}}function dr(t,e){let s,n,a,r=e[2]+"";return{key:t,first:null,c(){s=h("option"),n=f(r),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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]+"")&&K(n,r),1&c&&a!==(a=e[2])&&(s.__value=a,s.value=s.__value)},d(t){t&&v(s)}}}function mr(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=fr(t,c,o),s=l(e);r.set(s,a[o]=dr(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=d(t,"SELECT",{});var s=m(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[2]&&Q((()=>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);kt(e,t[2]),s||(n=ft(e,"change",t[11]),s=!0)},p(t,s){9&s&&(c=t[3][t[0]]||[],a=it(a,s,l,1,t,c,r,e,ut,dr,null,fr)),13&s&&kt(e,t[2])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function gr(t){let e,s,n,a,r,c,l,o,i;return a=new Bn({props:{label:"beam class",$$slots:{default:[pr]},$$scope:{ctx:t}}}),c=new Bn({props:{label:"arcs",$$slots:{default:[mr]},$$scope:{ctx:t}}}),o=new $n({props:{selected:t[1]}}),o.$on("click_arc",t[12]),{c(){e=h("label"),s=f("beam"),n=p(),nt(a.$$.fragment),r=p(),nt(c.$$.fragment),l=p(),nt(o.$$.fragment)},l(t){e=d(t,"LABEL",{});var i=m(e);s=g(i,"beam"),i.forEach(v),n=y(t),at(a.$$.fragment,t),r=y(t),at(c.$$.fragment,t),l=y(t),at(o.$$.fragment,t)},m(t,u){w(t,e,u),x(e,s),w(t,n,u),rt(a,t,u),w(t,r,u),rt(c,t,u),w(t,l,u),rt(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||(ct(a.$$.fragment,t),ct(c.$$.fragment,t),ct(o.$$.fragment,t),i=!0)},o(t){lt(a.$$.fragment,t),lt(c.$$.fragment,t),lt(o.$$.fragment,t),i=!1},d(t){t&&v(e),t&&v(n),ot(a,t),t&&v(r),ot(c,t),t&&v(l),ot(o,t)}}}function vr(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=It("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=[];W.range(u).forEach((t=>{a.push(n[e]),e=(e+1)%n.length})),s(1,l=a)};let h=1,f="";const p=st();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=[];W.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,f=l.join(":")),513&t.$$.dirty&&p("change",{weapon_class:c,arcs:f.split(":")})},[c,l,u,i,$,a,r,o,h,f,function(){c=Tt(this),s(0,c)},function(){u=Tt(this),s(2,u),s(3,i),s(0,c),s(3,i),s(0,c)},({detail:t})=>$(t)]}class yr extends i{constructor(t){super(),u(this,t,vr,gr,$,{weapon_type:5,id:6,weapon_class:0,arcs:1,ship_change:7})}}function _r(t){let e,s,n,a,r;return a=new $n({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=f("submunition pack"),n=p(),nt(a.$$.fragment)},l(t){e=d(t,"LABEL",{});var r=m(e);s=g(r,"submunition pack"),r.forEach(v),n=y(t),at(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),rt(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(ct(a.$$.fragment,t),r=!0)},o(t){lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),ot(a,t)}}}function br(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=It("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=st();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 wr extends i{constructor(t){super(),u(this,t,br,_r,$,{arcs:0,ship_change:2})}}function xr(t){let e,s;return{c(){e=h("label"),s=f("point defence system")},l(t){e=d(t,"LABEL",{});var n=m(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 Er extends i{constructor(t){super(),u(this,t,null,xr,$,{})}}function Ir(t){let e,s;return{c(){e=h("label"),s=f("scattergun")},l(t){e=d(t,"LABEL",{});var n=m(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 Or extends i{constructor(t){super(),u(this,t,null,Ir,$,{})}}function kr(t){let e,s,n,a,r;return a=new $n({props:{selected:t[0]}}),a.$on("click_arc",t[4]),{c(){e=h("label"),s=f("needle weapon"),n=p(),nt(a.$$.fragment)},l(t){e=d(t,"LABEL",{});var r=m(e);s=g(r,"needle weapon"),r.forEach(v),n=y(t),at(a.$$.fragment,t)},m(t,c){w(t,e,c),x(e,s),w(t,n,c),rt(a,t,c),r=!0},p(t,[e]){const s={};1&e&&(s.selected=t[0]),a.$set(s)},i(t){r||(ct(a.$$.fragment,t),r=!0)},o(t){lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),t&&v(n),ot(a,t)}}}function Dr(t,e,s){let{arcs:n=["F"]}=e,{ship_change:a=It("ship_change")||(()=>{})}=e;const r=t=>{n[0]!==t&&s(0,n=[t])},c=st();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 Ar extends i{constructor(t){super(),u(this,t,Dr,kr,$,{arcs:0,ship_change:2})}}function Mr(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=Et(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=p(),a&&nt(a.$$.fragment),this.h()},l(t){e=d(t,"DIV",{class:!0});var r=m(e);s=d(r,"INPUT",{type:!0,class:!0,value:!0}),n=y(r),a&&at(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&&rt(a,e,null),r=!0,c||(l=ft(s,"click",t[5]),c=!0)},p(t,s){const n=1&s?bt(o,[wt(t[0])]):{};if(i!==(i=t[3][t[4]])){if(a){gt();const t=a;lt(t.$$.fragment,1,0,(()=>{ot(t,1)})),yt()}i?(a=new i(u()),a.$on("change",t[6]),nt(a.$$.fragment),ct(a.$$.fragment,1),rt(a,e,null)):a=null}else i&&a.$set(n)},i(t){r||(a&&ct(a.$$.fragment,t),r=!0)},o(t){a&&lt(a.$$.fragment,t),r=!1},d(t){t&&v(e),a&&ot(a),c=!1,l()}}}function Pr(t){let e,s;return e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Mr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Sr(t,e,s){const n={beam:yr,submunition:wr,pds:Er,scattergun:Or,needle:Ar};let{weapon:a={}}=e,{id:r}=e,{cost:c}=e,{mass:o}=e,{ship_change:i=It("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(ys.actions.remove_weapon(r)),({detail:t})=>{i(ys.actions.set_weapon(l({id:r,weapon_type:u},t)))},r,i]}class Tr extends i{constructor(t){super(),u(this,t,Sr,Pr,$,{weapon:0,id:7,cost:1,mass:2,ship_change:8})}}function jr(t,e,s){const n=t.slice();return n[0]=e[s],n}function Nr(t,e){let s,n,a=e[0]+"";return{key:t,first:null,c(){s=h("option"),n=f(a),this.h()},l(t){s=d(t,"OPTION",{value:!0});var e=m(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 Vr(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=jr(t,c,o),s=l(e);r.set(s,a[o]=Nr(s,e))}return{c(){e=h("select");for(let t=0;t<a.length;t+=1)a[t].c();this.h()},l(t){e=d(t,"SELECT",{});var s=m(e);for(let e=0;e<a.length;e+=1)a[e].l(s);s.forEach(v),this.h()},h(){void 0===t[0]&&Q((()=>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);kt(e,t[0]),s||(n=ft(e,"change",t[7]),s=!0)},p(t,s){16&s&&(c=t[4],a=it(a,s,l,1,t,c,r,e,ut,Nr,null,jr)),17&s&&kt(e,t[0])},d(t){t&&v(e);for(let e=0;e<a.length;e+=1)a[e].d();s=!1,n()}}}function qr(t){let e,s;return e=new Bn({props:{label:`squadron ${t[1]}`,$$slots:{default:[Vr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Cr(t){let e,s;return e=new ia({props:{cost:t[2],mass:t[3],$$slots:{default:[qr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Lr(t,e,s){const n=rs.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=It("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(is.actions.set_squadron({id:a,type:r}))},[r,a,l,o,n,c,i,function(){r=Tt(this),s(0,r),s(4,n)}]}class Fr extends i{constructor(t){super(),u(this,t,Lr,Cr,$,{id:1,type:0,ftl:5,cost:2,mass:3,ship_change:6})}}function Ur(t,e,s){const n=t.slice();return n[6]=e[s],n}function Br(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,min:!0}),this.h()},h(){b(e,"type","number"),b(e,"min","0")},m(a,r){w(a,e,r),Pt(e,t[0]),s||(n=ft(e,"input",t[5]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function zr(t){let e,s;return e=new Bn({props:{label:"bays",$$slots:{default:[Br]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};513&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Hr(t,e){let s,n,a;const r=[e[6]];let c={};for(let l=0;l<r.length;l+=1)c=Et(c,r[l]);return n=new Fr({props:c}),{key:t,first:null,c(){s=dt(),nt(n.$$.fragment),this.h()},l(t){s=dt(),at(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),rt(n,t,e),a=!0},p(t,s){e=t;const a=2&s?bt(r,[wt(e[6])]):{};n.$set(a)},i(t){a||(ct(n.$$.fragment,t),a=!0)},o(t){lt(n.$$.fragment,t),a=!1},d(t){t&&v(s),ot(n,t)}}}function Gr(t){let e,s,n,a,r=[],c=new Map;e=new ia({props:{cost:t[2],mass:t[3],$$slots:{default:[zr]},$$scope:{ctx:t}}});let l=t[1];const o=t=>t[6].id;for(let i=0;i<l.length;i+=1){let e=Ur(t,l,i),s=o(e);c.set(s,r[i]=Hr(s,e))}return{c(){nt(e.$$.fragment),s=p();for(let t=0;t<r.length;t+=1)r[t].c();n=dt()},l(t){at(e.$$.fragment,t),s=y(t);for(let e=0;e<r.length;e+=1)r[e].l(t);n=dt()},m(t,c){rt(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],gt(),r=it(r,s,o,1,t,l,c,n.parentNode,vt,Hr,n,Ur),yt())},i(t){if(!a){ct(e.$$.fragment,t);for(let t=0;t<l.length;t+=1)ct(r[t]);a=!0}},o(t){lt(e.$$.fragment,t);for(let e=0;e<r.length;e+=1)lt(r[e]);a=!1},d(t){ot(e,t),t&&v(s);for(let e=0;e<r.length;e+=1)r[e].d(t);t&&v(n)}}}function Rr(t){let e,s;return e=new ha({props:{label:"carrier",$$slots:{default:[Gr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,[s]){const n={};527&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Wr(t,e,s){let{bays:n=0}=e,{squadrons:a=[]}=e,{cost:r=0}=e,{mass:c=0}=e,{ship_change:l=It("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(is.actions.set_carrier_bays(n))},[n,a,r,c,l,function(){n=Mt(this.value),s(0,n)}]}class Yr extends i{constructor(t){super(),u(this,t,Wr,Rr,$,{bays:0,squadrons:1,cost:2,mass:3,ship_change:4})}}function Jr(t){let e,s,n;return{c(){e=h("input"),this.h()},l(t){e=d(t,"INPUT",{type:!0,class:!0}),this.h()},h(){b(e,"type","number"),b(e,"class","short")},m(a,r){w(a,e,r),Pt(e,t[0]),s||(n=ft(e,"input",t[4]),s=!0)},p(t,s){1&s&&Mt(e.value)!==t[0]&&Pt(e,t[0])},d(t){t&&v(e),s=!1,n()}}}function Xr(t){let e,s;return e=new Bn({props:{label:"ADFC",$$slots:{default:[Jr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};33&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Zr(t){let e,s;return e=new ia({props:{cost:t[1],mass:t[2],$$slots:{default:[Xr]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(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||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function Kr(t,e,s){let{rating:n=0}=e,{cost:a=0}=e,{mass:r=0}=e,{ship_change:c=It("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(ys.actions.set_adfc(n))},[n,a,r,c,function(){n=Mt(this.value),s(0,n)}]}class Qr extends i{constructor(t){super(),u(this,t,Kr,Zr,$,{rating:0,cost:1,mass:2,ship_change:3})}}function tc(t){let e,s,n,a,r,c,l,o,i,u,$,_,E,I,O;return{c(){e=h("select"),s=h("option"),n=f("beam"),a=h("option"),r=f("submunition pack"),c=h("option"),l=f("point defence system"),o=h("option"),i=f("scattergun"),u=h("option"),$=f("needle weapon"),_=p(),E=h("input"),this.h()},l(t){e=d(t,"SELECT",{});var h=m(e);s=d(h,"OPTION",{value:!0});var f=m(s);n=g(f,"beam"),f.forEach(v),a=d(h,"OPTION",{value:!0});var p=m(a);r=g(p,"submunition pack"),p.forEach(v),c=d(h,"OPTION",{value:!0});var b=m(c);l=g(b,"point defence system"),b.forEach(v),o=d(h,"OPTION",{value:!0});var w=m(o);i=g(w,"scattergun"),w.forEach(v),u=d(h,"OPTION",{value:!0});var x=m(u);$=g(x,"needle weapon"),x.forEach(v),h.forEach(v),_=y(t),E=d(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]&&Q((()=>t[3].call(e))),b(E,"type","button"),E.value="add weapon",b(E,"class","button small blue")},m(h,f){w(h,e,f),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,$),kt(e,t[0]),w(h,_,f),w(h,E,f),I||(O=[ft(e,"change",t[3]),ft(E,"click",t[1])],I=!0)},p(t,s){1&s&&kt(e,t[0])},d(t){t&&v(e),t&&v(_),t&&v(E),I=!1,St(O)}}}function ec(t){let e,s;return e=new Bn({props:{label:"weapon type",$$slots:{default:[tc]},$$scope:{ctx:t}}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,[s]){const n={};17&s&&(n.$$scope={dirty:s,ctx:t}),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function sc(t,e,s){let{weapon_type:n="beam"}=e,{ship_change:a=It("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(ys.actions.add_weapon(n)),a,function(){n=Tt(this),s(0,n)}]}class nc extends i{constructor(t){super(),u(this,t,sc,ec,$,{weapon_type:0,ship_change:2})}}function ac(t,e,s){const n=t.slice();return n[23]=e[s],n}function rc(t){let e,s;return e=new ca({props:{show:t[2]}}),e.$on("close",t[12]),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};4&s&&(n.show=t[2]),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function cc(t){let e,s,n,a,r,c,l,o,i,u,$,_,E,I,O,k,D,A,M;s=new na({}),a=new hr({props:{ftl:t[1].ftl,engine:t[1].engine}}),a.$on("change_ftl",t[5]),a.$on("change_engine",t[6]);const P=[{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 S={};for(let h=0;h<P.length;h+=1)S=Et(S,P[h]);c=new Ga({props:S}),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 ha({props:{label:"weaponry",$$slots:{default:[uc]},$$scope:{ctx:t}}});const T=[t[1].carrier];let j={};for(let h=0;h<T.length;h+=1)j=Et(j,T[h]);return u=new Yr({props:j}),{c(){e=h("main"),nt(s.$$.fragment),n=p(),nt(a.$$.fragment),r=p(),nt(c.$$.fragment),l=p(),nt(o.$$.fragment),i=p(),nt(u.$$.fragment),$=p(),_=h("footer"),E=f("Written by "),I=h("a"),O=f("Yanick Champoux"),k=f(".\n Code available on "),D=h("a"),A=f("Github"),this.h()},l(t){e=d(t,"MAIN",{class:!0});var h=m(e);at(s.$$.fragment,h),n=y(h),at(a.$$.fragment,h),r=y(h),at(c.$$.fragment,h),l=y(h),at(o.$$.fragment,h),i=y(h),at(u.$$.fragment,h),h.forEach(v),$=y(t),_=d(t,"FOOTER",{class:!0});var f=m(_);E=g(f,"Written by "),I=d(f,"A",{href:!0});var p=m(I);O=g(p,"Yanick Champoux"),p.forEach(v),k=g(f,".\n Code available on "),D=d(f,"A",{href:!0});var b=m(D);A=g(b,"Github"),b.forEach(v),f.forEach(v),this.h()},h(){b(e,"class","svelte-4zjur4"),b(I,"href","https://twitter.com/yenzie"),b(D,"href","https://github.com/yanick/aotds-shipyard"),b(_,"class","svelte-4zjur4")},m(t,h){w(t,e,h),rt(s,e,null),x(e,n),rt(a,e,null),x(e,r),rt(c,e,null),x(e,l),rt(o,e,null),x(e,i),rt(u,e,null),w(t,$,h),w(t,_,h),x(_,E),x(_,I),x(I,O),x(_,k),x(_,D),x(D,A),M=!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?bt(P,[{ship_mass:t[1].general.mass},wt(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?bt(T,[wt(t[1].carrier)]):{};u.$set(l)},i(t){M||(ct(s.$$.fragment,t),ct(a.$$.fragment,t),ct(c.$$.fragment,t),ct(o.$$.fragment,t),ct(u.$$.fragment,t),M=!0)},o(t){lt(s.$$.fragment,t),lt(a.$$.fragment,t),lt(c.$$.fragment,t),lt(o.$$.fragment,t),lt(u.$$.fragment,t),M=!1},d(t){t&&v(e),ot(s),ot(a),ot(c),ot(o),ot(u),t&&v($),t&&v(_)}}}function lc(t){let e,s;return e=new Cn({props:{ship:t[1]}}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function oc(t){let e,s;return e=new xs({props:{ship:t[1]}}),e.$on("close",t[17]),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p(t,s){const n={};2&s&&(n.ship=t[1]),e.$set(n)},i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}function ic(t,e){let s,n,a;return n=new Tr({props:{weapon:e[23],id:e[23].id,cost:e[23].cost,mass:e[23].mass}}),{key:t,first:null,c(){s=dt(),nt(n.$$.fragment),this.h()},l(t){s=dt(),at(n.$$.fragment,t),this.h()},h(){this.first=s},m(t,e){w(t,s,e),rt(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||(ct(n.$$.fragment,t),a=!0)},o(t){lt(n.$$.fragment,t),a=!1},d(t){t&&v(s),ot(n,t)}}}function uc(t){let e,s,n,a,r,c,l,o,i=[],u=new Map;const $=[t[1].weaponry.firecons];let h={};for(let p=0;p<$.length;p+=1)h=Et(h,$[p]);e=new Xa({props:h}),e.$on("change_firecons",t[8]);const f=[t[1].weaponry.adfc];let d={};for(let p=0;p<f.length;p+=1)d=Et(d,f[p]);n=new Qr({props:d}),r=new nc({});let m=t[0];const g=t=>t[23].id;for(let p=0;p<m.length;p+=1){let e=ac(t,m,p),s=g(e);u.set(s,i[p]=ic(s,e))}return{c(){nt(e.$$.fragment),s=p(),nt(n.$$.fragment),a=p(),nt(r.$$.fragment),c=p();for(let t=0;t<i.length;t+=1)i[t].c();l=dt()},l(t){at(e.$$.fragment,t),s=y(t),at(n.$$.fragment,t),a=y(t),at(r.$$.fragment,t),c=y(t);for(let e=0;e<i.length;e+=1)i[e].l(t);l=dt()},m(t,u){rt(e,t,u),w(t,s,u),rt(n,t,u),w(t,a,u),rt(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?bt($,[wt(t[1].weaponry.firecons)]):{};e.$set(a);const r=2&s?bt(f,[wt(t[1].weaponry.adfc)]):{};n.$set(r),1&s&&(m=t[0],gt(),i=it(i,s,g,1,t,m,u,l.parentNode,vt,ic,l,ac),yt())},i(t){if(!o){ct(e.$$.fragment,t),ct(n.$$.fragment,t),ct(r.$$.fragment,t);for(let t=0;t<m.length;t+=1)ct(i[t]);o=!0}},o(t){lt(e.$$.fragment,t),lt(n.$$.fragment,t),lt(r.$$.fragment,t);for(let e=0;e<i.length;e+=1)lt(i[e]);o=!1},d(t){ot(e,t),t&&v(s),ot(n,t),t&&v(a),ot(r,t),t&&v(c);for(let e=0;e<i.length;e+=1)i[e].d(t);t&&v(l)}}}function $c(t){let e,s,n,a,r,c,l,o,i,u,$,f,g,_,E,I,O,k,D,A,M,P,S;e=new qt({});let T=t[2]&&rc(t);const j=[oc,lc,cc],N=[];function V(t,e){return"json"===t[3]?0:"print"===t[3]?1:2}return k=V(t),D=N[k]=j[k](t),{c(){nt(e.$$.fragment),s=p(),n=h("nav"),a=h("input"),r=p(),c=h("div"),l=p(),o=h("input"),i=p(),u=h("ul"),$=h("input"),f=p(),g=h("input"),_=p(),E=h("input"),I=p(),T&&T.c(),O=p(),D.c(),A=dt(),this.h()},l(t){at(e.$$.fragment,t),s=y(t),n=d(t,"NAV",{class:!0});var h=m(n);a=d(h,"INPUT",{class:!0,type:!0,value:!0}),r=y(h),c=d(h,"DIV",{class:!0}),m(c).forEach(v),l=y(h),o=d(h,"INPUT",{type:!0,class:!0,value:!0}),i=y(h),u=d(h,"UL",{class:!0});var p=m(u);$=d(p,"INPUT",{type:!0,class:!0,value:!0}),f=y(p),g=d(p,"INPUT",{type:!0,class:!0,value:!0}),_=y(p),E=d(p,"INPUT",{type:!0,class:!0,value:!0}),p.forEach(v),h.forEach(v),I=y(t),T&&T.l(t),O=y(t),D.l(t),A=dt(),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,p){rt(e,h,p),w(h,s,p),w(h,n,p),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,f),x(u,g),x(u,_),x(u,E),w(h,I,p),T&&T.m(h,p),w(h,O,p),N[k].m(h,p),w(h,A,p),M=!0,P||(S=[ft(a,"click",t[9]),ft(o,"click",t[12]),ft($,"click",t[14]),ft(g,"click",t[15]),ft(E,"click",t[16])],P=!0)},p(t,[e]){t[2]?T?(T.p(t,e),4&e&&ct(T,1)):(T=rc(t),T.c(),ct(T,1),T.m(O.parentNode,O)):T&&(gt(),lt(T,1,1,(()=>{T=null})),yt());let s=k;k=V(t),k===s?N[k].p(t,e):(gt(),lt(N[s],1,1,(()=>{N[s]=null})),yt(),D=N[k],D?D.p(t,e):(D=N[k]=j[k](t),D.c()),ct(D,1),D.m(A.parentNode,A))},i(t){M||(ct(e.$$.fragment,t),ct(T),ct(D),M=!0)},o(t){lt(e.$$.fragment,t),lt(T),lt(D),M=!1},d(t){ot(e,t),t&&v(s),t&&v(n),t&&v(I),T&&T.d(t),t&&v(O),N[k].d(t),t&&v(A),P=!1,St(S)}}}function hc(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=ys.createStore(t,(t=>_s(J(t))));let s;return e.dispatch(e.actions.set_ship_reqs(Lt(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:X(e.getState(),(t=>e.subscribe((()=>{t(e.getState())})))).subscribe,dispatch:e.dispatch,actions:e.actions,selectors:e.selectors}})();jt(t,a,(t=>s(1,n=t))),Nt("ship",a),n.general.name;let r=[];const c=a.dispatch.reset;Nt("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 fc extends i{constructor(t){super(),u(this,t,hc,$c,$,{})}}function pc(t){let e,s;return e=new fc({}),{c(){nt(e.$$.fragment)},l(t){at(e.$$.fragment,t)},m(t,n){rt(e,t,n),s=!0},p:E,i(t){s||(ct(e.$$.fragment,t),s=!0)},o(t){lt(e.$$.fragment,t),s=!1},d(t){ot(e,t)}}}export default class extends i{constructor(t){super(),u(this,t,null,pc,$,{})}}