aotds-docks/docs/app.js

1705 lines
120 KiB
JavaScript
Raw Normal View History

2021-06-13 17:04:00 +00:00
import {respond} from "@sveltejs/kit/ssr";
import {create_ssr_component, validate_component, missing_component, escape, each, add_attribute, subscribe} from "svelte/internal";
import {setContext, afterUpdate, onMount, createEventDispatcher, getContext} from "svelte";
import {readable} from "svelte/store";
import {applyMiddleware, compose} from "redux";
import flow from "lodash/fp/flow.js";
import sumBy from "lodash/fp/sumBy.js";
import pick from "lodash/fp/pick.js";
import filter from "lodash/fp/filter.js";
import flattenDeep from "lodash/fp/flattenDeep.js";
import has from "lodash/fp/has.js";
import Updux, {Updux as Updux$1} from "updux";
import {action, payload} from "ts-action";
import u from "@yanick/updeep";
import {createSelector} from "reselect";
import _$1 from "lodash";
import "svelte/transition";
import "lodash/get.js";
var root_svelte_svelte_type_style_lang = "#svelte-announcer.svelte-1j55zn5{position:absolute;left:0;top:0;clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden;white-space:nowrap;width:1px;height:1px}";
const css$w = {
code: "#svelte-announcer.svelte-1j55zn5{position:absolute;left:0;top:0;clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden;white-space:nowrap;width:1px;height:1px}",
map: `{"version":3,"file":"root.svelte","sources":["root.svelte"],"sourcesContent":["<!-- This file is generated by @sveltejs/kit \u2014 do not edit it! -->\\n<script>\\n\\timport { setContext, afterUpdate, onMount } from 'svelte';\\n\\n\\t// stores\\n\\texport let stores;\\n\\texport let page;\\n\\n\\texport let components;\\n\\texport let props_0 = null;\\n\\texport let props_1 = null;\\n\\texport let props_2 = null;\\n\\n\\tsetContext('__svelte__', stores);\\n\\n\\t$: stores.page.set(page);\\n\\tafterUpdate(stores.page.notify);\\n\\n\\tlet mounted = false;\\n\\tlet navigated = false;\\n\\tlet title = null;\\n\\n\\tonMount(() => {\\n\\t\\tconst unsubscribe = stores.page.subscribe(() => {\\n\\t\\t\\tif (mounted) {\\n\\t\\t\\t\\tnavigated = true;\\n\\t\\t\\t\\ttitle = document.title || 'untitled page';\\n\\t\\t\\t}\\n\\t\\t});\\n\\n\\t\\tmounted = true;\\n\\t\\treturn unsubscribe;\\n\\t});\\n</script>\\n\\n<svelte:component this={components[0]} {...(props_0 || {})}>\\n\\t{#if components[1]}\\n\\t\\t<svelte:component this={components[1]} {...(props_1 || {})}>\\n\\t\\t\\t{#if components[2]}\\n\\t\\t\\t\\t<svelte:component this={components[2]} {...(props_2 || {})}/>\\n\\t\\t\\t{/if}\\n\\t\\t</svelte:component>\\n\\t{/if}\\n</svelte:component>\\n\\n{#if mounted}\\n\\t<div id=\\"svelte-announcer\\" aria-live=\\"assertive\\" aria-atomic=\\"true\\">\\n\\t\\t{#if navigated}\\n\\t\\t\\t{title}\\n\\t\\t{/if}\\n\\t</div>\\n{/if}\\n\\n<style>\\n\\t#svelte-announcer {\\n\\t\\tposition: absolute;\\n\\t\\tleft: 0;\\n\\t\\ttop: 0;\\n\\t\\tclip: rect(0 0 0 0);\\n\\t\\tclip-path: inset(50%);\\n\\t\\toverflow: hidden;\\n\\t\\twhite-space: nowrap;\\n\\t\\twidth: 1px;\\n\\t\\theight: 1px;\\n\\t}\\n</style>"],"names":[],"mappings":"AAsDC,iBAAiB,eAAC,CAAC,AAClB,QAAQ,CAAE,QAAQ,CAClB,IAAI,CAAE,CAAC,CACP,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACnB,SAAS,CAAE,MAAM,GAAG,CAAC,CACrB,QAAQ,CAAE,MAAM,CAChB,WAAW,CAAE,MAAM,CACnB,KAAK,CAAE,GAAG,CACV,MAAM,CAAE,GAAG,AACZ,CAAC"}`
};
const Root = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {stores} = $$props;
let {page} = $$props;
let {components} = $$props;
let {props_0 = null} = $$props;
let {props_1 = null} = $$props;
let {props_2 = null} = $$props;
setContext("__svelte__", stores);
afterUpdate(stores.page.notify);
let mounted = false;
let navigated = false;
let title = null;
onMount(() => {
const unsubscribe = stores.page.subscribe(() => {
if (mounted) {
navigated = true;
title = document.title || "untitled page";
}
});
mounted = true;
return unsubscribe;
});
if ($$props.stores === void 0 && $$bindings.stores && stores !== void 0)
$$bindings.stores(stores);
if ($$props.page === void 0 && $$bindings.page && page !== void 0)
$$bindings.page(page);
if ($$props.components === void 0 && $$bindings.components && components !== void 0)
$$bindings.components(components);
if ($$props.props_0 === void 0 && $$bindings.props_0 && props_0 !== void 0)
$$bindings.props_0(props_0);
if ($$props.props_1 === void 0 && $$bindings.props_1 && props_1 !== void 0)
$$bindings.props_1(props_1);
if ($$props.props_2 === void 0 && $$bindings.props_2 && props_2 !== void 0)
$$bindings.props_2(props_2);
$$result.css.add(css$w);
{
stores.page.set(page);
}
return `
${validate_component(components[0] || missing_component, "svelte:component").$$render($$result, Object.assign(props_0 || {}), {}, {
default: () => `${components[1] ? `${validate_component(components[1] || missing_component, "svelte:component").$$render($$result, Object.assign(props_1 || {}), {}, {
default: () => `${components[2] ? `${validate_component(components[2] || missing_component, "svelte:component").$$render($$result, Object.assign(props_2 || {}), {}, {})}` : ``}`
})}` : ``}`
})}
${mounted ? `<div id="${"svelte-announcer"}" aria-live="${"assertive"}" aria-atomic="${"true"}" class="${"svelte-1j55zn5"}">${navigated ? `${escape(title)}` : ``}</div>` : ``}`;
});
function set_paths(paths) {
}
function set_prerendering(value) {
}
var user_hooks = /* @__PURE__ */ Object.freeze({
__proto__: null,
[Symbol.toStringTag]: "Module"
});
const template = ({head, body}) => '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="/favicon.ico" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n ' + head + '\n </head>\n <body>\n <div id="svelte">' + body + "</div>\n </body>\n</html>\n";
let options = null;
function init(settings) {
set_paths(settings.paths);
set_prerendering(settings.prerendering || false);
options = {
amp: false,
dev: false,
entry: {
file: "/./_app/start-0f46efe9.js",
css: ["/./_app/assets/start-a8cd1609.css"],
js: ["/./_app/start-0f46efe9.js", "/./_app/chunks/vendor-72fdd61e.js"]
},
fetched: void 0,
floc: false,
get_component_path: (id) => "/./_app/" + entry_lookup[id],
get_stack: (error2) => String(error2),
handle_error: (error2) => {
console.error(error2.stack);
error2.stack = options.get_stack(error2);
},
hooks: get_hooks(user_hooks),
hydrate: true,
initiator: void 0,
load_component,
manifest,
paths: settings.paths,
read: settings.read,
root: Root,
router: true,
ssr: true,
target: "#svelte",
template,
trailing_slash: "never"
};
}
const empty = () => ({});
const manifest = {
assets: [{"file": "favicon.ico", "size": 1150, "type": "image/vnd.microsoft.icon"}],
layout: ".svelte-kit/build/components/layout.svelte",
error: ".svelte-kit/build/components/error.svelte",
routes: [
{
type: "page",
pattern: /^\/$/,
params: empty,
a: [".svelte-kit/build/components/layout.svelte", "src/routes/index.svelte"],
b: [".svelte-kit/build/components/error.svelte"]
}
]
};
const get_hooks = (hooks) => ({
getSession: hooks.getSession || (() => ({})),
handle: hooks.handle || (({request, render: render2}) => render2(request))
});
const module_lookup = {
".svelte-kit/build/components/layout.svelte": () => Promise.resolve().then(function() {
return layout;
}),
".svelte-kit/build/components/error.svelte": () => Promise.resolve().then(function() {
return error;
}),
"src/routes/index.svelte": () => Promise.resolve().then(function() {
return index;
})
};
const metadata_lookup = {".svelte-kit/build/components/layout.svelte": {"entry": "/./_app/layout.svelte-a2a1094c.js", "css": [], "js": ["/./_app/layout.svelte-a2a1094c.js", "/./_app/chunks/vendor-72fdd61e.js"], "styles": null}, ".svelte-kit/build/components/error.svelte": {"entry": "/./_app/error.svelte-49d2d5aa.js", "css": [], "js": ["/./_app/error.svelte-49d2d5aa.js", "/./_app/chunks/vendor-72fdd61e.js"], "styles": null}, "src/routes/index.svelte": {"entry": "/./_app/pages/index.svelte-080d4e4c.js", "css": ["/./_app/assets/pages/index.svelte-91a0f1d4.css"], "js": ["/./_app/pages/index.svelte-080d4e4c.js", "/./_app/chunks/vendor-72fdd61e.js"], "styles": null}};
async function load_component(file) {
return {
module: await module_lookup[file](),
...metadata_lookup[file]
};
}
init({paths: {"base": "", "assets": "/."}});
function render(request, {
prerender
} = {}) {
const host = request.headers["host"];
return respond({...request, host}, options, {prerender});
}
const Layout = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `${slots.default ? slots.default({}) : ``}`;
});
var layout = /* @__PURE__ */ Object.freeze({
__proto__: null,
[Symbol.toStringTag]: "Module",
"default": Layout
});
function load({error: error2, status}) {
return {props: {error: error2, status}};
}
const Error = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {status} = $$props;
let {error: error2} = $$props;
if ($$props.status === void 0 && $$bindings.status && status !== void 0)
$$bindings.status(status);
if ($$props.error === void 0 && $$bindings.error && error2 !== void 0)
$$bindings.error(error2);
return `<h1>${escape(status)}</h1>
<p>${escape(error2.message)}</p>
${error2.stack ? `<pre>${escape(error2.stack)}</pre>` : ``}`;
});
var error = /* @__PURE__ */ Object.freeze({
__proto__: null,
[Symbol.toStringTag]: "Module",
"default": Error,
load
});
var Header_svelte_svelte_type_style_lang = "header.svelte-1me5k9w{display:flex;align-items:baseline;width:var(--main-width);margin-left:auto;margin-right:auto}h1.svelte-1me5k9w,h2.svelte-1me5k9w{font-family:Faktos;padding:0px;margin:0px}h2.svelte-1me5k9w{text-align:right;flex:1;padding-left:2em;font-size:var(--font-scale-12)}";
const css$v = {
code: "header.svelte-1me5k9w{display:flex;align-items:baseline;width:var(--main-width);margin-left:auto;margin-right:auto}h1.svelte-1me5k9w,h2.svelte-1me5k9w{font-family:Faktos;padding:0px;margin:0px}h2.svelte-1me5k9w{text-align:right;flex:1;padding-left:2em;font-size:var(--font-scale-12)}",
map: '{"version":3,"file":"Header.svelte","sources":["Header.svelte"],"sourcesContent":["<header>\\n <h1>The Docks</h1>\\n <h2>a <a\\n href=\\"https://shop.groundzerogames.co.uk/rules.html\\">Full Thrust</a> ship builder</h2>\\n </header>\\n\\n <style>\\n\\n header {\\n display: flex;\\n align-items: baseline;\\n width: var(--main-width);\\n margin-left: auto;\\n margin-right: auto;\\n }\\n h1, h2 {\\n font-family: Faktos;\\n padding: 0px;\\n margin: 0px;\\n }\\n\\n h2 {\\n text-align: right;\\n flex: 1;\\n padding-left: 2em;\\n font-size: var(--font-scale-12);\\n }\\n </style>\\n"],"names":[],"mappings":"AAQI,MAAM,eAAC,CAAC,AACR,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,QAAQ,CACnB,KAAK,CAAE,IAAI,YAAY,CAAC,CACxB,WAAW,CAAE,IAAI,CACjB,YAAY,CAAE,IAAI,AACpB,CAAC,AACH,iBAAE,CAAE,EAAE,eAAC,CAAC,AACN,WAAW,CAAE,MAAM,CACnB,OAAO,CAAE,GAAG,CACZ,MAAM,CAAE,GAAG,AACb,CAAC,AAED,EAAE,eAAC,CAAC,AACF,UAAU,CAAE,KAAK,CACjB,IAAI,CAAE,CAAC,CACP,YAAY,CAAE,GAAG,CACjB,SAAS,CAAE,IAAI,eAAe,CAAC,AACjC,CAAC"}'
};
const Header = create_ssr_component(($$result, $$props, $$bindings, slots) => {
$$result.css.add(css$v);
return `<header class="${"svelte-1me5k9w"}"><h1 class="${"svelte-1me5k9w"}">The Docks</h1>
<h2 class="${"svelte-1me5k9w"}">a <a href="${"https://shop.groundzerogames.co.uk/rules.html"}">Full Thrust</a> ship builder</h2>
</header>`;
});
const expand_cost_mass = (obj = {}) => [
pick(["cost", "mass"], obj),
...Object.values(obj || {}).filter((val) => typeof val === "object").map((val) => expand_cost_mass(val))
];
function calc_ship_req(ship) {
console.log(ship);
let {general, ...rest} = ship;
const items = flow(expand_cost_mass, flattenDeep, filter(has("cost")))({
...rest,
cost: general.mass,
mass: 0
});
return {
mass: sumBy("mass", items),
cost: sumBy("cost", items)
};
}
const ceil = (number) => Math.ceil(Math.round(10 * number) / 10);
function calc_ftl_reqs(type, ship_mass) {
if (type === "none")
return {cost: 0, mass: 0};
const mass = Math.ceil(ship_mass / 10);
return {
mass,
cost: mass * (type === "advanced" ? 3 : 2)
};
}
const set_ftl = action("set_ftl", payload());
const set_ftl_reqs = action("set_ftl_reqs", payload());
const dux$g = new Updux({
initial: {
mass: 0,
cost: 0,
type: "none"
}
});
dux$g.addMutation(set_ftl, (type) => u.update({type}));
dux$g.addMutation(set_ftl_reqs, (reqs) => u.update(reqs));
var ftl = dux$g.asDux;
const set_engine = action("set_engine", payload());
const set_drive_reqs = action("set_drive_reqs", payload());
const dux$f = new Updux({
initial: {
mass: 1,
cost: 2,
rating: 1
}
});
dux$f.addMutation(set_engine, (engine2) => u.update(engine2));
dux$f.addMutation(set_drive_reqs, (rate) => u.update(rate));
function calc_drive_reqs(ship_mass, rating, advanced = false) {
const mass = Math.ceil(rating * 0.05 * ship_mass);
const cost = mass * (advanced ? 3 : 2);
return {mass, cost};
}
var engine = dux$f.asDux;
function weapon_cost_mass(weapon) {
let cost = 0;
let mass = 0;
if (weapon.weapon_type === "beam") {
return beam_cost_mass(weapon);
}
if (weapon.weapon_type == "submunition") {
return {mass: 1, cost: 3};
}
if (weapon.weapon_type === "pds") {
return {mass: 1, cost: 3};
}
if (weapon.weapon_type === "scattergun") {
return {mass: 1, cost: 4};
}
if (weapon.weapon_type === "needle") {
return {mass: 2, cost: 6};
}
return {cost, mass};
}
const is_broadside = (arcs) => {
if (arcs.length !== 4)
return false;
return !arcs.some((a) => a.length === 1);
};
function beam_cost_mass({weapon_class, arcs}) {
let mass;
if (weapon_class === 1) {
mass = 1;
}
if (weapon_class == 2) {
mass = 2 + (arcs.length > 3 ? 1 : 0);
}
if (weapon_class == 3) {
mass = 4;
if (is_broadside(arcs)) {
mass += 2;
} else {
mass += arcs.length - 1;
}
}
if (weapon_class == 4) {
mass = 8;
if (is_broadside(arcs)) {
mass += 4;
} else {
mass += 2 * (arcs.length - 1);
}
}
return {
mass,
cost: 3 * mass
};
}
const add_weapon = action("add_weapon", payload());
const remove_weapon = action("remove_weapon", payload());
const uu = (transform) => (state) => transform(state)(state);
const with_reqs = uu((weapon) => u(weapon_cost_mass(weapon)));
const dux$e = new Updux$1({
initial: []
});
const weapon_initial = {
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"]}
};
dux$e.addMutation(add_weapon, (type) => (state) => {
const id = 1 + Math.max(0, ...state.map(({id: id2}) => id2));
return [...state, {...with_reqs(weapon_initial[type]), id}];
});
dux$e.addMutation(remove_weapon, (id) => (state) => state.filter((w) => w.id !== id));
const set_weapon = action("set_weapon", payload());
dux$e.addMutation(set_weapon, (payload2) => u.map(u.if(_.matches({id: payload2.id}), (state) => with_reqs(u(payload2, state)))));
var weapons = dux$e.asDux;
const dux$d = new Updux$1({
initial: {
rating: 0,
cost: 0,
mass: 0
}
});
dux$d.addMutation(action("set_adfc", payload()), (rating) => u.update({rating, mass: 2 * rating, cost: 8 * rating}));
var adfc = dux$d.asDux;
const dux$c = new Updux$1({
initial: {
firecons: {
nbr: 0,
cost: 0,
mass: 0
}
},
subduxes: {
weapons,
adfc
}
});
var weaponry = dux$c.asDux;
const ship_types = [
{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: true},
{name: "Light Carrier", mass: [120, 180], abbrev: "CVL", carrier: true},
{name: "Heavy Carrier", mass: [160, 300], abbrev: "CVH", carrier: true},
{name: "Attack Carrier", mass: [150, 300], abbrev: "CVA", carrier: true}
];
function candidate_ship_types(mass = 0, carrier = false) {
console.log({carrier});
return ship_types.filter((c) => carrier == !!c.carrier).filter((c) => c.mass[0] <= mass).filter((c) => c.mass[1] >= mass);
}
const dux$b = new Updux$1({
initial: {
standard: 0,
advanced: 0,
cost: 0,
mass: 0
}
});
const set_screens = action("set_screens", payload());
dux$b.addMutation(set_screens, (payload2) => u.update(payload2));
const set_screens_reqs = action("set_screens_reqs", payload());
dux$b.addMutation(set_screens_reqs, (payload2) => u.update(payload2));
var screens = dux$b.asDux;
const dux$9 = new Updux$1({
initial: []
});
const set_armour_nbr_layers = action("set_armour_nbr_layers", payload());
dux$9.addMutation(set_armour_nbr_layers, (nbr_layers) => (state) => {
if (state.length > nbr_layers)
state = state.slice(0, nbr_layers);
if (state.length < nbr_layers) {
state = [state, _$1.times(nbr_layers - state.length, () => [])].flat();
}
state = u.map((el, i) => ({layer: i + 1, rating: 0, cost: 0, mass: 0, ...el}), state);
return state;
});
dux$9.addMutation(action("set_armour_layer", payload()), ({layer, rating}) => u.map(u.if(_$1.matches({layer}), u({
rating,
cost: 2 * layer * rating,
mass: 2 * rating
}))));
var dux$a = dux$9.asDux;
const dux$8 = new Updux$1({
initial: {
mass: 0,
cost: 0,
hull: {
rating: 1,
advanced: false,
cost: 2,
mass: 1
}
},
subduxes: {
screens,
armour: dux$a
}
});
var structure = dux$8.asDux;
const dux$6 = new Updux$1({
initial: {
space: 0,
cost: 0,
mass: 0
}
});
const set_cargo = action("set_cargo", payload());
dux$6.addMutation(set_cargo, (space) => () => ({
space,
cost: 0,
mass: space
}));
var dux$7 = dux$6.asDux;
const dux$4 = new Updux$1({
initial: {
type: "none",
cost: 0,
mass: 0
}
});
const set_streamlining = action("set_streamlining", payload());
dux$4.addMutation(set_streamlining, (type) => u.update({type}));
const set_streamlining_cost_mass = action("set_streamlining_cost_mass", payload());
dux$4.addMutation(set_streamlining_cost_mass, (reqs) => u.update(reqs));
var dux$5 = dux$4.asDux;
var squadron_types = [
{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 dux$2 = new Updux$1({
initial: {
bays: 0,
cost: 0,
mass: 0,
squadrons: []
}
});
const set_squadron = action("set_squadron", payload());
dux$2.addMutation(set_squadron, ({id, type}) => u.update({squadrons: u.map(u.if(_$1.matches({id}), u({type, cost: 6 * _$1.find(squadron_types, {type}).cost, mass: 6})))}));
const set_carrier_bays = action("set_carrier_bays", payload());
dux$2.addMutation(set_carrier_bays, (bays) => (state) => {
state = u.update({
bays,
mass: 1.5 * 6 * bays,
cost: 3 * 1.5 * 6 * bays
})(state);
if (state.squadrons.length > bays) {
state = u.update({
squadrons: (squadrons) => squadrons.slice(0, bays)
}, state);
}
if (state.squadrons.length < bays) {
state = u.update({
squadrons: (squadrons) => [...squadrons, ..._$1.times(bays - state.squadrons.length, (i) => ({
id: 1 + i + state.squadrons.length,
cost: 6 * squadron_types[0].cost,
mass: 6,
type: squadron_types[0].type
}))]
}, state);
}
return state;
});
var dux$3 = dux$2.asDux;
const set_ship_mass = action("set_ship_mass", payload());
const set_name = action("set_name", payload());
const set_ship_reqs = action("set_ship_reqs", payload());
const set_hull = action("set_hull", payload());
const set_ship_type = action("set_ship_type", payload());
const reset = action("reset");
const initial = {
general: {
ship_class: "",
name: "",
ship_type: "",
mass: 10,
used_mass: 0,
cost: 10
}
};
const dux = new Updux$1({
subduxes: {ftl, engine, weaponry, structure, cargo: dux$7, streamlining: dux$5, carrier: dux$3},
initial
});
dux.addMutation(reset, () => () => initial);
dux.addMutation(set_hull, ({rating}) => (state) => {
return u.updateIn("structure.hull", {
cost: 2 * rating,
rating,
mass: rating
})(state);
});
dux.addMutation(set_ship_mass, (mass) => u.updateIn("general", {mass}));
dux.addMutation(set_name, (name) => u.updateIn("general", {name}));
dux.addMutation(action("set_ship_class", payload()), (ship_class) => u.updateIn("general", {ship_class}));
dux.addMutation(set_ship_reqs, ({cost, mass: used_mass}) => u.updateIn("general", {cost, used_mass}));
dux.addSubscription((store) => createSelector(calc_ship_req, (reqs) => store.dispatch(set_ship_reqs(reqs))));
dux.addSubscription((store) => createSelector((store2) => store2.general.mass, (store2) => store2.streamlining.type, (ship_mass, streamlining) => {
const mass = ceil(ship_mass * (streamlining === "none" ? 0 : streamlining === "partial" ? 5 : 10) / 100);
const cost = 2 * mass;
store.dispatch(dux.actions.set_streamlining_cost_mass({cost, mass}));
}));
dux.addSubscription((store) => createSelector((store2) => store2.general.mass, (store2) => store2.general.ship_type, (store2) => store2.carrier.bays, (mass, type, bays) => {
console.log({bays});
const candidates = candidate_ship_types(mass, bays > 0);
console.log({candidates});
if (candidates.length === 0)
return;
if (candidates.find(({name}) => name === type))
return;
store.dispatch(store.actions.set_ship_type(candidates[0].name));
}));
dux.addMutation(set_ship_type, (type) => u.updateIn("general.ship_type", type));
dux.addSubscription((store) => createSelector([(ship) => ship.general.mass, (ship) => ship.ftl.type], (ship_mass, type) => store.dispatch(ftl.actions.set_ftl_reqs(calc_ftl_reqs(type, ship_mass)))));
dux.addSubscription((store) => createSelector((ship) => ship.general.mass, (ship) => ship.structure.screens.standard, (ship) => ship.structure.screens.advanced, (mass, standard, advanced) => {
console.log({
mass,
standard,
advanced
});
const standard_mass = standard * Math.max(3, ceil(0.05 * mass));
const advanced_mass = advanced * Math.max(4, ceil(0.075 * mass));
store.dispatch(dux.actions.set_screens_reqs({
mass: standard_mass + advanced_mass,
cost: 3 * standard_mass + 4 * advanced_mass
}));
}));
dux.addSubscription((store) => createSelector([
(ship) => ship.general.mass,
(ship) => ship.engine.rating,
(ship) => ship.engine.advanced
], (ship_mass, rating, advanced) => store.dispatch(dux.actions.set_drive_reqs(calc_drive_reqs(ship_mass, rating, advanced)))));
const calc_firecons_reqs = (nbr) => ({
cost: 4 * nbr,
mass: nbr
});
const set_firecons = action("set_firecons", payload());
dux.addMutation(set_firecons, (nbr) => u.updateIn("weaponry.firecons", {
nbr,
...calc_firecons_reqs(nbr)
}));
var dux$1 = dux.asDux;
let composeEnhancers = compose;
var shipStore = () => {
let saved;
if (saved) {
saved = JSON.parse(saved);
} else {
saved = void 0;
}
console.log(saved);
const duxStore = dux$1.createStore(saved, (mw) => composeEnhancers(applyMiddleware(mw)));
duxStore.dispatch(duxStore.actions.set_ship_reqs(calc_ship_req(duxStore.getState())));
Object.entries(duxStore.actions).forEach(([type, action2]) => {
duxStore.dispatch[type] = (payload2) => duxStore.dispatch(action2(payload2));
});
let previous = void 0;
duxStore.subscribe(() => {
let current = duxStore.getState();
if (previous === current)
return;
previous = current;
console.log(current);
});
const state = readable(duxStore.getState(), (set) => duxStore.subscribe(() => {
set(duxStore.getState());
}));
return {
subscribe: state.subscribe,
dispatch: duxStore.dispatch,
actions: duxStore.actions,
selectors: duxStore.selectors
};
};
var Json_svelte_svelte_type_style_lang = "pre.svelte-2g9858{font-family:monospace;font-size:var(--font-scale-9);overflow:scroll;height:90%}aside.svelte-2g9858{padding:1em;border:3px solid var(--indigo-dye);border-radius:1em;font-size:var(--font-scale-11)}";
const css$u = {
code: "pre.svelte-2g9858{font-family:monospace;font-size:var(--font-scale-9);overflow:scroll;height:90%}aside.svelte-2g9858{padding:1em;border:3px solid var(--indigo-dye);border-radius:1em;font-size:var(--font-scale-11)}",
map: `{"version":3,"file":"Json.svelte","sources":["Json.svelte"],"sourcesContent":["<aside transition:fade>\\n <pre><code>{json}</code></pre>\\n</aside>\\n\\n<script>\\n export let ship = {};\\n let json;\\n $: json = JSON.stringify(ship,null,2);\\n\\n import { fly, fade } from 'svelte/transition';\\n import {createEventDispatcher} from 'svelte';\\n\\n const dispatch = createEventDispatcher();\\n const close = () => dispatch('close');\\n</script>\\n\\n<style>\\n pre {\\n font-family: monospace;\\n font-size: var(--font-scale-9);\\n overflow: scroll;\\n height: 90%;\\n\\n }\\n div {\\n text-align: right;\\n }\\n aside {\\n\\n padding: 1em;\\n border: 3px solid var(--indigo-dye);\\n border-radius: 1em;\\n font-size: var(--font-scale-11);\\n }\\n</style>\\n"],"names":[],"mappings":"AAiBE,GAAG,cAAC,CAAC,AACH,WAAW,CAAE,SAAS,CACtB,SAAS,CAAE,IAAI,cAAc,CAAC,CAC9B,QAAQ,CAAE,MAAM,CAChB,MAAM,CAAE,GAAG,AAEb,CAAC,AAID,KAAK,cAAC,CAAC,AAEL,OAAO,CAAE,GAAG,CACZ,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,CACnC,aAAa,CAAE,GAAG,CAClB,SAAS,CAAE,IAAI,eAAe,CAAC,AACjC,CAAC"}`
};
create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ship = {}} = $$props;
let json;
createEventDispatcher();
if ($$props.ship === void 0 && $$bindings.ship && ship !== void 0)
$$bindings.ship(ship);
$$result.css.add(css$u);
json = JSON.stringify(ship, null, 2);
return `<aside class="${"svelte-2g9858"}"><pre class="${"svelte-2g9858"}"><code>${escape(json)}</code></pre>
</aside>`;
});
var Cost_svelte_svelte_type_style_lang = "div.svelte-1oeefsn:after{content:'\\00A4';margin-left:0.5em}";
const css$t = {
code: "div.svelte-1oeefsn:after{content:'\\00A4';margin-left:0.5em}",
map: `{"version":3,"file":"Cost.svelte","sources":["Cost.svelte"],"sourcesContent":["<div>{cost}</div>\\n\\n<script>\\n export let cost = 0;\\n</script>\\n\\n<style>\\n div:after { content: '\\\\00A4'; margin-left: 0.5em; }\\n</style>\\n"],"names":[],"mappings":"AAOE,kBAAG,MAAM,AAAC,CAAC,AAAC,OAAO,CAAE,OAAO,CAAE,WAAW,CAAE,KAAK,AAAE,CAAC"}`
};
const Cost = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {cost = 0} = $$props;
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
$$result.css.add(css$t);
return `<div class="${"svelte-1oeefsn"}">${escape(cost)}</div>`;
});
var Mass_svelte_svelte_type_style_lang = "div.svelte-wps6ap:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}";
const css$s = {
code: "div.svelte-wps6ap:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}",
map: '{"version":3,"file":"Mass.svelte","sources":["Mass.svelte"],"sourcesContent":["<div>{mass}</div>\\n\\n<script>\\n export let mass = 0;\\n</script>\\n\\n<style>\\n div:after {\\n content: url(mass.svg);\\n width: 0.75em;\\n display: inline-block;\\n margin-left: 0.5em;\\n }\\n</style>\\n"],"names":[],"mappings":"AAOE,iBAAG,MAAM,AAAC,CAAC,AACT,OAAO,CAAE,IAAI,QAAQ,CAAC,CACtB,KAAK,CAAE,MAAM,CACb,OAAO,CAAE,YAAY,CACrB,WAAW,CAAE,KAAK,AACpB,CAAC"}'
};
const Mass = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {mass = 0} = $$props;
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
$$result.css.add(css$s);
return `<div class="${"svelte-wps6ap"}">${escape(mass)}</div>`;
});
var index_svelte_svelte_type_style_lang$m = "h1.svelte-bo35k{width:100%;display:flex;font-size:var(--font-scale-8)}h2.svelte-bo35k{font-size:var(--font-scale-7);flex:1}.fill.svelte-bo35k{margin-left:0.5em;display:inline-block;flex:1;border-bottom:1px solid black}.details.svelte-bo35k{display:flex;align-items:baseline}.reqs.svelte-bo35k{display:flex}";
const css$r = {
code: "h1.svelte-bo35k{width:100%;display:flex;font-size:var(--font-scale-8)}h2.svelte-bo35k{font-size:var(--font-scale-7);flex:1}.fill.svelte-bo35k{margin-left:0.5em;display:inline-block;flex:1;border-bottom:1px solid black}.details.svelte-bo35k{display:flex;align-items:baseline}.reqs.svelte-bo35k{display:flex}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<h1>ship name: <div class=\\"fill\\"></div> </h1>\\n\\n<div class=\\"details\\">\\n <h2>{ship_class}-class, {ship_type}</h2>\\n <div class=\\"reqs\\">\\n <Cost {cost} />\\n &nbsp;\\n <Mass {mass} />\\n </div>\\n</div>\\n\\n<script>\\n import Cost from '../../../Cost.svelte';\\n import Mass from '$lib/components/Mass.svelte';\\n\\nexport let ship_class;\\nexport let ship_type;\\n export let cost, mass = ( 0, 0 );\\n</script>\\n\\n<style>\\n h1 {\\n width: 100%;\\n display: flex;\\n font-size: var(--font-scale-8);\\n }\\n h2 {\\n font-size: var(--font-scale-7);\\n flex: 1;\\n }\\n .fill {\\n margin-left: 0.5em;\\n display: inline-block;\\n flex: 1;\\n border-bottom: 1px solid black;\\n }\\n .details {\\n display: flex;\\n align-items: baseline;\\n }\\n .reqs {\\n display: flex;\\n }\\n</style>\\n"],"names":[],"mappings":"AAqBE,EAAE,aAAC,CAAC,AACF,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,IAAI,CACb,SAAS,CAAE,IAAI,cAAc,CAAC,AAChC,CAAC,AACD,EAAE,aAAC,CAAC,AACF,SAAS,CAAE,IAAI,cAAc,CAAC,CAC9B,IAAI,CAAE,CAAC,AACT,CAAC,AACD,KAAK,aAAC,CAAC,AACL,WAAW,CAAE,KAAK,CAClB,OAAO,CAAE,YAAY,CACrB,IAAI,CAAE,CAAC,CACP,aAAa,CAAE,GAAG,CAAC,KAAK,CAAC,KAAK,AAChC,CAAC,AACD,QAAQ,aAAC,CAAC,AACR,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,QAAQ,AACvB,CAAC,AACD,KAAK,aAAC,CAAC,AACL,OAAO,CAAE,IAAI,AACf,CAAC"}`
};
const Identification$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ship_class} = $$props;
let {ship_type} = $$props;
let {cost} = $$props, {mass = 0} = $$props;
if ($$props.ship_class === void 0 && $$bindings.ship_class && ship_class !== void 0)
$$bindings.ship_class(ship_class);
if ($$props.ship_type === void 0 && $$bindings.ship_type && ship_type !== void 0)
$$bindings.ship_type(ship_type);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
$$result.css.add(css$r);
return `<h1 class="${"svelte-bo35k"}">ship name: <div class="${"fill svelte-bo35k"}"></div></h1>
<div class="${"details svelte-bo35k"}"><h2 class="${"svelte-bo35k"}">${escape(ship_class)}-class, ${escape(ship_type)}</h2>
<div class="${"reqs svelte-bo35k"}">${validate_component(Cost, "Cost").$$render($$result, {cost}, {}, {})}
\xA0
${validate_component(Mass, "Mass").$$render($$result, {mass}, {}, {})}</div>
</div>`;
});
var index_svelte_svelte_type_style_lang$l = ".thrust.svelte-w7le23{background-image:url(icons/standard-drive.svg);width:2em;background-size:2em;background-repeat:no-repeat;height:2em;line-height:2em;text-align:center}.main_systems.svelte-w7le23{display:flex;align-items:center;gap:1em;justify-content:space-evenly;margin-top:1em}img.ftl.svelte-w7le23{height:2em}img.internal.svelte-w7le23{height:2em}";
const css$q = {
code: ".thrust.svelte-w7le23{background-image:url(icons/standard-drive.svg);width:2em;background-size:2em;background-repeat:no-repeat;height:2em;line-height:2em;text-align:center}.main_systems.svelte-w7le23{display:flex;align-items:center;gap:1em;justify-content:space-evenly;margin-top:1em}img.ftl.svelte-w7le23{height:2em}img.internal.svelte-w7le23{height:2em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div class=\\"main_systems\\">\\n\\n {#if ftl !== \\"none\\" }\\n <img class=\\"ftl\\" src=\\"icons/ftl-drive.svg\\" alt=\\"ftl drive\\" />\\n {/if}\\n\\n {#if engine > 0}\\n <div class=\\"thrust\\">{engine}</div>\\n {/if}\\n\\n <img class=\\"internal\\" src=\\"icons/internal-systems.svg\\" alt=\\"internal systems\\"/>\\n </div>\\n\\n<script>\\n export let ftl = 'none';\\n export let engine = 0;\\n\\n</script>\\n\\n<style>\\n .thrust {\\n background-image: url(icons/standard-drive.svg);\\n width: 2em;\\n background-size: 2em;\\n background-repeat: no-repeat;\\n height: 2em;\\n line-height: 2em;\\n text-align: center;\\n }\\n.main_systems {\\n display: flex;\\n align-items: center;\\n gap: 1em;\\n justify-content: space-evenly;\\n margin-top: 1em;\\n}\\n img.ftl { height: 2em; }\\n img.internal {\\n height: 2em;\\n }\\n</style>\\n"],"names":[],"mappings":"AAoBE,OAAO,cAAC,CAAC,AACP,gBAAgB,CAAE,IAAI,wBAAwB,CAAC,CAC/C,KAAK,CAAE,GAAG,CACV,eAAe,CAAE,GAAG,CACpB,iBAAiB,CAAE,SAAS,CAC5B,MAAM,CAAE,GAAG,CACX,WAAW,CAAE,GAAG,CAChB,UAAU,CAAE,MAAM,AACpB,CAAC,AACH,aAAa,cAAC,CAAC,AACb,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,MAAM,CACnB,GAAG,CAAE,GAAG,CACR,eAAe,CAAE,YAAY,CAC7B,UAAU,CAAE,GAAG,AACjB,CAAC,AACC,GAAG,IAAI,cAAC,CAAC,AAAC,MAAM,CAAE,GAAG,AAAE,CAAC,AACxB,GAAG,SAAS,cAAC,CAAC,AACZ,MAAM,CAAE,GAAG,AACb,CAAC"}`
};
const MainSystems = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ftl: ftl2 = "none"} = $$props;
let {engine: engine2 = 0} = $$props;
if ($$props.ftl === void 0 && $$bindings.ftl && ftl2 !== void 0)
$$bindings.ftl(ftl2);
if ($$props.engine === void 0 && $$bindings.engine && engine2 !== void 0)
$$bindings.engine(engine2);
$$result.css.add(css$q);
return `<div class="${"main_systems svelte-w7le23"}">${ftl2 !== "none" ? `<img class="${"ftl svelte-w7le23"}" src="${"icons/ftl-drive.svg"}" alt="${"ftl drive"}">` : ``}
${engine2 > 0 ? `<div class="${"thrust svelte-w7le23"}">${escape(engine2)}</div>` : ``}
<img class="${"internal svelte-w7le23"}" src="${"icons/internal-systems.svg"}" alt="${"internal systems"}">
</div>`;
});
var index_svelte_svelte_type_style_lang$k = ".cell.svelte-qekx9g{display:inline-block;margin-right:0.5em;width:1em;height:1em;border:1px solid black}img.svelte-qekx9g{width:1em}";
const css$p = {
code: ".cell.svelte-qekx9g{display:inline-block;margin-right:0.5em;width:1em;height:1em;border:1px solid black}img.svelte-qekx9g{width:1em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n {#each rows as row,i (i)}\\n <div class=\\"row\\">\\n {#each row as item,j (j)}\\n <div class=\\"cell\\">\\n {#if item}\\n <img src=\\"icons/crew-star.svg\\" alt=\\"crew loss threshold\\" />\\n {/if}\\n </div>\\n {/each}\\n </div>\\n {/each}\\n\\n</div>\\n\\n<script>\\n import { ceil } from '$lib/dux/utils';\\n\\n export let ship_mass = 0;\\n export let rating = 0;\\n export let advanced = false;\\n\\n let nbr_rows;\\n $: nbr_rows = advanced ? 3 : 4;\\n\\n let cells;\\n $: cells = Array(rating).fill(false);\\n\\n let dcp;\\n $: dcp= ceil(ship_mass/20);\\n\\n $: cells = divide(cells, dcp).map(\\n g => {\\n g[g.length-1] = true;\\n return g;\\n }\\n ).flat();\\n\\n function divide(list, divider) {\\n if( divider <= 1 ) return [ list ];\\n\\n let div = list.length / divider;\\n const mod = list.length % divider;\\n\\n if(mod) div++;\\n\\n return [\\n list.slice(0,div),\\n ...divide( list.slice(div), divider-1 )\\n ]\\n }\\n\\n let rows = [];\\n $: rows = divide( cells, nbr_rows );\\n\\n\\n</script>\\n\\n<style>\\n .row {\\n }\\n.cell {\\n display: inline-block;\\n margin-right: 0.5em;\\n width: 1em;\\n height: 1em;\\n border: 1px solid black;\\n}\\n img {\\n width: 1em;\\n }\\n</style>\\n"],"names":[],"mappings":"AA6DA,KAAK,cAAC,CAAC,AACL,OAAO,CAAE,YAAY,CACrB,YAAY,CAAE,KAAK,CACnB,KAAK,CAAE,GAAG,CACV,MAAM,CAAE,GAAG,CACX,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,KAAK,AACzB,CAAC,AACC,GAAG,cAAC,CAAC,AACH,KAAK,CAAE,GAAG,AACZ,CAAC"}`
};
function divide(list, divider) {
if (divider <= 1)
return [list];
let div = list.length / divider;
const mod = list.length % divider;
if (mod)
div++;
return [list.slice(0, div), ...divide(list.slice(div), divider - 1)];
}
const Integrity = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ship_mass = 0} = $$props;
let {rating = 0} = $$props;
let {advanced = false} = $$props;
let nbr_rows;
let cells;
let dcp;
let rows = [];
if ($$props.ship_mass === void 0 && $$bindings.ship_mass && ship_mass !== void 0)
$$bindings.ship_mass(ship_mass);
if ($$props.rating === void 0 && $$bindings.rating && rating !== void 0)
$$bindings.rating(rating);
if ($$props.advanced === void 0 && $$bindings.advanced && advanced !== void 0)
$$bindings.advanced(advanced);
$$result.css.add(css$p);
nbr_rows = advanced ? 3 : 4;
cells = Array(rating).fill(false);
dcp = ceil(ship_mass / 20);
cells = divide(cells, dcp).map((g) => {
g[g.length - 1] = true;
return g;
}).flat();
rows = divide(cells, nbr_rows);
return `<div>${each(rows, (row, i) => `<div class="${"row svelte-qekx9g"}">${each(row, (item, j) => `<div class="${"cell svelte-qekx9g"}">${item ? `<img src="${"icons/crew-star.svg"}" alt="${"crew loss threshold"}" class="${"svelte-qekx9g"}">` : ``}
</div>`)}
</div>`)}
</div>`;
});
var index_svelte_svelte_type_style_lang$j = ".cell.svelte-15e5q3d{display:inline-block;margin-right:0.5em;width:1em;height:1em;border:1px solid black;border-radius:0.5em}.layers.svelte-15e5q3d{display:flex;flex-direction:column-reverse}";
const css$o = {
code: ".cell.svelte-15e5q3d{display:inline-block;margin-right:0.5em;width:1em;height:1em;border:1px solid black;border-radius:0.5em}.layers.svelte-15e5q3d{display:flex;flex-direction:column-reverse}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div class=\\"layers\\">\\n {#each armour as layer (layer)}\\n <div class=\\"layer\\">\\n {#each _.range(layer.rating) as i (i) }\\n <div class=\\"cell\\">\\n </div>\\n {/each}\\n </div>\\n {/each}\\n\\n</div>\\n\\n<script>\\n import _ from 'lodash';\\n\\n export let armour = [];\\n\\n $: console.log(armour);\\n</script>\\n\\n<style>\\n.cell {\\n display: inline-block;\\n margin-right: 0.5em;\\n width: 1em;\\n height: 1em;\\n border: 1px solid black;\\n border-radius: 0.5em;\\n}\\n .layers {\\n display: flex;\\n flex-direction: column-reverse;\\n }\\n</style>\\n"],"names":[],"mappings":"AAqBA,KAAK,eAAC,CAAC,AACL,OAAO,CAAE,YAAY,CACrB,YAAY,CAAE,KAAK,CACnB,KAAK,CAAE,GAAG,CACV,MAAM,CAAE,GAAG,CACX,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CACvB,aAAa,CAAE,KAAK,AACtB,CAAC,AACC,OAAO,eAAC,CAAC,AACP,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,cAAc,AAChC,CAAC"}`
};
const Armour$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {armour = []} = $$props;
if ($$props.armour === void 0 && $$bindings.armour && armour !== void 0)
$$bindings.armour(armour);
$$result.css.add(css$o);
{
console.log(armour);
}
return `<div class="${"layers svelte-15e5q3d"}">${each(armour, (layer) => `<div class="${"layer"}">${each(_$1.range(layer.rating), (i) => `<div class="${"cell svelte-15e5q3d"}"></div>`)}
</div>`)}
</div>`;
});
const Hull$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {structure: structure2 = {}} = $$props;
let {ship_mass = 0} = $$props;
if ($$props.structure === void 0 && $$bindings.structure && structure2 !== void 0)
$$bindings.structure(structure2);
if ($$props.ship_mass === void 0 && $$bindings.ship_mass && ship_mass !== void 0)
$$bindings.ship_mass(ship_mass);
return `<div>${validate_component(Armour$1, "Armour").$$render($$result, {armour: structure2.armour}, {}, {})}
${validate_component(Integrity, "Integrity").$$render($$result, {
rating: structure2.hull.rating,
advanced: structure2.hull.advanced,
ship_mass
}, {}, {})}
</div>`;
});
var Arc_svelte_svelte_type_style_lang = "path.svelte-7q6uh5{fill:lightgrey;stroke:white;stroke-width:2px}path.svelte-7q6uh5:hover{fill:pink}path.active.svelte-7q6uh5:hover{fill:pink}path.active.svelte-7q6uh5{fill:#313131}";
const css$n = {
code: "path.svelte-7q6uh5{fill:lightgrey;stroke:white;stroke-width:2px}path.svelte-7q6uh5:hover{fill:pink}path.active.svelte-7q6uh5:hover{fill:pink}path.active.svelte-7q6uh5{fill:#313131}",
map: '{"version":3,"file":"Arc.svelte","sources":["Arc.svelte"],"sourcesContent":["<script>\\nexport let arc;\\nexport let radius;\\nexport let active = false;\\n\\nconst rotation = {\\n F: 0,\\n FS: 300,\\n AS: 240,\\n A: 180,\\n AP: 120,\\n FP: 60,\\n};\\n\\nlet y, x_delta;\\n$: y = Math.round( radius * ( 1 - Math.sin(60/180*Math.PI) ) );\\n$: x_delta = Math.round( radius*Math.cos(60/180*Math.PI) );\\n\\nlet path;\\n$: path = `M ${radius},${radius} L ${radius-x_delta},${y} A ${radius},${radius} 0 0 1 ${radius+x_delta},${y} Z`;\\n\\nlet transform;\\n$: transform = `rotate(${rotation[arc]},${radius},${radius})`\\n\\n</script>\\n\\n <g { transform }>\\n <path d={path} class:active on:click />\\n </g>\\n\\n<style>\\npath {\\n fill: lightgrey;\\n stroke: white;\\n stroke-width: 2px;\\n}\\n\\npath:hover {\\n fill: pink;\\n}\\n\\npath.active:hover {\\n fill: pink;\\n}\\n\\npath.active {\\n fill: #313131;\\n}\\n</style>\\n\\n"],"names":[],"mappings":"AA+BA,IAAI,cAAC,CAAC,AACF,IAAI,CAAE,SAAS,CACf,MAAM,CAAE,KAAK,CACb,YAAY,CAAE,GAAG,AACrB,CAAC,AAED,kBAAI,MAAM,AAAC,CAAC,AACR,IAAI,CAAE,IAAI,AACd,CAAC,AAED,IAAI,qBAAO,MAAM,AAAC,CAAC,AACf,IAAI,CAAE,IAAI,AACd,CAAC,AAED,IAAI,OAAO,cAAC,CAAC,AACT,IAAI,CAAE,OAAO,AACjB,CAAC"}'
};
const Arc = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {arc} = $$props;
let {radius} = $$props;
let {active = false} = $$props;
const rotation = {
F: 0,
FS: 300,
AS: 240,
A: 180,
AP: 120,
FP: 60
};
let y, x_delta;
let path;
let transform;
if ($$props.arc === void 0 && $$bindings.arc && arc !== void 0)
$$bindings.arc(arc);
if ($$props.radius === void 0 && $$bindings.radius && radius !== void 0)
$$bindings.radius(radius);
if ($$props.active === void 0 && $$bindings.active && active !== void 0)
$$bindings.active(active);
$$result.css.add(css$n);
y = Math.round(radius * (1 - Math.sin(60 / 180 * Math.PI)));
x_delta = Math.round(radius * Math.cos(60 / 180 * Math.PI));
path = `M ${radius},${radius} L ${radius - x_delta},${y} A ${radius},${radius} 0 0 1 ${radius + x_delta},${y} Z`;
transform = `rotate(${rotation[arc]},${radius},${radius})`;
return `<g${add_attribute("transform", transform, 0)}><path${add_attribute("d", path, 0)} class="${["svelte-7q6uh5", active ? "active" : ""].join(" ").trim()}"></path></g>`;
});
var index_svelte_svelte_type_style_lang$i = "circle.svelte-qqgo8u{fill:white}";
const css$m = {
code: "circle.svelte-qqgo8u{fill:white}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["\\n<svg width=\\"{size}px\\" height=\\"{size}px\\">\\n{#each all_arcs as arc (arc)}\\n <Arc {arc} radius={size/2}\\n active={selected.includes(arc)}\\n on:click={()=>click_arc(arc)}\\n />\\n{/each}\\n <circle cx=\\"50%\\" cy=\\"50%\\" r={size /3} />\\n <slot />\\n</svg>\\n\\n<script>\\n import Arc from '../../Weapons/Arc.svelte';\\n import { createEventDispatcher } from 'svelte';\\n\\n const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];\\n\\n export let selected = [];\\n export let size = 60;\\n\\n const dispatch = createEventDispatcher();\\n\\n const click_arc = arc => dispatch('click_arc',arc);\\n\\n</script>\\n\\n<style>\\ncircle {\\n fill: white;\\n}\\n</style>\\n"],"names":[],"mappings":"AA4BA,MAAM,cAAC,CAAC,AACJ,IAAI,CAAE,KAAK,AACf,CAAC"}`
};
const Arcs = create_ssr_component(($$result, $$props, $$bindings, slots) => {
const all_arcs = ["FS", "F", "FP", "AP", "A", "AS"];
let {selected = []} = $$props;
let {size = 60} = $$props;
createEventDispatcher();
if ($$props.selected === void 0 && $$bindings.selected && selected !== void 0)
$$bindings.selected(selected);
if ($$props.size === void 0 && $$bindings.size && size !== void 0)
$$bindings.size(size);
$$result.css.add(css$m);
return `<svg width="${escape(size) + "px"}" height="${escape(size) + "px"}">${each(all_arcs, (arc) => `${validate_component(Arc, "Arc").$$render($$result, {
arc,
radius: size / 2,
active: selected.includes(arc)
}, {}, {})}`)}<circle cx="${"50%"}" cy="${"50%"}"${add_attribute("r", size / 3, 0)} class="${"svelte-qqgo8u"}"></circle>${slots.default ? slots.default({}) : ``}</svg>`;
});
var index_svelte_svelte_type_style_lang$h = "div.svelte-1u8rlr5 path:hover{fill:white}div.svelte-1u8rlr5 path.active:hover{fill:black}text.svelte-1u8rlr5{text-anchor:middle;dominant-baseline:central;font-size:var(--font-scale-10)}";
const css$l = {
code: "div.svelte-1u8rlr5 path:hover{fill:white}div.svelte-1u8rlr5 path.active:hover{fill:black}text.svelte-1u8rlr5{text-anchor:middle;dominant-baseline:central;font-size:var(--font-scale-10)}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n <Arcs selected={arcs} size=\\"40\\">\\n <text x=\\"50%\\" y=\\"50%\\" >\\n {weapon_class}\\n </text>\\n </Arcs>\\n</div>\\n\\n<script>\\n import Arcs from '$lib/components/Weapon/Arcs/index.svelte';\\n export let weapon_class = 1;\\n export let arcs = [];\\n</script>\\n\\n<style>\\n div :global(path) {\\n }\\n div :global(path:hover) {\\n fill: white;\\n }\\n div :global(path.active:hover) {\\n fill: black;\\n }\\n text {\\n text-anchor: middle;\\n dominant-baseline: central;\\n font-size: var(--font-scale-10);\\n }\\n</style>\\n"],"names":[],"mappings":"AAiBE,kBAAG,CAAC,AAAQ,UAAU,AAAE,CAAC,AACvB,IAAI,CAAE,KAAK,AACb,CAAC,AACD,kBAAG,CAAC,AAAQ,iBAAiB,AAAE,CAAC,AAC9B,IAAI,CAAE,KAAK,AACb,CAAC,AACD,IAAI,eAAC,CAAC,AACJ,WAAW,CAAE,MAAM,CACnB,iBAAiB,CAAE,OAAO,CAC1B,SAAS,CAAE,IAAI,eAAe,CAAC,AACjC,CAAC"}`
};
const Beam$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {weapon_class = 1} = $$props;
let {arcs = []} = $$props;
if ($$props.weapon_class === void 0 && $$bindings.weapon_class && weapon_class !== void 0)
$$bindings.weapon_class(weapon_class);
if ($$props.arcs === void 0 && $$bindings.arcs && arcs !== void 0)
$$bindings.arcs(arcs);
$$result.css.add(css$l);
return `<div class="${"svelte-1u8rlr5"}">${validate_component(Arcs, "Arcs").$$render($$result, {selected: arcs, size: "40"}, {}, {
default: () => `<text x="${"50%"}" y="${"50%"}" class="${"svelte-1u8rlr5"}">${escape(weapon_class)}</text>`
})}
</div>`;
});
var index_svelte_svelte_type_style_lang$g = "div.svelte-18nuiwu{margin-bottom:2em}.beams.svelte-18nuiwu{display:flex;justify-content:space-evenly}";
const css$k = {
code: "div.svelte-18nuiwu{margin-bottom:2em}.beams.svelte-18nuiwu{display:flex;justify-content:space-evenly}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div class=\\"weapons\\">\\n\\n <div class=\\"beams\\">\\n {#each beams as beam}\\n <Beam {...beam} />\\n {/each}\\n </div>\\n\\n\\n</div>\\n\\n<script>\\n import Beam from './Beam/index.svelte';\\n export let weapons = [];\\n\\n let beams = [];\\n $: beams = weapons.filter( ({ weapon_type }) => weapon_type === 'beam' );\\n\\n</script>\\n\\n<style>\\n div {\\n margin-bottom: 2em;\\n }\\n .beams {\\n display: flex;\\n justify-content: space-evenly;\\n }\\n</style>\\n"],"names":[],"mappings":"AAqBE,GAAG,eAAC,CAAC,AACH,aAAa,CAAE,GAAG,AACpB,CAAC,AACD,MAAM,eAAC,CAAC,AACN,OAAO,CAAE,IAAI,CACb,eAAe,CAAE,YAAY,AAC/B,CAAC"}`
};
const Weapons = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {weapons: weapons2 = []} = $$props;
let beams = [];
if ($$props.weapons === void 0 && $$bindings.weapons && weapons2 !== void 0)
$$bindings.weapons(weapons2);
$$result.css.add(css$k);
beams = weapons2.filter(({weapon_type}) => weapon_type === "beam");
return `<div class="${"weapons svelte-18nuiwu"}"><div class="${"beams svelte-18nuiwu"}">${each(beams, (beam) => `${validate_component(Beam$1, "Beam").$$render($$result, Object.assign(beam), {}, {})}`)}</div>
</div>`;
});
var index_svelte_svelte_type_style_lang$f = "div.svelte-10x4b15{display:flex;gap:0.5em}img.firecon.svelte-10x4b15{width:1em}";
const css$j = {
code: "div.svelte-10x4b15{display:flex;gap:0.5em}img.firecon.svelte-10x4b15{width:1em}",
map: '{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":[" <div>\\n {#each _.range(firecons) as firecon }\\n <img class=\\"firecon\\" src=\\"icons/firecon.svg\\" alt=\\"firecon\\" />\\n {/each}\\n </div>\\n\\n <script>\\n export let firecons = 0;\\n </script>\\n\\n <style>\\n div {\\n display: flex;\\n gap: 0.5em;\\n }\\n img.firecon {\\n width: 1em;\\n }\\n</style>\\n"],"names":[],"mappings":"AAWI,GAAG,eAAC,CAAC,AACH,OAAO,CAAE,IAAI,CACb,GAAG,CAAE,KAAK,AACZ,CAAC,AACH,GAAG,QAAQ,eAAC,CAAC,AACX,KAAK,CAAE,GAAG,AACZ,CAAC"}'
};
const Firecons$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {firecons = 0} = $$props;
if ($$props.firecons === void 0 && $$bindings.firecons && firecons !== void 0)
$$bindings.firecons(firecons);
$$result.css.add(css$j);
return `<div class="${"svelte-10x4b15"}">${each(_.range(firecons), (firecon) => `<img class="${"firecon svelte-10x4b15"}" src="${"icons/firecon.svg"}" alt="${"firecon"}">`)}
</div>`;
});
var index_svelte_svelte_type_style_lang$e = "img.svelte-kh7po5{width:1em}div.svelte-kh7po5{display:flex;gap:0.5em}";
const css$i = {
code: "img.svelte-kh7po5{width:1em}div.svelte-kh7po5{display:flex;gap:0.5em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n {#each _.range(standard) as i }\\n <img src=\\"icons/screen.svg\\" alt=\\"screen\\" />\\n {/each}\\n {#each _.range(advanced) as i }\\n <img src=\\"icons/screen-advanced.svg\\" alt=\\"advanced screen\\" />\\n {/each}\\n\\n</div>\\n\\n<script>\\n import _ from 'lodash';\\n\\n export let standard = 0;\\n export let advanced = 0;\\n</script>\\n\\n<style>\\n img {\\n width: 1em;\\n }\\n div {\\n display: flex;\\n gap: 0.5em;\\n }\\n</style>\\n"],"names":[],"mappings":"AAkBE,GAAG,cAAC,CAAC,AACH,KAAK,CAAE,GAAG,AACZ,CAAC,AACD,GAAG,cAAC,CAAC,AACH,OAAO,CAAE,IAAI,CACb,GAAG,CAAE,KAAK,AACZ,CAAC"}`
};
const Screens$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {standard = 0} = $$props;
let {advanced = 0} = $$props;
if ($$props.standard === void 0 && $$bindings.standard && standard !== void 0)
$$bindings.standard(standard);
if ($$props.advanced === void 0 && $$bindings.advanced && advanced !== void 0)
$$bindings.advanced(advanced);
$$result.css.add(css$i);
return `<div class="${"svelte-kh7po5"}">${each(_$1.range(standard), (i) => `<img src="${"icons/screen.svg"}" alt="${"screen"}" class="${"svelte-kh7po5"}">`)}
${each(_$1.range(advanced), (i) => `<img src="${"icons/screen-advanced.svg"}" alt="${"advanced screen"}" class="${"svelte-kh7po5"}">`)}
</div>`;
});
var index_svelte_svelte_type_style_lang$d = "div.svelte-ytgy37{text-align:center;flex:1;display:flex;flex-direction:column;align-items:center}div.svelte-ytgy37>*{margin-bottom:1em}";
const css$h = {
code: "div.svelte-ytgy37{text-align:center;flex:1;display:flex;flex-direction:column;align-items:center}div.svelte-ytgy37>*{margin-bottom:1em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n <Firecons {firecons}/>\\n\\n <Screens {...screens} />\\n</div>\\n\\n<script>\\n import Firecons from './Firecons/index.svelte';\\n import Screens from './Screens/index.svelte';\\n\\n export let firecons = 0;\\n export let screens = {};\\n\\n</script>\\n\\n<style>\\n div {\\n text-align: center;\\n flex: 1;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n }\\n div > :global(*) {\\n margin-bottom: 1em;\\n\\n }\\n </style>\\n"],"names":[],"mappings":"AAgBE,GAAG,cAAC,CAAC,AACH,UAAU,CAAE,MAAM,CAClB,IAAI,CAAE,CAAC,CACP,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,MAAM,CACtB,WAAW,CAAE,MAAM,AACrB,CAAC,AACD,iBAAG,CAAW,CAAC,AAAE,CAAC,AAChB,aAAa,CAAE,GAAG,AAEpB,CAAC"}`
};
const Systems = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {firecons = 0} = $$props;
let {screens: screens2 = {}} = $$props;
if ($$props.firecons === void 0 && $$bindings.firecons && firecons !== void 0)
$$bindings.firecons(firecons);
if ($$props.screens === void 0 && $$bindings.screens && screens2 !== void 0)
$$bindings.screens(screens2);
$$result.css.add(css$h);
return `<div class="${"svelte-ytgy37"}">${validate_component(Firecons$1, "Firecons").$$render($$result, {firecons}, {}, {})}
${validate_component(Screens$1, "Screens").$$render($$result, Object.assign(screens2), {}, {})}
</div>`;
});
var index_svelte_svelte_type_style_lang$c = ".ship-sheet.svelte-5wh1p{width:4.25in;height:5.5in;border:1px solid black;padding:1em}.section-2.svelte-5wh1p{display:flex;align-items:start}";
const css$g = {
code: ".ship-sheet.svelte-5wh1p{width:4.25in;height:5.5in;border:1px solid black;padding:1em}.section-2.svelte-5wh1p{display:flex;align-items:start}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<aside class=\\"ship-sheet\\" transition:fade>\\n <Identification {...ship.general} />\\n\\n <Weapons weapons={ship.weaponry.weapons} />\\n\\n <div class=\\"section-2\\">\\n <Hull structure={ship.structure}\\n ship_mass={ship.general.mass} />\\n\\n <Systems\\n firecons={ship.weaponry.firecons.nbr}\\n screens={ship.structure.screens}\\n />\\n</div>\\n\\n <MainSystems\\n ftl={ship.ftl.type}\\n engine={ship.engine.rating}\\n />\\n\\n</aside>\\n\\n<script>\\n import _ from 'lodash';\\n\\n import Identification from './Identification/index.svelte';\\n import MainSystems from './MainSystems/index.svelte';\\n import Hull from './Hull/index.svelte';\\n import Weapons from './Weapons/index.svelte';\\n import Systems from './Systems/index.svelte';\\n\\n export let ship;\\n\\n import { fly, fade } from 'svelte/transition';\\n\\n</script>\\n\\n<style>\\n.ship-sheet {\\n width: 4.25in;\\n height: 5.5in;\\n border: 1px solid black;\\n padding: 1em;\\n}\\n\\n.section-2 {\\n display: flex;\\n align-items: start;\\n}\\n\\n\\n\\n</style>\\n"],"names":[],"mappings":"AAsCA,WAAW,aAAC,CAAC,AACX,KAAK,CAAE,MAAM,CACb,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CACvB,OAAO,CAAE,GAAG,AACd,CAAC,AAED,UAAU,aAAC,CAAC,AACV,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,KAAK,AACpB,CAAC"}`
};
create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ship} = $$props;
if ($$props.ship === void 0 && $$bindings.ship && ship !== void 0)
$$bindings.ship(ship);
$$result.css.add(css$g);
return `<aside class="${"ship-sheet svelte-5wh1p"}">${validate_component(Identification$1, "Identification").$$render($$result, Object.assign(ship.general), {}, {})}
${validate_component(Weapons, "Weapons").$$render($$result, {weapons: ship.weaponry.weapons}, {}, {})}
<div class="${"section-2 svelte-5wh1p"}">${validate_component(Hull$1, "Hull").$$render($$result, {
structure: ship.structure,
ship_mass: ship.general.mass
}, {}, {})}
${validate_component(Systems, "Systems").$$render($$result, {
firecons: ship.weaponry.firecons.nbr,
screens: ship.structure.screens
}, {}, {})}</div>
${validate_component(MainSystems, "MainSystems").$$render($$result, {
ftl: ship.ftl.type,
engine: ship.engine.rating
}, {}, {})}
</aside>`;
});
var index_svelte_svelte_type_style_lang$b = "div.svelte-1urp5hr>*{margin-left:1em}div.svelte-1urp5hr>label.svelte-1urp5hr{margin-left:0em}label.svelte-1urp5hr.svelte-1urp5hr{font-size:var(--font-scale-8);font-weight:lighter;font-family:Dosis;color:var(--indigo-dye)}";
const css$f = {
code: "div.svelte-1urp5hr>*{margin-left:1em}div.svelte-1urp5hr>label.svelte-1urp5hr{margin-left:0em}label.svelte-1urp5hr.svelte-1urp5hr{font-size:var(--font-scale-8);font-weight:lighter;font-family:Dosis;color:var(--indigo-dye)}",
map: '{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n{#if label}\\n<label>{label}</label>\\n{/if}\\n<slot>\\n<input type=\\"text\\" {placeholder} {value} on:change />\\n</slot>\\n</div>\\n\\n<script>\\n export let label = \\"\\";\\n export let value = \\"\\";\\n export let placeholder;\\n</script>\\n\\n<style>\\n div > :global(*) {\\n margin-left: 1em;\\n }\\n div > label {\\n margin-left: 0em;\\n }\\nlabel {\\n font-size: var(--font-scale-8);\\n font-weight: lighter;\\n font-family: Dosis;\\n color: var(--indigo-dye);\\n}\\n</style>\\n"],"names":[],"mappings":"AAgBE,kBAAG,CAAW,CAAC,AAAE,CAAC,AAChB,WAAW,CAAE,GAAG,AAClB,CAAC,AACD,kBAAG,CAAG,KAAK,eAAC,CAAC,AACX,WAAW,CAAE,GAAG,AAClB,CAAC,AACH,KAAK,8BAAC,CAAC,AACH,SAAS,CAAE,IAAI,cAAc,CAAC,CAC9B,WAAW,CAAE,OAAO,CACpB,WAAW,CAAE,KAAK,CAClB,KAAK,CAAG,IAAI,YAAY,CAAC,AAC7B,CAAC"}'
};
const Field = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {label = ""} = $$props;
let {value = ""} = $$props;
let {placeholder} = $$props;
if ($$props.label === void 0 && $$bindings.label && label !== void 0)
$$bindings.label(label);
if ($$props.value === void 0 && $$bindings.value && value !== void 0)
$$bindings.value(value);
if ($$props.placeholder === void 0 && $$bindings.placeholder && placeholder !== void 0)
$$bindings.placeholder(placeholder);
$$result.css.add(css$f);
return `<div class="${"svelte-1urp5hr"}">${label ? `<label class="${"svelte-1urp5hr"}">${escape(label)}</label>` : ``}
${slots.default ? slots.default({}) : `
<input type="${"text"}"${add_attribute("placeholder", placeholder, 0)}${add_attribute("value", value, 0)}>
`}
</div>`;
});
var Identification_svelte_svelte_type_style_lang = "div.svelte-fc2507{display:flex;align-items:end;gap:2em}";
const css$e = {
code: "div.svelte-fc2507{display:flex;align-items:end;gap:2em}",
map: `{"version":3,"file":"Identification.svelte","sources":["Identification.svelte"],"sourcesContent":["<div>\\n <Field label=\\"ship class\\" value={general.ship_class}\\n on:change={change_class} />\\n\\n <Field label=\\"ship type\\">\\n <select value={ship_type} on:change={change_ship_type}>\\n {#each ship_types as type (type)}\\n <option>{type}</option>\\n {/each}\\n </select>\\n </Field>\\n</div>\\n\\n<script>\\n import { getContext } from 'svelte';\\n\\n import Field from '$lib/components/Field/index.svelte';\\n import { candidate_ship_types } from '../../dux/ship_types';\\n\\n export let ship = getContext('ship');\\n let general;\\n $: general = $ship.general;\\n\\n const change_class = (event) => ship.dispatch(\\n ship.actions.set_ship_class(event.target.value)\\n );\\n\\n let ship_type;\\n $: ship_type = $ship.general.ship_type;\\n\\n const change_ship_type = ({ target: {value}}) =>\\n ship.dispatch.set_ship_type(value);\\n\\n let ship_types;\\n $: ship_types = candidate_ship_types($ship.general.mass,$ship.carrier.bays>0).map(\\n ({name}) => name\\n );\\n\\n</script>\\n\\n<style>\\n div {\\n display: flex;\\n align-items: end;\\n gap: 2em;\\n }\\n</style>\\n"],"names":[],"mappings":"AAyCE,GAAG,cAAC,CAAC,AACH,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,GAAG,CAChB,GAAG,CAAE,GAAG,AACV,CAAC"}`
};
const Identification = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $ship, $$unsubscribe_ship;
let {ship = getContext("ship")} = $$props;
$$unsubscribe_ship = subscribe(ship, (value) => $ship = value);
let general;
let ship_type;
let ship_types2;
if ($$props.ship === void 0 && $$bindings.ship && ship !== void 0)
$$bindings.ship(ship);
$$result.css.add(css$e);
general = $ship.general;
ship_type = $ship.general.ship_type;
ship_types2 = candidate_ship_types($ship.general.mass, $ship.carrier.bays > 0).map(({name}) => name);
$$unsubscribe_ship();
return `<div class="${"svelte-fc2507"}">${validate_component(Field, "Field").$$render($$result, {
label: "ship class",
value: general.ship_class
}, {}, {})}
${validate_component(Field, "Field").$$render($$result, {label: "ship type"}, {}, {
default: () => `<select${add_attribute("value", ship_type, 0)}>${each(ship_types2, (type) => `<option${add_attribute("value", type, 0)}>${escape(type)}</option>`)}</select>`
})}
</div>`;
});
var ShipCost_svelte_svelte_type_style_lang = "input.svelte-15yh1sv{width:5em}.mass_symbol.svelte-15yh1sv:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}.warning.svelte-15yh1sv{color:red}.note.svelte-15yh1sv{font-size:smaller}.mass.svelte-15yh1sv,div.cost.svelte-15yh1sv{padding:0px 2em;justify-self:right}.mass.svelte-15yh1sv{grid-column:2}div.cost.svelte-15yh1sv{grid-column:3}span.cost.svelte-15yh1sv:after{content:'\\00A4';margin-left:0.5em}";
const css$d = {
code: "input.svelte-15yh1sv{width:5em}.mass_symbol.svelte-15yh1sv:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}.warning.svelte-15yh1sv{color:red}.note.svelte-15yh1sv{font-size:smaller}.mass.svelte-15yh1sv,div.cost.svelte-15yh1sv{padding:0px 2em;justify-self:right}.mass.svelte-15yh1sv{grid-column:2}div.cost.svelte-15yh1sv{grid-column:3}span.cost.svelte-15yh1sv:after{content:'\\00A4';margin-left:0.5em}",
map: `{"version":3,"file":"ShipCost.svelte","sources":["ShipCost.svelte"],"sourcesContent":["<div class=\\"mass\\">\\n <Field label=\\"ship tonnage\\">\\n <input\\n value={$ship.general.mass}\\n on:change={change_tonnage}\\n type=\\"number\\"\\n min=\\"10\\"\\n max=\\"300\\" />\\n <span class=\\"mass_symbol\\"></span>\\n\\n <div class=\\"note\\" class:warning={!within_budget}>\\n {#if within_budget}\\n mass unused: {mass_unused}\\n {:else}excessive mass: {-mass_unused}{/if}\\n </div>\\n </Field>\\n</div>\\n\\n<div class=\\"cost\\">\\n <Field label=\\"cost\\">\\n <span class=\\"cost\\">{$ship.general.cost}</span></Field>\\n</div>\\n\\n<script>\\n import { getContext } from \\"svelte\\";\\n import Field from \\"$lib/components/Field/index.svelte\\";\\n\\n export let ship = getContext(\\"ship\\");\\n\\n const change_tonnage = ({ target: { value } }) =>\\n ship.dispatch(ship.actions.set_ship_mass(parseInt(value)));\\n\\n let mass_unused;\\n $: mass_unused = $ship.general.mass - $ship.general.used_mass;\\n\\n let within_budget = true;\\n\\n $: within_budget = mass_unused >= 0;\\n</script>\\n\\n<style>\\n .ship_cost {\\n display: flex;\\n grid-column: span 3;\\n justify-content: space-around;\\n }\\n input {\\n width: 5em;\\n }\\n .mass_symbol:after {\\n content: url(mass.svg);\\n width: 0.75em;\\n display: inline-block;\\n margin-left: 0.5em;\\n }\\n .warning {\\n color: red;\\n }\\n .note {\\n font-size: smaller;\\n }\\n\\n .mass,div.cost {\\n padding: 0px 2em; justify-self: right;\\n }\\n\\n .mass {\\n grid-column: 2;\\n }\\n div.cost {\\n grid-column: 3;\\n }\\n span.cost:after {\\n content: '\\\\00A4';\\n margin-left: 0.5em;\\n }\\n</style>\\n"],"names":[],"mappings":"AA8CE,KAAK,eAAC,CAAC,AACL,KAAK,CAAE,GAAG,AACZ,CAAC,AACD,2BAAY,MAAM,AAAC,CAAC,AAClB,OAAO,CAAE,IAAI,QAAQ,CAAC,CACtB,KAAK,CAAE,MAAM,CACb,OAAO,CAAE,YAAY,CACrB,WAAW,CAAE,KAAK,AACpB,CAAC,AACD,QAAQ,eAAC,CAAC,AACR,KAAK,CAAE,GAAG,AACZ,CAAC,AACD,KAAK,eAAC,CAAC,AACL,SAAS,CAAE,OAAO,AACpB,CAAC,AAED,oBAAK,CAAC,GAAG,KAAK,eAAC,CAAC,AACd,OAAO,CAAE,GAAG,CAAC,GAAG,CAAE,YAAY,CAAE,KAAK,AACvC,CAAC,AAED,KAAK,eAAC,CAAC,AACL,WAAW,CAAE,CAAC,AAChB,CAAC,AACD,GAAG,KAAK,eAAC,CAAC,AACR,WAAW,CAAE,CAAC,AAChB,CAAC,AACD,IAAI,oBAAK,MAAM,AAAC,CAAC,AACf,OAAO,CAAE,OAAO,CAChB,WAAW,CAAE,KAAK,AACpB,CAAC"}`
};
const ShipCost = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $ship, $$unsubscribe_ship;
let {ship = getContext("ship")} = $$props;
$$unsubscribe_ship = subscribe(ship, (value) => $ship = value);
let mass_unused;
let within_budget = true;
if ($$props.ship === void 0 && $$bindings.ship && ship !== void 0)
$$bindings.ship(ship);
$$result.css.add(css$d);
mass_unused = $ship.general.mass - $ship.general.used_mass;
within_budget = mass_unused >= 0;
$$unsubscribe_ship();
return `<div class="${"mass svelte-15yh1sv"}">${validate_component(Field, "Field").$$render($$result, {label: "ship tonnage"}, {}, {
default: () => `<input${add_attribute("value", $ship.general.mass, 0)} type="${"number"}" min="${"10"}" max="${"300"}" class="${"svelte-15yh1sv"}">
<span class="${"mass_symbol svelte-15yh1sv"}"></span>
<div class="${["note svelte-15yh1sv", !within_budget ? "warning" : ""].join(" ").trim()}">${within_budget ? `mass unused: ${escape(mass_unused)}` : `excessive mass: ${escape(-mass_unused)}`}</div>`
})}</div>
<div class="${"cost svelte-15yh1sv"}">${validate_component(Field, "Field").$$render($$result, {label: "cost"}, {}, {
default: () => `<span class="${"cost svelte-15yh1sv"}">${escape($ship.general.cost)}</span>`
})}
</div>`;
});
const ShipSpecs = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `${validate_component(Identification, "Identification").$$render($$result, {}, {}, {})}
${validate_component(ShipCost, "ShipCost").$$render($$result, {}, {}, {})}`;
});
var Notes_svelte_svelte_type_style_lang = "aside.svelte-16mfw8u{background-color:rgb(254, 218, 184);position:absolute;height:20em;max-width:50%;z-index:200;padding:1em;border:3px solid var(--indigo-dye);border-radius:1em;left:0px;border-left:0px;border-top-left-radius:0;border-bottom-left-radius:0;top:6em;font-size:var(--font-scale-11)}h3.svelte-16mfw8u{text-align:center;margin:0px}div.svelte-16mfw8u{text-align:right}";
const css$c = {
code: "aside.svelte-16mfw8u{background-color:rgb(254, 218, 184);position:absolute;height:20em;max-width:50%;z-index:200;padding:1em;border:3px solid var(--indigo-dye);border-radius:1em;left:0px;border-left:0px;border-top-left-radius:0;border-bottom-left-radius:0;top:6em;font-size:var(--font-scale-11)}h3.svelte-16mfw8u{text-align:center;margin:0px}div.svelte-16mfw8u{text-align:right}",
map: `{"version":3,"file":"Notes.svelte","sources":["Notes.svelte"],"sourcesContent":[" <aside transition:fly={{x: -800, opacity: 1}}>\\n <div>\\n <input type=\\"button\\" class=\\"button small red\\" value=\\"close\\"\\n on:click={close}/>\\n </div>\\n <h3>welcome to the docks</h3>\\n\\n <p>\\n This app is a ship builder for the game\\n <a href=\\"https://shop.groundzerogames.co.uk/rules.html\\">Full Thrust</a>\\n .\\n </p>\\n\\n <p>\\n The app, beside any exception mentioned here, is trying to follow the\\n <a href=\\"http://members.ozemail.com.au/~laranzu/fullthrust/rules/\\">\\n Cross Dimensions rules\\n </a>\\n as closely as possible.\\n </p>\\n\\n\\n <p>The app is mostly developed for Firefox. I also check as much as I\\n can that I don't mess things too badly on Chrome. For the other\\n browsers... caveat emptor.</p>\\n\\n <p>\\n Written by\\n <a href=\\"https://twitter.com/yenzie\\">Yanick Champoux</a>\\n . Code available on\\n <a href=\\"https://github.com/yanick/aotds-shipyard\\">Github</a>\\n </p>\\n </aside>\\n\\n <script>\\n import { fly } from 'svelte/transition';\\n import {createEventDispatcher} from 'svelte';\\n\\n const dispatch = createEventDispatcher();\\n const close = () => dispatch('close');\\n </script>\\n\\n<style>\\n aside {\\n background-color: rgb(254, 218, 184);\\n position: absolute;\\n height: 20em;\\n max-width: 50%;\\n z-index: 200;\\n\\n padding: 1em;\\n border: 3px solid var(--indigo-dye);\\n border-radius: 1em;\\n left: 0px;\\n border-left: 0px;\\n border-top-left-radius: 0;\\n border-bottom-left-radius: 0;\\n top: 6em;\\n font-size: var(--font-scale-11);\\n }\\n\\n h3 {\\n text-align: center;\\n margin: 0px;\\n }\\n div {\\n text-align: right;\\n }\\n</style>\\n"],"names":[],"mappings":"AA2CE,KAAK,eAAC,CAAC,AACL,gBAAgB,CAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CACpC,QAAQ,CAAE,QAAQ,CAClB,MAAM,CAAE,IAAI,CACZ,SAAS,CAAE,GAAG,CACd,OAAO,CAAE,GAAG,CAEZ,OAAO,CAAE,GAAG,CACZ,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,CACnC,aAAa,CAAE,GAAG,CAClB,IAAI,CAAE,GAAG,CACT,WAAW,CAAE,GAAG,CAChB,sBAAsB,CAAE,CAAC,CACzB,yBAAyB,CAAE,CAAC,CAC5B,GAAG,CAAE,GAAG,CACR,SAAS,CAAE,IAAI,eAAe,CAAC,AACjC,CAAC,AAED,EAAE,eAAC,CAAC,AACF,UAAU,CAAE,MAAM,CAClB,MAAM,CAAE,GAAG,AACb,CAAC,AACD,GAAG,eAAC,CAAC,AACL,UAAU,CAAE,KAAK,AACjB,CAAC"}`
};
create_ssr_component(($$result, $$props, $$bindings, slots) => {
createEventDispatcher();
$$result.css.add(css$c);
return `<aside class="${"svelte-16mfw8u"}"><div class="${"svelte-16mfw8u"}"><input type="${"button"}" class="${"button small red"}" value="${"close"}"></div>
<h3 class="${"svelte-16mfw8u"}">welcome to the docks</h3>
<p>This app is a ship builder for the game
<a href="${"https://shop.groundzerogames.co.uk/rules.html"}">Full Thrust</a>
.
</p>
<p>The app, beside any exception mentioned here, is trying to follow the
<a href="${"http://members.ozemail.com.au/~laranzu/fullthrust/rules/"}">Cross Dimensions rules
</a>
as closely as possible.
</p>
<p>The app is mostly developed for Firefox. I also check as much as I
can that I don&#39;t mess things too badly on Chrome. For the other
browsers... caveat emptor.</p>
<p>Written by
<a href="${"https://twitter.com/yenzie"}">Yanick Champoux</a>
. Code available on
<a href="${"https://github.com/yanick/aotds-shipyard"}">Github</a></p>
</aside>`;
});
var index_svelte_svelte_type_style_lang$a = "div.svelte-14c1p7f{margin-bottom:1em}.cost.svelte-14c1p7f,.mass.svelte-14c1p7f{padding:0px 2em;text-align:right}.cost.svelte-14c1p7f{grid-column:3 }.mass.svelte-14c1p7f{grid-column:2 }.cost.svelte-14c1p7f:after{content:'\\00A4';margin-left:0.5em}.mass.svelte-14c1p7f:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}.updated{animation-name:svelte-14c1p7f-update;animation-duration:1.5s;animation-fill-mode:forwards}@keyframes svelte-14c1p7f-update{0%{color:inherit;font-weight:inherit}20%{color:red;font-weight:bold}80%{color:red;font-weight:bold}100%{color:inherit;font-weight:inherit}}";
const css$b = {
code: "div.svelte-14c1p7f{margin-bottom:1em}.cost.svelte-14c1p7f,.mass.svelte-14c1p7f{padding:0px 2em;text-align:right}.cost.svelte-14c1p7f{grid-column:3 }.mass.svelte-14c1p7f{grid-column:2 }.cost.svelte-14c1p7f:after{content:'\\00A4';margin-left:0.5em}.mass.svelte-14c1p7f:after{content:url(mass.svg);width:0.75em;display:inline-block;margin-left:0.5em}.updated{animation-name:svelte-14c1p7f-update;animation-duration:1.5s;animation-fill-mode:forwards}@keyframes svelte-14c1p7f-update{0%{color:inherit;font-weight:inherit}20%{color:red;font-weight:bold}80%{color:red;font-weight:bold}100%{color:inherit;font-weight:inherit}}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":[" <div><slot /></div>\\n\\n <div class=\\"mass\\" bind:this={mass_el}>{ mass }</div>\\n <div class=\\"cost\\" bind:this={cost_el}>{ cost }</div>\\n\\n<script>\\n import { tick } from 'svelte';\\n\\n export let mass;\\n export let cost;\\n\\n let mass_el;\\n let cost_el;\\n\\n const update_el = async (el) => {\\n if(!el) return;\\n el.classList.remove('updated');\\n void el.offsetWidth;\\n el.classList.add('updated');\\n }\\n\\n $: update_el( mass_el, mass );\\n $: update_el( cost_el, cost );\\n\\n</script>\\n\\n<style>\\n div {\\n margin-bottom: 1em;\\n\\n }\\n .cost,.mass { padding: 0px 2em; text-align: right; }\\n .cost { grid-column: 3 }\\n .mass { grid-column: 2 }\\n\\n .ship-item {\\n display: flex;\\n }\\n\\n .ship-item :global(> *) {\\n flex: 1;\\n }\\n\\n img {\\n width: 0.75em;\\n }\\n .cost:after { content: '\\\\00A4'; margin-left: 0.5em; }\\n .mass:after { content: url(mass.svg); width: 0.75em; display:\\n inline-block; margin-left: 0.5em; }\\n\\n :global(.updated) {\\n animation-name: update;\\n animation-duration: 1.5s;\\n animation-fill-mode: forwards;\\n }\\n\\n@keyframes update {\\n 0% {color:inherit; font-weight: inherit;}\\n 20% {color:red; font-weight: bold;}\\n 80% {color:red; font-weight: bold;}\\n 100% {color:inherit; font-weight: inherit; }\\n}\\n\\n</style>\\n"],"names":[],"mappings":"AA2BE,GAAG,eAAC,CAAC,AACH,aAAa,CAAE,GAAG,AAEpB,CAAC,AACD,oBAAK,CAAC,KAAK,eAAC,CAAC,AAAC,OAAO,CAAE,GAAG,CAAC,GAAG,CAAG,UAAU,CAAE,KAAK,AAAE,CAAC,AACrD,KAAK,eAAC,CAAC,AAAC,WAAW,CAAE,CAAC,CAAC,CAAC,AACxB,KAAK,eAAC,CAAC,AAAC,WAAW,CAAE,CAAC,CAAC,CAAC,AAaxB,oBAAK,MAAM,AAAC,CAAC,AAAC,OAAO,CAAE,OAAO,CAAE,WAAW,CAAE,KAAK,AAAE,CAAC,AACrD,oBAAK,MAAM,AAAC,CAAC,AAAC,OAAO,CAAE,IAAI,QAAQ,CAAC,CAAE,KAAK,CAAE,MAAM,CAAE,OAAO,CAC5D,YAAY,CAAE,WAAW,CAAE,KAAK,AAAE,CAAC,AAE3B,QAAQ,AAAE,CAAC,AACjB,cAAc,CAAE,qBAAM,CACtB,kBAAkB,CAAE,IAAI,CACxB,mBAAmB,CAAE,QAAQ,AAC/B,CAAC,AAEH,WAAW,qBAAO,CAAC,AACjB,EAAE,AAAG,CAAC,MAAM,OAAO,CAAE,WAAW,CAAE,OAAO,AAAC,CAAC,AAC3C,GAAG,AAAC,CAAC,MAAM,GAAG,CAAE,WAAW,CAAE,IAAI,AAAC,CAAC,AACnC,GAAG,AAAC,CAAC,MAAM,GAAG,CAAE,WAAW,CAAE,IAAI,AAAC,CAAC,AACnC,IAAI,AAAC,CAAC,MAAM,OAAO,CAAE,WAAW,CAAE,OAAO,AAAE,CAAC,AAC9C,CAAC"}`
};
const ShipItem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {mass} = $$props;
let {cost} = $$props;
let mass_el;
let cost_el;
const update_el = async (el) => {
if (!el)
return;
el.classList.remove("updated");
void el.offsetWidth;
el.classList.add("updated");
};
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
$$result.css.add(css$b);
{
update_el(mass_el);
}
{
update_el(cost_el);
}
return `<div class="${"svelte-14c1p7f"}">${slots.default ? slots.default({}) : ``}</div>
<div class="${"mass svelte-14c1p7f"}"${add_attribute("this", mass_el, 1)}>${escape(mass)}</div>
<div class="${"cost svelte-14c1p7f"}"${add_attribute("this", cost_el, 1)}>${escape(cost)}</div>`;
});
var index_svelte_svelte_type_style_lang$9 = "div.svelte-12m93xd{display:flex;grid-column:1 / span 3 !important;align-items:baseline;gap:1em}hr.svelte-12m93xd{flex:1;heigth:0px}";
const css$a = {
code: "div.svelte-12m93xd{display:flex;grid-column:1 / span 3 !important;align-items:baseline;gap:1em}hr.svelte-12m93xd{flex:1;heigth:0px}",
map: '{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<div>\\n<h2>{label}</h2>\\n <hr/>\\n</div>\\n\\n<slot />\\n\\n<script>\\n export let label;\\n</script>\\n\\n<style>\\n div {\\n display: flex;\\n grid-column: 1 / span 3 !important;\\n align-items: baseline;\\n gap: 1em;\\n }\\n hr {\\n flex: 1;\\n heigth: 0px;\\n }\\n </style>\\n"],"names":[],"mappings":"AAYE,GAAG,eAAC,CAAC,AACH,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAClC,WAAW,CAAE,QAAQ,CACrB,GAAG,CAAE,GAAG,AACV,CAAC,AACD,EAAE,eAAC,CAAC,AACF,IAAI,CAAE,CAAC,CACP,MAAM,CAAE,GAAG,AACb,CAAC"}'
};
const Section = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {label} = $$props;
if ($$props.label === void 0 && $$bindings.label && label !== void 0)
$$bindings.label(label);
$$result.css.add(css$a);
return `<div class="${"svelte-12m93xd"}"><h2>${escape(label)}</h2>
<hr class="${"svelte-12m93xd"}"></div>
${slots.default ? slots.default({}) : ``}`;
});
var index_svelte_svelte_type_style_lang$8 = "input.svelte-11x6jvv{width:3em}div.svelte-11x6jvv{display:flex;gap:2em}";
const css$9 = {
code: "input.svelte-11x6jvv{width:3em}div.svelte-11x6jvv{display:flex;gap:2em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem { cost } { mass }>\\n <div>\\n\\n <Field label=\\"screens\\">\\n <input type=\\"number\\" bind:value={standard} min=\\"0\\" />\\n </Field>\\n\\n <Field label=\\"advanced screens\\">\\n <input type=\\"number\\" bind:value={advanced} min=\\"0\\" />\\n </Field>\\n</div>\\n\\n</ShipItem>\\n\\n<script>\\n import { createEventDispatcher } from 'svelte';\\n\\n import Section from '$lib/components/Section/index.svelte';\\n import Field from '$lib/components/Field/index.svelte';\\n import ShipItem from '../../ShipItem/index.svelte';\\n\\n export let cost = 0;\\n export let mass = 0;\\n export let standard = 0;\\n export let advanced = 0;\\n\\n let nbr_regular, nbr_advanced;\\n\\n const dispatch = createEventDispatcher();\\n\\n $: dispatch( 'set_screens', { standard, advanced } );\\n</script>\\n\\n<style>\\n input {\\n width: 3em;\\n }\\n div {\\n display: flex;\\n gap: 2em;\\n }\\n </style>\\n"],"names":[],"mappings":"AAkCE,KAAK,eAAC,CAAC,AACL,KAAK,CAAE,GAAG,AACZ,CAAC,AACD,GAAG,eAAC,CAAC,AACH,OAAO,CAAE,IAAI,CACb,GAAG,CAAE,GAAG,AACV,CAAC"}`
};
const Screens = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let {standard = 0} = $$props;
let {advanced = 0} = $$props;
const dispatch = createEventDispatcher();
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.standard === void 0 && $$bindings.standard && standard !== void 0)
$$bindings.standard(standard);
if ($$props.advanced === void 0 && $$bindings.advanced && advanced !== void 0)
$$bindings.advanced(advanced);
$$result.css.add(css$9);
{
dispatch("set_screens", {standard, advanced});
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `<div class="${"svelte-11x6jvv"}">${validate_component(Field, "Field").$$render($$result, {label: "screens"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" class="${"svelte-11x6jvv"}"${add_attribute("value", standard, 1)}>`
})}
${validate_component(Field, "Field").$$render($$result, {label: "advanced screens"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" class="${"svelte-11x6jvv"}"${add_attribute("value", advanced, 1)}>`
})}</div>`
})}`;
});
var index_svelte_svelte_type_style_lang$7 = "input.svelte-qworsx{width:5em}";
const css$8 = {
code: "input.svelte-qworsx{width:5em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<Field label={ \`layer \${layer}\` }>\\n <input type=\\"number\\" min=\\"0\\" bind:value={rating} />\\n</Field>\\n\\n\\n<script>\\n import { createEventDispatcher} from 'svelte';\\n\\n import dux from '$lib/dux/structure/armour';\\n\\n import ShipItem from '$lib/components/ShipItem/index.svelte';\\n import Field from '$lib/components/Field/index.svelte';\\n\\n export let layer = 1;\\n export let rating = 0;\\n\\n const dispatch = createEventDispatcher();\\n\\n $: dispatch( 'ship_change',\\n dux.actions.set_armour_layer({layer,rating})\\n );\\n\\n</script>\\n\\n<style>\\n input {\\n width: 5em;\\n }\\n </style>\\n"],"names":[],"mappings":"AAyBE,KAAK,cAAC,CAAC,AACL,KAAK,CAAE,GAAG,AACZ,CAAC"}`
};
const Layer = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {layer = 1} = $$props;
let {rating = 0} = $$props;
const dispatch = createEventDispatcher();
if ($$props.layer === void 0 && $$bindings.layer && layer !== void 0)
$$bindings.layer(layer);
if ($$props.rating === void 0 && $$bindings.rating && rating !== void 0)
$$bindings.rating(rating);
$$result.css.add(css$8);
{
dispatch("ship_change", dux$a.actions.set_armour_layer({layer, rating}));
}
return `${validate_component(Field, "Field").$$render($$result, {label: `layer ${layer}`}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" class="${"svelte-qworsx"}"${add_attribute("value", rating, 1)}>`
})}`;
});
var index_svelte_svelte_type_style_lang$6 = ".layers.svelte-1bx91qz{display:flex}input.svelte-1bx91qz{width:5em}";
const css$7 = {
code: ".layers.svelte-1bx91qz{display:flex}input.svelte-1bx91qz{width:5em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem {cost} {mass} >\\n\\n<div>\\n\\n<div class=\\"nbr_layers\\">\\n<Field label=\\"armour layers\\">\\n <input type=\\"number\\" min=\\"0\\" bind:value={nbr_layers} />\\n</Field>\\n</div>\\n\\n<div class=\\"layers\\">\\n {#each armour as layer ( layer.layer )}\\n <Layer {...layer} on:ship_change/>\\n {/each}\\n</div>\\n\\n\\n</div>\\n\\n</ShipItem>\\n\\n<script>\\n import { createEventDispatcher} from 'svelte';\\n\\n import ShipItem from '$lib/components/ShipItem/index.svelte';\\n import Field from '$lib/components/Field/index.svelte';\\n import Layer from './Layer/index.svelte';\\n import dux from '$lib/dux/structure/armour';\\n import _ from 'lodash';\\n\\n export let armour = [];\\n export let cost = 0;\\n export let mass = 0;\\n\\n $: cost = _.sum( _.map( armour, 'cost' ) );\\n $: mass = _.sum( _.map( armour, 'mass' ) );\\n\\n let nbr_layers = armour.length;\\n\\n const dispatch = createEventDispatcher();\\n\\n $: dispatch( 'ship_change', dux.actions.set_armour_nbr_layers(nbr_layers) );\\n\\n</script>\\n\\n<style>\\n .layers {\\n display: flex;\\n\\n }\\n\\n input {\\n width: 5em;\\n }\\n\\n</style>\\n"],"names":[],"mappings":"AA8CI,OAAO,eAAC,CAAC,AACL,OAAO,CAAE,IAAI,AAEjB,CAAC,AAED,KAAK,eAAC,CAAC,AACL,KAAK,CAAE,GAAG,AACZ,CAAC"}`
};
const Armour = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {armour = []} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let nbr_layers = armour.length;
const dispatch = createEventDispatcher();
if ($$props.armour === void 0 && $$bindings.armour && armour !== void 0)
$$bindings.armour(armour);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
$$result.css.add(css$7);
cost = _$1.sum(_$1.map(armour, "cost"));
mass = _$1.sum(_$1.map(armour, "mass"));
{
dispatch("ship_change", dux$a.actions.set_armour_nbr_layers(nbr_layers));
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `<div><div class="${"nbr_layers"}">${validate_component(Field, "Field").$$render($$result, {label: "armour layers"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" class="${"svelte-1bx91qz"}"${add_attribute("value", nbr_layers, 1)}>`
})}</div>
<div class="${"layers svelte-1bx91qz"}">${each(armour, (layer) => `${validate_component(Layer, "Layer").$$render($$result, Object.assign(layer), {}, {})}`)}</div></div>`
})}`;
});
var index_svelte_svelte_type_style_lang$5 = "input.svelte-qworsx{width:5em}";
const css$6 = {
code: "input.svelte-qworsx{width:5em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem {cost} {mass}>\\n <Field label=\\"cargo\\">\\n <input type=\\"number\\" min=\\"0\\" bind:value={space}/>\\n </Field>\\n</ShipItem>\\n\\n <script>\\n import get from 'lodash/get.js';\\n import ShipItem from '$lib/components/ShipItem/index.svelte';\\n import Field from '$lib/components/Field/index.svelte';\\n import dux from '$lib/dux/cargo';\\n\\n import {getContext, createEventDispatcher} from 'svelte';\\n\\n const ship = getContext('ship');\\n\\n export let space = 0;\\n export let cost = 0;\\n export let mass = 0;\\n\\n const dispatch = createEventDispatcher();\\n $: dispatch( 'set_cargo', dux.actions.set_cargo( space ) );\\n\\n </script>\\n\\n <style>\\n input {\\n width: 5em;\\n }\\n </style>\\n"],"names":[],"mappings":"AA0BE,KAAK,cAAC,CAAC,AACL,KAAK,CAAE,GAAG,AACZ,CAAC"}`
};
const Cargo = create_ssr_component(($$result, $$props, $$bindings, slots) => {
getContext("ship");
let {space = 0} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
const dispatch = createEventDispatcher();
if ($$props.space === void 0 && $$bindings.space && space !== void 0)
$$bindings.space(space);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
$$result.css.add(css$6);
{
dispatch("set_cargo", dux$7.actions.set_cargo(space));
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "cargo"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" class="${"svelte-qworsx"}"${add_attribute("value", space, 1)}>`
})}`
})}`;
});
var index_svelte_svelte_type_style_lang$4 = "div.svelte-6w28yb{display:flex }label.svelte-6w28yb{margin-left:1em}";
const css$5 = {
code: "div.svelte-6w28yb{display:flex }label.svelte-6w28yb{margin-left:1em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem {cost} {mass}>\\n <Field label=\\"streamlining\\">\\n <div>\\n <label>\\n <input type=\\"radio\\" bind:group={type} value=\\"none\\" />\\n none</label>\\n <label>\\n\\n <input type=\\"radio\\" bind:group={type} value=\\"partial\\" />\\n partial</label>\\n <label>\\n <input type=\\"radio\\" bind:group={type} value=\\"full\\" />\\n full</label>\\n </div>\\n </Field>\\n</ShipItem>\\n\\n <script>\\n import get from 'lodash/get.js';\\n import ShipItem from '$lib/components/ShipItem/index.svelte';\\n import Field from '$lib/components/Field/index.svelte';\\n import dux from '$lib/dux/streamlining';\\n\\n import {getContext } from 'svelte';\\n\\n export let type = 'none';\\n export let cost = 0;\\n export let mass = 0;\\n export let ship_change = getContext('ship_change') || ( () => {} );\\n\\n $: ship_change( dux.actions.set_streamlining(type));\\n\\n </script>\\n\\n <style>\\n div { display: flex }\\n label {\\n margin-left: 1em;\\n }\\n </style>\\n"],"names":[],"mappings":"AAmCE,GAAG,cAAC,CAAC,AAAC,OAAO,CAAE,IAAI,CAAC,CAAC,AACrB,KAAK,cAAC,CAAC,AACL,WAAW,CAAE,GAAG,AAClB,CAAC"}`
};
const Streamlining = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {type = "none"} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
$$result.css.add(css$5);
{
ship_change(dux$5.actions.set_streamlining(type));
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "streamlining"}, {}, {
default: () => `<div class="${"svelte-6w28yb"}"><label class="${"svelte-6w28yb"}"><input type="${"radio"}" value="${"none"}">
none</label>
<label class="${"svelte-6w28yb"}"><input type="${"radio"}" value="${"partial"}">
partial</label>
<label class="${"svelte-6w28yb"}"><input type="${"radio"}" value="${"full"}">
full</label></div>`
})}`
})}`;
});
var index_svelte_svelte_type_style_lang$3 = "input.svelte-x10nn1{width:5em}";
const css$4 = {
code: "input.svelte-x10nn1{width:5em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<Section label=\\"hull\\">\\n\\n<ShipItem {cost} {mass} >\\n <Field label=\\"integrity\\">\\n <input\\n bind:value={rating}\\n type=\\"number\\" {min} {max} />\\n </Field>\\n</ShipItem>\\n\\n\\n<Screens {...screens} on:set_screens />\\n\\n<Armour {armour} on:ship_change />\\n\\n<Cargo {...cargo} on:set_cargo />\\n\\n<Streamlining {...streamlining} />\\n</Section>\\n\\n<script>\\n import { createEventDispatcher } from 'svelte';\\n\\n import Section from '../Section/index.svelte';\\n import Field from '../Field/index.svelte';\\n import ShipItem from '../ShipItem/index.svelte';\\n import Screens from './Screens/index.svelte';\\n import Armour from './Armour/index.svelte';\\n import Cargo from './Cargo/index.svelte';\\n import Streamlining from './Streamlining/index.svelte';\\n\\n export let cost, mass, ship_mass, rating, screens, armour = (\\n 0, 0, 10, 1, [], []\\n );\\n\\n export let cargo = {};\\n export let streamlining = {};\\n\\n let min, max;\\n $: min = Math.ceil(ship_mass / 10);\\n $: max = ship_mass;\\n\\nconst dispatch = createEventDispatcher();\\n\\n $: dispatch( 'change_hull', { rating } );\\n\\n</script>\\n\\n<style>\\n input { width: 5em; }\\n</style>\\n"],"names":[],"mappings":"AAiDE,KAAK,cAAC,CAAC,AAAC,KAAK,CAAE,GAAG,AAAE,CAAC"}`
};
const Hull = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {cost} = $$props, {mass} = $$props, {ship_mass} = $$props, {rating} = $$props, {screens: screens2} = $$props, {armour = []} = $$props;
let {cargo = {}} = $$props;
let {streamlining = {}} = $$props;
let min, max;
const dispatch = createEventDispatcher();
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_mass === void 0 && $$bindings.ship_mass && ship_mass !== void 0)
$$bindings.ship_mass(ship_mass);
if ($$props.rating === void 0 && $$bindings.rating && rating !== void 0)
$$bindings.rating(rating);
if ($$props.screens === void 0 && $$bindings.screens && screens2 !== void 0)
$$bindings.screens(screens2);
if ($$props.armour === void 0 && $$bindings.armour && armour !== void 0)
$$bindings.armour(armour);
if ($$props.cargo === void 0 && $$bindings.cargo && cargo !== void 0)
$$bindings.cargo(cargo);
if ($$props.streamlining === void 0 && $$bindings.streamlining && streamlining !== void 0)
$$bindings.streamlining(streamlining);
$$result.css.add(css$4);
min = Math.ceil(ship_mass / 10);
max = ship_mass;
{
dispatch("change_hull", {rating});
}
return `${validate_component(Section, "Section").$$render($$result, {label: "hull"}, {}, {
default: () => `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "integrity"}, {}, {
default: () => `<input type="${"number"}"${add_attribute("min", min, 0)}${add_attribute("max", max, 0)} class="${"svelte-x10nn1"}"${add_attribute("value", rating, 1)}>`
})}`
})}
${validate_component(Screens, "Screens").$$render($$result, Object.assign(screens2), {}, {})}
${validate_component(Armour, "Armour").$$render($$result, {armour}, {}, {})}
${validate_component(Cargo, "Cargo").$$render($$result, Object.assign(cargo), {}, {})}
${validate_component(Streamlining, "Streamlining").$$render($$result, Object.assign(streamlining), {}, {})}`
})}`;
});
const Firecons = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {nbr} = $$props, {cost} = $$props, {mass = 0} = $$props;
const dispatch = createEventDispatcher();
if ($$props.nbr === void 0 && $$bindings.nbr && nbr !== void 0)
$$bindings.nbr(nbr);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
{
dispatch("change_firecons", nbr);
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "firecons"}, {}, {
default: () => `<input type="${"number"}" class="${"short"}"${add_attribute("value", nbr, 1)}>`
})}`
})}`;
});
var index_svelte_svelte_type_style_lang$2 = "label.svelte-1ozsoxu{display:inline;margin-right:1em}";
const css$3 = {
code: "label.svelte-1ozsoxu{display:inline;margin-right:1em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<script>\\n import { createEventDispatcher } from 'svelte';\\n\\n import ShipItem from '../ShipItem/index.svelte';\\n import Field from '../Field/index.svelte';\\n\\n export let type = 'none';\\n export let cost = 0;\\n export let mass = 0;\\n\\n const dispatch = createEventDispatcher();\\n\\n const change = () => dispatch( 'change_ftl', type );\\n\\n const types = [ 'none', 'standard', 'advanced' ];\\n\\n\\n</script>\\n\\n<ShipItem {mass} {cost}>\\n <Field label=\\"FTL drive\\">\\n\\n {#each types as t (t)}\\n <label><input type=\\"radio\\" bind:group={type} value={t} \\n on:change={change} /> {t} </label>\\n {/each}\\n </Field>\\n</ShipItem>\\n\\n<style>\\nlabel {\\n display: inline;\\n margin-right: 1em;\\n}\\n</style>\\n"],"names":[],"mappings":"AA8BA,KAAK,eAAC,CAAC,AACH,OAAO,CAAE,MAAM,CACf,YAAY,CAAE,GAAG,AACrB,CAAC"}`
};
const Ftl = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {type = "none"} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
createEventDispatcher();
const types = ["none", "standard", "advanced"];
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
$$result.css.add(css$3);
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {mass, cost}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "FTL drive"}, {}, {
default: () => `${each(types, (t) => `<label class="${"svelte-1ozsoxu"}"><input type="${"radio"}"${add_attribute("value", t, 0)}> ${escape(t)} </label>`)}`
})}`
})}`;
});
var index_svelte_svelte_type_style_lang$1 = 'div.svelte-3grq2v{display:flex;align-items:end}label.svelte-3grq2v{margin-left:2em}input[type="number"].svelte-3grq2v{width:5em}';
const css$2 = {
code: 'div.svelte-3grq2v{display:flex;align-items:end}label.svelte-3grq2v{margin-left:2em}input[type="number"].svelte-3grq2v{width:5em}',
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem {cost} {mass}>\\n\\n<div>\\n<Field label=\\"thrust rating\\">\\n <input type=\\"number\\" bind:value={ rating }\\n min=\\"0\\" max=\\"20\\" step=\\"1\\" />\\n</Field>\\n\\n<label><input type=\\"checkbox\\" bind:checked={advanced} /> advanced</label>\\n</div>\\n\\n</ShipItem>\\n\\n\\n<script>\\n import { createEventDispatcher } from 'svelte';\\n\\n import Field from '$lib/components/Field/index.svelte';\\n import ShipItem from '$lib/components/ShipItem/index.svelte';\\n\\n export let cost;\\n export let mass;\\n export let advanced = false;\\n export let rating = 0;\\n\\n const dispatch = createEventDispatcher();\\n\\nconsole.log(advanced);\\n $: dispatch( 'change_engine', { rating, advanced } );\\n\\n</script>\\n\\n<style>\\ndiv {\\n display: flex;\\n align-items: end;\\n}\\nlabel { margin-left: 2em; }\\n input[type=\\"number\\"] { width: 5em; }\\n</style>\\n"],"names":[],"mappings":"AAiCA,GAAG,cAAC,CAAC,AACD,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,GAAG,AACpB,CAAC,AACD,KAAK,cAAC,CAAC,AAAC,WAAW,CAAE,GAAG,AAAE,CAAC,AACzB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAC,CAAC,AAAC,KAAK,CAAE,GAAG,AAAE,CAAC"}`
};
const Engine = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {cost} = $$props;
let {mass} = $$props;
let {advanced = false} = $$props;
let {rating = 0} = $$props;
const dispatch = createEventDispatcher();
console.log(advanced);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.advanced === void 0 && $$bindings.advanced && advanced !== void 0)
$$bindings.advanced(advanced);
if ($$props.rating === void 0 && $$bindings.rating && rating !== void 0)
$$bindings.rating(rating);
$$result.css.add(css$2);
{
dispatch("change_engine", {rating, advanced});
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `<div class="${"svelte-3grq2v"}">${validate_component(Field, "Field").$$render($$result, {label: "thrust rating"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}" max="${"20"}" step="${"1"}" class="${"svelte-3grq2v"}"${add_attribute("value", rating, 1)}>`
})}
<label class="${"svelte-3grq2v"}"><input type="${"checkbox"}"${add_attribute("checked", advanced, 1)}> advanced</label></div>`
})}`;
});
const Propulsion = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {ftl: ftl2 = {}} = $$props;
let {engine: engine2 = {}} = $$props;
if ($$props.ftl === void 0 && $$bindings.ftl && ftl2 !== void 0)
$$bindings.ftl(ftl2);
if ($$props.engine === void 0 && $$bindings.engine && engine2 !== void 0)
$$bindings.engine(engine2);
return `${validate_component(Section, "Section").$$render($$result, {label: "propulsion"}, {}, {
default: () => `${validate_component(Engine, "Engine").$$render($$result, Object.assign(engine2), {}, {})}
${validate_component(Ftl, "Ftl").$$render($$result, Object.assign(ftl2), {}, {})}`
})}`;
});
const Beam = create_ssr_component(($$result, $$props, $$bindings, slots) => {
const all_arcs = ["FS", "F", "FP", "AP", "A", "AS"];
let {weapon_type} = $$props;
let {id} = $$props;
let {weapon_class = 1} = $$props;
let {arcs = ["F"]} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
let arc_options = {
1: [6],
2: [3, 6],
3: [1, 2, 3, 4, 5, 6, "broadside"],
4: [1, 2, 3, 4, 5, 6, "broadside"]
};
let nbr_arcs = 6;
let cache = "";
const dispatch = createEventDispatcher();
if ($$props.weapon_type === void 0 && $$bindings.weapon_type && weapon_type !== void 0)
$$bindings.weapon_type(weapon_type);
if ($$props.id === void 0 && $$bindings.id && id !== void 0)
$$bindings.id(id);
if ($$props.weapon_class === void 0 && $$bindings.weapon_class && weapon_class !== void 0)
$$bindings.weapon_class(weapon_class);
if ($$props.arcs === void 0 && $$bindings.arcs && arcs !== void 0)
$$bindings.arcs(arcs);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
nbr_arcs = arc_options[weapon_class][0];
{
if (arcs.length !== nbr_arcs) {
if (nbr_arcs === "broadside") {
arcs = all_arcs.filter((arc) => arc.length === 1);
} else {
let first_index = all_arcs.findIndex((arc) => arcs[0]);
if (first_index === -1)
first_index = 0;
const new_arcs = [];
_$1.range(nbr_arcs).forEach((i) => {
new_arcs.push(all_arcs[first_index]);
first_index = (first_index + 1) % all_arcs.length;
});
arcs = new_arcs;
}
}
}
{
console.log({arcs, nbr_arcs});
}
cache = arcs.join(":");
{
dispatch("change", {weapon_class, arcs: cache.split(":")});
}
return `<label>beam</label>
${validate_component(Field, "Field").$$render($$result, {label: "beam class"}, {}, {
default: () => `<select${add_attribute("value", weapon_class, 1)}><option value="${"1"}">1</option><option value="${"2"}">2</option><option value="${"3"}">3</option><option value="${"4"}">4</option></select>`
})}
${validate_component(Field, "Field").$$render($$result, {label: "arcs"}, {}, {
default: () => `<select${add_attribute("value", nbr_arcs, 1)}>${each(arc_options[weapon_class] || [], (nbr_arcs2) => `<option${add_attribute("value", nbr_arcs2, 0)}>${escape(nbr_arcs2)}</option>`)}</select>`
})}
${validate_component(Arcs, "Arcs").$$render($$result, {selected: arcs}, {}, {})}`;
});
const Submunition = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {arcs = ["F"]} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
const dispatch = createEventDispatcher();
let cache;
if ($$props.arcs === void 0 && $$bindings.arcs && arcs !== void 0)
$$bindings.arcs(arcs);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
cache = arcs.join(":");
{
dispatch("change", {arcs: cache.split(":")});
}
return `<label>submunition pack</label>
${validate_component(Arcs, "Arcs").$$render($$result, {selected: arcs}, {}, {})}`;
});
const PointDefenceSystem = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<label>point defence system</label>`;
});
const Scattergun = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<label>scattergun</label>`;
});
const Needle = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {arcs = ["F"]} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
const dispatch = createEventDispatcher();
let cache;
if ($$props.arcs === void 0 && $$bindings.arcs && arcs !== void 0)
$$bindings.arcs(arcs);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
cache = arcs.join(":");
{
dispatch("change", {arcs: cache.split(":")});
}
return `<label>needle weapon</label>
${validate_component(Arcs, "Arcs").$$render($$result, {selected: arcs}, {}, {})}`;
});
var index_svelte_svelte_type_style_lang = ".weapon_row.svelte-1vypk50{display:flex;align-items:center}.weapon_row.svelte-1vypk50>*{margin-right:2em}";
const css$1 = {
code: ".weapon_row.svelte-1vypk50{display:flex;align-items:center}.weapon_row.svelte-1vypk50>*{margin-right:2em}",
map: `{"version":3,"file":"index.svelte","sources":["index.svelte"],"sourcesContent":["<ShipItem {cost} {mass}>\\n\\n <div class=\\"weapon_row\\">\\n\\n <input type=\\"button\\" class=\\"button small red remove\\" value=\\"remove\\"\\n on:click={remove} />\\n\\n\\n<svelte:component this={weapon_component[weapon_type]} {...weapon}\\n on:change={update}/>\\n</div>\\n</ShipItem>\\n\\n<script>\\n import {getContext } from 'svelte';\\n\\n import Arc from '../Weapons/Arc.svelte';\\n import { weapon_cost_mass } from '../../dux/weapons/rules.js';\\n import _ from 'lodash';\\n import { createEventDispatcher } from 'svelte';\\n import ShipItem from '../ShipItem/index.svelte';\\n import Field from '../Field/index.svelte';\\n import Beam from './Beam/index.svelte';\\n import Submunition from './Submunition/index.svelte';\\n import PointDefenceSystem from './PointDefenceSystem/index.svelte';\\n import Scattergun from './Scattergun/index.svelte';\\n import Needle from './Needle/index.svelte';\\n import dux from '../../dux';\\n\\n const weapon_component = {\\n beam: Beam,\\n 'submunition': Submunition,\\n 'pds': PointDefenceSystem,\\n scattergun: Scattergun,\\n needle: Needle,\\n };\\n\\n export let weapon = {};\\n export let id;\\n export let cost;\\n export let mass;\\n export let ship_change = getContext('ship_change') || ( () => {} );\\n\\n let weapon_type = weapon.weapon_type;\\n\\n const remove = () => ship_change( dux.actions.remove_weapon(id) );\\n\\n\\n const update = ({detail}) => {\\n ship_change( dux.actions.set_weapon({\\n id, weapon_type, ...detail\\n }) );\\n }\\n</script>\\n\\n<style>\\n\\n.weapon {\\n display: flex;\\n align-items: center;\\n}\\n\\n.weapon > * {\\n margin-right: 2em;\\n}\\n\\n.arcs {\\n display: grid;\\n grid-template-rows: 1fr 1fr 1fr 1fr;\\n grid-template-columns: 1fr 1fr 1fr 1fr;\\n align-items: center;\\n justify-items: center;\\n width: 6em;\\n}\\n\\n\\n.arc input {\\n margin: 0px;\\n}\\n\\n\\n.arc.F {\\n grid-column: 2 / span 2;\\n grid-row: 1;\\n}\\n\\n.arc.FS {\\n grid-column: 1;\\n grid-row: 1 / span 2;\\n}\\n\\n.arc.FP {\\n grid-column: 4;\\n grid-row: 1 / span 2;\\n}\\n\\n.arc.AS {\\n grid-column: 1;\\n grid-row: 3 / span 2;\\n}\\n\\n.arc.AP {\\n grid-column: 4;\\n grid-row: 3 / span 2;\\n}\\n\\n.arc.A {\\n grid-column: 2 / span 2;\\n grid-row: 4;\\n}\\n\\n.add-weapon {\\n display: block;\\n}\\n\\n .weapon_row {\\n display: flex;\\n align-items: center;\\n }\\n\\n .weapon_row > :global(*) {\\n margin-right: 2em;\\n }\\n\\n\\n</style>\\n"],"names":[],"mappings":"AAmHE,WAAW,eAAC,CAAC,AACX,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,MAAM,AACrB,CAAC,AAED,0BAAW,CAAW,CAAC,AAAE,CAAC,AACxB,YAAY,CAAE,GAAG,AACnB,CAAC"}`
};
const Weapon = create_ssr_component(($$result, $$props, $$bindings, slots) => {
const weapon_component = {
beam: Beam,
"submunition": Submunition,
"pds": PointDefenceSystem,
scattergun: Scattergun,
needle: Needle
};
let {weapon = {}} = $$props;
let {id} = $$props;
let {cost} = $$props;
let {mass} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
let weapon_type = weapon.weapon_type;
if ($$props.weapon === void 0 && $$bindings.weapon && weapon !== void 0)
$$bindings.weapon(weapon);
if ($$props.id === void 0 && $$bindings.id && id !== void 0)
$$bindings.id(id);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
$$result.css.add(css$1);
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `<div class="${"weapon_row svelte-1vypk50"}"><input type="${"button"}" class="${"button small red remove"}" value="${"remove"}">
${validate_component(weapon_component[weapon_type] || missing_component, "svelte:component").$$render($$result, Object.assign(weapon), {}, {})}</div>`
})}`;
});
const Squadron = create_ssr_component(($$result, $$props, $$bindings, slots) => {
const types = squadron_types.map(({type: type2}) => type2);
let {id = 1} = $$props;
let {type = "standard"} = $$props;
let {ftl: ftl2 = false} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
if ($$props.id === void 0 && $$bindings.id && id !== void 0)
$$bindings.id(id);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.ftl === void 0 && $$bindings.ftl && ftl2 !== void 0)
$$bindings.ftl(ftl2);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
{
ship_change(dux$3.actions.set_squadron({id, type}));
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: `squadron ${id}`}, {}, {
default: () => `<select${add_attribute("value", type, 1)}>${each(types, (type2) => `<option${add_attribute("value", type2, 0)}>${escape(type2)}</option>`)}</select>`
})}`
})}`;
});
const Carrier = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {bays = 0} = $$props;
let {squadrons = []} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
if ($$props.bays === void 0 && $$bindings.bays && bays !== void 0)
$$bindings.bays(bays);
if ($$props.squadrons === void 0 && $$bindings.squadrons && squadrons !== void 0)
$$bindings.squadrons(squadrons);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
{
ship_change(dux$3.actions.set_carrier_bays(bays));
}
return `${validate_component(Section, "Section").$$render($$result, {label: "carrier"}, {}, {
default: () => `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "bays"}, {}, {
default: () => `<input type="${"number"}" min="${"0"}"${add_attribute("value", bays, 1)}>`
})}`
})}
${each(squadrons, (squad) => `${validate_component(Squadron, "Squadron").$$render($$result, Object.assign(squad), {}, {})}`)}`
})}`;
});
const ADFC = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {rating = 0} = $$props;
let {cost = 0} = $$props;
let {mass = 0} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
if ($$props.rating === void 0 && $$bindings.rating && rating !== void 0)
$$bindings.rating(rating);
if ($$props.cost === void 0 && $$bindings.cost && cost !== void 0)
$$bindings.cost(cost);
if ($$props.mass === void 0 && $$bindings.mass && mass !== void 0)
$$bindings.mass(mass);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
{
ship_change(dux$1.actions.set_adfc(rating));
}
return `${validate_component(ShipItem, "ShipItem").$$render($$result, {cost, mass}, {}, {
default: () => `${validate_component(Field, "Field").$$render($$result, {label: "ADFC"}, {}, {
default: () => `<input type="${"number"}" class="${"short"}"${add_attribute("value", rating, 1)}>`
})}`
})}`;
});
const AddWeapon = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let {weapon_type = "beam"} = $$props;
let {ship_change = getContext("ship_change") || (() => {
})} = $$props;
if ($$props.weapon_type === void 0 && $$bindings.weapon_type && weapon_type !== void 0)
$$bindings.weapon_type(weapon_type);
if ($$props.ship_change === void 0 && $$bindings.ship_change && ship_change !== void 0)
$$bindings.ship_change(ship_change);
return `${validate_component(Field, "Field").$$render($$result, {label: "weapon type"}, {}, {
default: () => `<select${add_attribute("value", weapon_type, 1)}><option value="${"beam"}">beam</option><option value="${"submunition"}">submunition pack</option><option value="${"pds"}">point defence system</option><option value="${"scattergun"}">scattergun</option><option value="${"needle"}">needle weapon</option></select>
<input type="${"button"}" value="${"add weapon"}" class="${"button small blue"}">`
})}`;
});
var App_svelte_svelte_type_style_lang = "main.svelte-4zjur4.svelte-4zjur4{display:grid;grid-template-columns:1fr 14em 8em;width:60em;margin-left:auto;margin-right:auto}nav.svelte-4zjur4.svelte-4zjur4{grid-column:1 / span 3 !important;display:flex;width:60em;margin-left:auto;margin-right:auto;margin-bottom:1em}nav.svelte-4zjur4 .spacer.svelte-4zjur4{flex:1}main > *{grid-column:1}input.reset.svelte-4zjur4.svelte-4zjur4{grid-column:2}footer.svelte-4zjur4.svelte-4zjur4{width:var(--main-width);margin:0 auto;text-align:right}.notes.svelte-4zjur4.svelte-4zjur4{margin-right:2em}";
const css = {
code: "main.svelte-4zjur4.svelte-4zjur4{display:grid;grid-template-columns:1fr 14em 8em;width:60em;margin-left:auto;margin-right:auto}nav.svelte-4zjur4.svelte-4zjur4{grid-column:1 / span 3 !important;display:flex;width:60em;margin-left:auto;margin-right:auto;margin-bottom:1em}nav.svelte-4zjur4 .spacer.svelte-4zjur4{flex:1}main > *{grid-column:1}input.reset.svelte-4zjur4.svelte-4zjur4{grid-column:2}footer.svelte-4zjur4.svelte-4zjur4{width:var(--main-width);margin:0 auto;text-align:right}.notes.svelte-4zjur4.svelte-4zjur4{margin-right:2em}",
map: `{"version":3,"file":"App.svelte","sources":["App.svelte"],"sourcesContent":["<Header />\\n\\n <nav>\\n <input class=\\"reset button small red\\" type=\\"button\\" value=\\"reset\\" on:click={reset} />\\n\\n <div class=\\"spacer\\" />\\n <input type=\\"button\\" class=\\"button small notes\\" value=\\"notes\\" on:click={toggle_notes} />\\n\\n <ul class=\\"button-group\\">\\n <input type=\\"button\\" class=\\"button small green\\" value=\\"editor\\"\\n on:click={() => set_output(null)} />\\n <input type=\\"button\\" class=\\"button small green\\" value=\\"json\\"\\n on:click={() => set_output('json')} />\\n <input type=\\"button\\" class=\\"button small green\\" value=\\"print\\"\\n on:click={() => set_output('print')} />\\n </ul>\\n </nav>\\n\\n{#if show_notes}\\n<Notes show={show_notes} on:close={toggle_notes} />\\n{/if}\\n\\n{#if output === 'json'}\\n <OutputJson ship={$ship}\\n on:close={() => set_output(null)}/>\\n {:else if output === 'print' }\\n <Print ship={$ship} />\\n{:else}\\n\\n<main>\\n\\n <ShipSpecs />\\n\\n <Propulsion\\n ftl={$ship.ftl}\\n engine={$ship.engine}\\n on:change_ftl={change_ftl}\\n on:change_engine={change_engine} />\\n\\n <Hull\\n ship_mass={$ship.general.mass}\\n {...$ship.structure.hull}\\n on:change_hull={change_hull}\\n screens={$ship.structure.screens}\\n armour={$ship.structure.armour}\\n on:set_screens={set_screens}\\n cargo={$ship.cargo}\\n streamlining={$ship.streamlining}\\n on:set_cargo={ship_dispatch}\\n on:ship_change={ship_dispatch} />\\n\\n <Section label=\\"weaponry\\">\\n <Firecons\\n {...$ship.weaponry.firecons}\\n on:change_firecons={change_firecons} />\\n\\n <ADFC {...$ship.weaponry.adfc} />\\n\\n <AddWeapon />\\n\\n {#each weapons as weapon (weapon.id)}\\n <Weapon {weapon} id={weapon.id} cost={weapon.cost} mass={weapon.mass} />\\n {/each}\\n\\n </Section>\\n\\n <Carrier {...$ship.carrier} />\\n\\n\\n</main>\\n <footer>\\n Written by <a href=\\"https://twitter.com/yenzie\\">Yanick Champoux</a>.\\n Code available on <a\\n href=\\"https://github.com/yanick/aotds-shipyard\\">Github</a>\\n </footer>\\n\\n{/if}\\n<script>\\n import { setContext } from \\"svelte\\";\\n\\n import Header from './Header.svelte';\\n import shipStore from \\"../stores/ship\\";\\n import OutputJson from './Output/Json.svelte';\\n import Print from './Output/Print/index.svelte';\\n\\n import ShipSpecs from './ShipSpecs/index.svelte';\\n import Notes from './Notes.svelte';\\n import ShipItem from \\"./ShipItem/index.svelte\\";\\n import Field from \\"./Field/index.svelte\\";\\n import Hull from \\"./Hull/index.svelte\\";\\n import Firecons from \\"./Firecons.svelte\\";\\n import Propulsion from \\"./Propulsion/index.svelte\\";\\n import Section from \\"./Section/index.svelte\\";\\n import Weapon from \\"./Weapon/index.svelte\\";\\n import Carrier from \\"./Carrier/index.svelte\\";\\n import ADFC from \\"./Weaponry/ADFC/index.svelte\\";\\n import AddWeapon from \\"./Weaponry/AddWeapon/index.svelte\\";\\n\\n const ship = shipStore();\\n\\n setContext(\\"ship\\", ship);\\n\\n let ship_name = $ship.general.name;\\n\\n const change_name = (event) =>\\n ship.dispatch(ship.actions.set_name(event.target.value));\\n\\n const change_mass = ({ target: { value } }) =>\\n ship.dispatch(ship.actions.set_ship_mass(parseInt(value)));\\n\\n const add_weapon = () => ship.dispatch.add_weapon();\\n\\n const change_ftl = ({ detail }) => ship.dispatch.set_ftl(detail);\\n const change_engine = ({ detail }) => ship.dispatch.set_engine(detail);\\n const change_hull = ({ detail }) => ship.dispatch.set_hull(detail);\\n const change_firecons = ({ detail }) => ship.dispatch.set_firecons(detail);\\n const change_weapon = ({ detail }) => ship.dispatch.set_weapon(detail);\\n\\n let weapons = [];\\n $: console.log(weapons);\\n $: weapons = $ship.weaponry.weapons;\\n\\n const reset = ship.dispatch.reset;\\n\\n const set_screens = ({ detail }) => ship.d
};
const App = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $ship, $$unsubscribe_ship;
const ship = shipStore();
$$unsubscribe_ship = subscribe(ship, (value) => $ship = value);
setContext("ship", ship);
$ship.general.name;
let weapons2 = [];
ship.dispatch.reset;
setContext("ship_change", ship.dispatch);
$$result.css.add(css);
weapons2 = $ship.weaponry.weapons;
{
console.log(weapons2);
}
$$unsubscribe_ship();
return `${validate_component(Header, "Header").$$render($$result, {}, {}, {})}
<nav class="${"svelte-4zjur4"}"><input class="${"reset button small red svelte-4zjur4"}" type="${"button"}" value="${"reset"}">
<div class="${"spacer svelte-4zjur4"}"></div>
<input type="${"button"}" class="${"button small notes svelte-4zjur4"}" value="${"notes"}">
<ul class="${"button-group"}"><input type="${"button"}" class="${"button small green"}" value="${"editor"}">
<input type="${"button"}" class="${"button small green"}" value="${"json"}">
<input type="${"button"}" class="${"button small green"}" value="${"print"}"></ul></nav>
${``}
${`${`<main class="${"svelte-4zjur4"}">${validate_component(ShipSpecs, "ShipSpecs").$$render($$result, {}, {}, {})}
${validate_component(Propulsion, "Propulsion").$$render($$result, {ftl: $ship.ftl, engine: $ship.engine}, {}, {})}
${validate_component(Hull, "Hull").$$render($$result, Object.assign({ship_mass: $ship.general.mass}, $ship.structure.hull, {screens: $ship.structure.screens}, {armour: $ship.structure.armour}, {cargo: $ship.cargo}, {streamlining: $ship.streamlining}), {}, {})}
${validate_component(Section, "Section").$$render($$result, {label: "weaponry"}, {}, {
default: () => `${validate_component(Firecons, "Firecons").$$render($$result, Object.assign($ship.weaponry.firecons), {}, {})}
${validate_component(ADFC, "ADFC").$$render($$result, Object.assign($ship.weaponry.adfc), {}, {})}
${validate_component(AddWeapon, "AddWeapon").$$render($$result, {}, {}, {})}
${each(weapons2, (weapon) => `${validate_component(Weapon, "Weapon").$$render($$result, {
weapon,
id: weapon.id,
cost: weapon.cost,
mass: weapon.mass
}, {}, {})}`)}`
})}
${validate_component(Carrier, "Carrier").$$render($$result, Object.assign($ship.carrier), {}, {})}</main>
<footer class="${"svelte-4zjur4"}">Written by <a href="${"https://twitter.com/yenzie"}">Yanick Champoux</a>.
Code available on <a href="${"https://github.com/yanick/aotds-shipyard"}">Github</a></footer>`}`}`;
});
const Routes = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `${validate_component(App, "App").$$render($$result, {}, {}, {})}`;
});
var index = /* @__PURE__ */ Object.freeze({
__proto__: null,
[Symbol.toStringTag]: "Module",
"default": Routes
});
export {init, render};