Initial commit

This commit is contained in:
2023-04-04 00:00:04 -04:00
commit bfc698c49c
80 changed files with 72665 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
let HttpError = class HttpError2 {
/**
* @param {number} status
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
*/
constructor(status, body) {
this.status = status;
if (typeof body === "string") {
this.body = { message: body };
} else if (body) {
this.body = body;
} else {
this.body = { message: `Error: ${status}` };
}
}
toString() {
return JSON.stringify(this.body);
}
};
let Redirect = class Redirect2 {
/**
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
* @param {string} location
*/
constructor(status, location) {
this.status = status;
this.location = location;
}
};
let ActionFailure = class ActionFailure2 {
/**
* @param {number} status
* @param {T} [data]
*/
constructor(status, data) {
this.status = status;
this.data = data;
}
};
function error(status, message) {
if (isNaN(status) || status < 400 || status > 599) {
throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);
}
return new HttpError(status, message);
}
function json(data, init) {
const body = JSON.stringify(data);
const headers = new Headers(init?.headers);
if (!headers.has("content-length")) {
headers.set("content-length", encoder.encode(body).byteLength.toString());
}
if (!headers.has("content-type")) {
headers.set("content-type", "application/json");
}
return new Response(body, {
...init,
headers
});
}
const encoder = new TextEncoder();
function text(body, init) {
const headers = new Headers(init?.headers);
if (!headers.has("content-length")) {
headers.set("content-length", encoder.encode(body).byteLength.toString());
}
return new Response(body, {
...init,
headers
});
}
export {
ActionFailure as A,
HttpError as H,
Redirect as R,
error as e,
json as j,
text as t
};

View File

@@ -0,0 +1,92 @@
import { n as noop, a as subscribe, r as run_all, o as safe_not_equal, p as is_function } from "./index3.js";
const subscriber_queue = [];
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
function writable(value, start = noop) {
let stop;
const subscribers = /* @__PURE__ */ new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe2(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe: subscribe2 };
}
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
const stores_array = single ? [stores] : stores;
const auto = fn.length < 2;
return readable(initial_value, (set) => {
let started = false;
const values = [];
let pending = 0;
let cleanup = noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set);
if (auto) {
set(result);
} else {
cleanup = is_function(result) ? result : noop;
}
};
const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
values[i] = value;
pending &= ~(1 << i);
if (started) {
sync();
}
}, () => {
pending |= 1 << i;
}));
started = true;
sync();
return function stop() {
run_all(unsubscribers);
cleanup();
started = false;
};
});
}
export {
derived as d,
readable as r,
writable as w
};

View File

@@ -0,0 +1,254 @@
function noop() {
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");
}
function subscribe(store, ...callbacks) {
if (store == null) {
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function get_store_value(store) {
let value;
subscribe(store, (_) => value = _)();
return value;
}
function compute_rest_props(props, keys) {
const rest = {};
keys = new Set(keys);
for (const k in props)
if (!keys.has(k) && k[0] !== "$")
rest[k] = props[k];
return rest;
}
let current_component;
function set_current_component(component) {
current_component = component;
}
function get_current_component() {
if (!current_component)
throw new Error("Function called outside component initialization");
return current_component;
}
function setContext(key, context) {
get_current_component().$$.context.set(key, context);
return context;
}
function getContext(key) {
return get_current_component().$$.context.get(key);
}
const _boolean_attributes = [
"allowfullscreen",
"allowpaymentrequest",
"async",
"autofocus",
"autoplay",
"checked",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"inert",
"ismap",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected"
];
const boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);
const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === "!doctype";
}
const invalid_attribute_name_character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
function spread(args, attrs_to_add) {
const attributes = Object.assign({}, ...args);
if (attrs_to_add) {
const classes_to_add = attrs_to_add.classes;
const styles_to_add = attrs_to_add.styles;
if (classes_to_add) {
if (attributes.class == null) {
attributes.class = classes_to_add;
} else {
attributes.class += " " + classes_to_add;
}
}
if (styles_to_add) {
if (attributes.style == null) {
attributes.style = style_object_to_string(styles_to_add);
} else {
attributes.style = style_object_to_string(merge_ssr_styles(attributes.style, styles_to_add));
}
}
}
let str = "";
Object.keys(attributes).forEach((name) => {
if (invalid_attribute_name_character.test(name))
return;
const value = attributes[name];
if (value === true)
str += " " + name;
else if (boolean_attributes.has(name.toLowerCase())) {
if (value)
str += " " + name;
} else if (value != null) {
str += ` ${name}="${value}"`;
}
});
return str;
}
function merge_ssr_styles(style_attribute, style_directive) {
const style_object = {};
for (const individual_style of style_attribute.split(";")) {
const colon_index = individual_style.indexOf(":");
const name = individual_style.slice(0, colon_index).trim();
const value = individual_style.slice(colon_index + 1).trim();
if (!name)
continue;
style_object[name] = value;
}
for (const name in style_directive) {
const value = style_directive[name];
if (value) {
style_object[name] = value;
} else {
delete style_object[name];
}
}
return style_object;
}
const ATTR_REGEX = /[&"]/g;
const CONTENT_REGEX = /[&<]/g;
function escape(value, is_attr = false) {
const str = String(value);
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
pattern.lastIndex = 0;
let escaped = "";
let last = 0;
while (pattern.test(str)) {
const i = pattern.lastIndex - 1;
const ch = str[i];
escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === '"' ? "&quot;" : "&lt;");
last = i + 1;
}
return escaped + str.substring(last);
}
function escape_attribute_value(value) {
const should_escape = typeof value === "string" || value && typeof value === "object";
return should_escape ? escape(value, true) : value;
}
function escape_object(obj) {
const result = {};
for (const key in obj) {
result[key] = escape_attribute_value(obj[key]);
}
return result;
}
function each(items, fn) {
let str = "";
for (let i = 0; i < items.length; i += 1) {
str += fn(items[i], i);
}
return str;
}
const missing_component = {
$$render: () => ""
};
function validate_component(component, name) {
if (!component || !component.$$render) {
if (name === "svelte:component")
name += " this={...}";
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);
}
return component;
}
let on_destroy;
function create_ssr_component(fn) {
function $$render(result, props, bindings, slots, context) {
const parent_component = current_component;
const $$ = {
on_destroy,
context: new Map(context || (parent_component ? parent_component.$$.context : [])),
// these will be immediately discarded
on_mount: [],
before_update: [],
after_update: [],
callbacks: blank_object()
};
set_current_component({ $$ });
const html = fn(result, props, bindings, slots);
set_current_component(parent_component);
return html;
}
return {
render: (props = {}, { $$slots = {}, context = /* @__PURE__ */ new Map() } = {}) => {
on_destroy = [];
const result = { title: "", head: "", css: /* @__PURE__ */ new Set() };
const html = $$render(result, props, {}, $$slots, context);
run_all(on_destroy);
return {
html,
css: {
code: Array.from(result.css).map((css) => css.code).join("\n"),
map: null
// TODO
},
head: result.title + result.head
};
},
$$render
};
}
function add_attribute(name, value, boolean) {
if (value == null || boolean && !value)
return "";
const assignment = boolean && value === true ? "" : `="${escape(value, true)}"`;
return ` ${name}${assignment}`;
}
function style_object_to_string(style_object) {
return Object.keys(style_object).filter((key) => style_object[key]).map((key) => `${key}: ${escape_attribute_value(style_object[key])};`).join(" ");
}
export {
subscribe as a,
get_store_value as b,
create_ssr_component as c,
each as d,
escape as e,
spread as f,
getContext as g,
escape_object as h,
is_void as i,
add_attribute as j,
compute_rest_props as k,
escape_attribute_value as l,
missing_component as m,
noop as n,
safe_not_equal as o,
is_function as p,
run_all as r,
setContext as s,
validate_component as v
};

View File

@@ -0,0 +1,187 @@
import { c as create_ssr_component, s as setContext, v as validate_component, m as missing_component } from "./index3.js";
let base = "";
let assets = base;
const initial = { base, assets };
function reset() {
base = initial.base;
assets = initial.assets;
}
function set_assets(path) {
assets = initial.assets = path;
}
let public_env = {};
function set_private_env(environment) {
}
function set_public_env(environment) {
public_env = environment;
}
function afterUpdate() {
}
function set_building() {
}
const Root = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { stores } = $$props;
let { page } = $$props;
let { constructors } = $$props;
let { components = [] } = $$props;
let { form } = $$props;
let { data_0 = null } = $$props;
let { data_1 = null } = $$props;
{
setContext("__svelte__", stores);
}
afterUpdate(stores.page.notify);
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.constructors === void 0 && $$bindings.constructors && constructors !== void 0)
$$bindings.constructors(constructors);
if ($$props.components === void 0 && $$bindings.components && components !== void 0)
$$bindings.components(components);
if ($$props.form === void 0 && $$bindings.form && form !== void 0)
$$bindings.form(form);
if ($$props.data_0 === void 0 && $$bindings.data_0 && data_0 !== void 0)
$$bindings.data_0(data_0);
if ($$props.data_1 === void 0 && $$bindings.data_1 && data_1 !== void 0)
$$bindings.data_1(data_1);
let $$settled;
let $$rendered;
do {
$$settled = true;
{
stores.page.set(page);
}
$$rendered = `
${constructors[1] ? `${validate_component(constructors[0] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_0, this: components[0] },
{
this: ($$value) => {
components[0] = $$value;
$$settled = false;
}
},
{
default: () => {
return `${validate_component(constructors[1] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_1, form, this: components[1] },
{
this: ($$value) => {
components[1] = $$value;
$$settled = false;
}
},
{}
)}`;
}
}
)}` : `${validate_component(constructors[0] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_0, form, this: components[0] },
{
this: ($$value) => {
components[0] = $$value;
$$settled = false;
}
},
{}
)}`}
${``}`;
} while (!$$settled);
return $$rendered;
});
const options = {
app_template_contains_nonce: false,
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
csrf_check_origin: true,
embedded: false,
env_public_prefix: "PUBLIC_",
hooks: null,
// added lazily, via `get_hooks`
preload_strategy: "modulepreload",
root: Root,
service_worker: false,
templates: {
app: ({ head, body, assets: assets2, nonce, env }) => '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets2 + '/favicon.png" />\n <meta name="viewport" content="width=device-width" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
error: ({ status, message }) => '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
<style>
body {
--bg: white;
--fg: #222;
--divider: #ccc;
background: var(--bg);
color: var(--fg);
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.error {
display: flex;
align-items: center;
max-width: 32rem;
margin: 0 1rem;
}
.status {
font-weight: 200;
font-size: 3rem;
line-height: 1;
position: relative;
top: -0.05rem;
}
.message {
border-left: 1px solid var(--divider);
padding: 0 0 0 1rem;
margin: 0 0 0 1rem;
min-height: 2.5rem;
display: flex;
align-items: center;
}
.message h1 {
font-weight: 400;
font-size: 1em;
margin: 0;
}
@media (prefers-color-scheme: dark) {
body {
--bg: #222;
--fg: #ddd;
--divider: #666;
}
}
</style>
</head>
<body>
<div class="error">
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
},
version_hash: "10ptubg"
};
function get_hooks() {
return {};
}
export {
assets as a,
base as b,
set_assets as c,
set_building as d,
set_private_env as e,
get_hooks as g,
options as o,
public_env as p,
reset as r,
set_public_env as s
};

View File

@@ -0,0 +1,30 @@
import { g as getContext, c as create_ssr_component, a as subscribe, e as escape } from "../../chunks/index3.js";
const getStores = () => {
const stores = getContext("__svelte__");
return {
page: {
subscribe: stores.page.subscribe
},
navigating: {
subscribe: stores.navigating.subscribe
},
updated: stores.updated
};
};
const page = {
/** @param {(value: any) => void} fn */
subscribe(fn) {
const store = getStores().page;
return store.subscribe(fn);
}
};
const Error$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $page, $$unsubscribe_page;
$$unsubscribe_page = subscribe(page, (value) => $page = value);
$$unsubscribe_page();
return `<h1>${escape($page.status)}</h1>
<p>${escape($page.error?.message)}</p>`;
});
export {
Error$1 as default
};

View File

@@ -0,0 +1,8 @@
import { c as create_ssr_component } from "../../chunks/index3.js";
const app = "";
const Layout = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<div class="flex flex-col items-center py-14">${slots.default ? slots.default({}) : ``}</div>`;
});
export {
Layout as default
};

View File

@@ -0,0 +1,402 @@
import { c as create_ssr_component, b as get_store_value, a as subscribe$1, v as validate_component, d as each, e as escape, g as getContext, m as missing_component, f as spread, h as escape_object, i as is_void, j as add_attribute, k as compute_rest_props, l as escape_attribute_value } from "../../chunks/index3.js";
import { SSE } from "sse.js";
import { w as writable, d as derived } from "../../chunks/index2.js";
import { marked } from "marked";
import DOMPurify from "isomorphic-dompurify";
const Chat = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`;
});
const Pencil = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>`;
});
const Plus = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>`;
});
const Trash = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>`;
});
const { subscribe, update, ...store } = writable({
messages: [
{ role: "assistant", content: "Welcome! Please introduce yourself to your AI competitor." }
],
chatState: "idle"
});
const set = async (query) => {
updateMessages(query, "user", "loading");
request();
};
const request = async (query) => {
const eventSource = new SSE("/api/chat", {
headers: {
"Content-Type": "application/json"
},
payload: JSON.stringify({ messages: get_store_value(chatMessages).messages })
});
eventSource.addEventListener("error", handleError);
eventSource.addEventListener("message", streamMessage);
eventSource.stream();
};
const replace = (messages) => {
store.set(messages);
};
const reset = () => store.set({
messages: [
{ role: "assistant", content: "Welcome! Please introduce yourself to your AI competitor." }
],
chatState: "idle"
});
const updateMessages = (content, role, state) => {
chatMessages.update((messages) => {
return { messages: [...messages.messages, { role, content }], chatState: state };
});
};
const handleError = (err) => {
updateMessages(err, "system", "error");
console.error(err);
};
const streamMessage = (e) => {
try {
if (e.data === "[DONE]") {
updateMessages(get_store_value(answer), "assistant", "idle");
return answer.set("");
}
if (get_store_value(answer) === "...")
answer.set("");
const completionResponse = JSON.parse(e.data);
const [{ delta }] = completionResponse.choices;
if (delta.content) {
answer.update((_a) => _a + delta.content);
}
} catch (err) {
handleError(err);
}
};
const chatMessages = { subscribe, set, update, reset, replace };
const answer = writable("");
const chatHistory = derived(chatMessages, ($chatMessages) => {
return null;
});
const ChatHistory = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $$unsubscribe_chatHistory;
$$unsubscribe_chatHistory = subscribe$1(chatHistory, (value) => value);
let chatHistoryKeys = [];
$$unsubscribe_chatHistory();
return `<div class="h-[700px] w-[350px] bg-black bg-opacity-20 rounded-md py-4 px-2 overflow-y-auto flex flex-col gap-2"><button class="flex py-3 px-3 items-center gap-3 rounded-md hover:bg-gray-500/10 transition-colors duration-200 text-white cursor-pointer text-sm mb-2 flex-shrink-0 border border-white/20">${validate_component(Plus, "Plus").$$render($$result, {}, {}, {})} New Game
</button>
${chatHistoryKeys.length > 0 ? `${each(chatHistoryKeys, (message) => {
return `
<div class="flex py-3 px-3 items-center gap-3 relative rounded-md cursor-pointer break-all pr-14 bg-opacity-40 hover:bg-white/5 bg-black group animate-flash text-sm">${validate_component(Chat, "Chat").$$render($$result, {}, {}, {})}
<div class="flex-1 text-ellipsis max-h-5 overflow-hidden break-all relative">${escape(message)}</div>
<div class="absolute flex right-1 z-10 text-gray-300 visible"><button class="p-1 hover:text-white">${validate_component(Pencil, "Pencil").$$render($$result, {}, {}, {})}</button>
<button class="p-1 hover:text-white">${validate_component(Trash, "Trash").$$render($$result, {}, {}, {})}
</button></div>
</div>`;
})}` : ``}</div>`;
});
const componentsContextKey = {};
const getComponentsContext = () => getContext(componentsContextKey);
const Renderer = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $components, $$unsubscribe_components;
let { astNode } = $$props;
let { __index = 0 } = $$props;
let { type = void 0 } = $$props;
let { position = void 0 } = $$props;
const components = getComponentsContext();
$$unsubscribe_components = subscribe$1(components, (value) => $components = value);
if ($$props.astNode === void 0 && $$bindings.astNode && astNode !== void 0)
$$bindings.astNode(astNode);
if ($$props.__index === void 0 && $$bindings.__index && __index !== void 0)
$$bindings.__index(__index);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.position === void 0 && $$bindings.position && position !== void 0)
$$bindings.position(position);
$$unsubscribe_components();
return `${astNode.type === "root" ? `${validate_component(Children, "Children").$$render($$result, Object.assign({}, astNode), {}, {})}` : `${astNode.type === "element" ? `${validate_component($components[astNode.tagName] || missing_component, "svelte:component").$$render($$result, Object.assign({}, astNode, { __index }), {}, {})}` : `${$components[astNode.type] !== void 0 ? `${validate_component($components[astNode.type] || missing_component, "svelte:component").$$render($$result, Object.assign({}, astNode, { __index }), {}, {})}` : ``}`}`}`;
});
const Children = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { children } = $$props;
let { type = void 0 } = $$props;
let { position = void 0 } = $$props;
let { __index = void 0 } = $$props;
if ($$props.children === void 0 && $$bindings.children && children !== void 0)
$$bindings.children(children);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.position === void 0 && $$bindings.position && position !== void 0)
$$bindings.position(position);
if ($$props.__index === void 0 && $$bindings.__index && __index !== void 0)
$$bindings.__index(__index);
return `${each(children, (child, __index2) => {
return `${validate_component(Renderer, "Renderer").$$render($$result, { astNode: child, __index: __index2 }, {}, {})}`;
})}`;
});
const Default = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { tagName } = $$props;
let { children } = $$props;
let { properties } = $$props;
let { type = void 0 } = $$props;
let { position = void 0 } = $$props;
let { __index = void 0 } = $$props;
if ($$props.tagName === void 0 && $$bindings.tagName && tagName !== void 0)
$$bindings.tagName(tagName);
if ($$props.children === void 0 && $$bindings.children && children !== void 0)
$$bindings.children(children);
if ($$props.properties === void 0 && $$bindings.properties && properties !== void 0)
$$bindings.properties(properties);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.position === void 0 && $$bindings.position && position !== void 0)
$$bindings.position(position);
if ($$props.__index === void 0 && $$bindings.__index && __index !== void 0)
$$bindings.__index(__index);
return `${Array.isArray(children) && children.length !== 0 ? `
${((tag) => {
return tag ? `<${tagName}${spread([escape_object(properties)], {})}>${is_void(tag) ? "" : `${validate_component(Children, "Children").$$render($$result, { children }, {}, {})}`}${is_void(tag) ? "" : `</${tag}>`}` : "";
})(tagName)}` : `
${((tag) => {
return tag ? `<${tagName}${spread([escape_object(properties)], {})}>${is_void(tag) ? "" : ``}${is_void(tag) ? "" : `</${tag}>`}` : "";
})(tagName)}`}`;
});
const defaultTags = [
// Content sectioning
"address",
"article",
"aside",
"footer",
"header",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"main",
"nav",
"section",
// Text content
"blockquote",
"dd",
"div",
"dl",
"dt",
"figcaption",
"figure",
"hr",
"li",
"menu",
"ol",
"p",
"pre",
"ul",
// Inline text semantics
"a",
"abbr",
"b",
"bdi",
"bdo",
"br",
"cite",
"code",
"data",
"dfn",
"em",
"i",
"kbd",
"mark",
"q",
"rp",
"rt",
"ruby",
"s",
"samp",
"small",
"span",
"strong",
"sub",
"sup",
"time",
"u",
"var",
"wbr",
// Image and multimedia
"area",
"audio",
"img",
"map",
"track",
"video",
// Embedded content
"embed",
"iframe",
"object",
"param",
"picture",
"portal",
"source",
// SVG and MathML
"svg",
"math",
// Demarcating edits
"del",
"ins",
// Table content
"caption",
"col",
"colgroup",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"tr",
// Forms
"button",
"datalist",
"fieldset",
"form",
"input",
"label",
"legend",
"meter",
"optgroup",
"option",
"output",
"progress",
"select",
"textarea",
// Interactive elements
"details",
"dialog",
"summary"
];
const htmlComponents = defaultTags.reduce((acc, tag) => ({ ...acc, [tag]: Default }), {});
const Text = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { value = "" } = $$props;
let { type = void 0 } = $$props;
let { position = void 0 } = $$props;
let { __index = void 0 } = $$props;
if ($$props.value === void 0 && $$bindings.value && value !== void 0)
$$bindings.value(value);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.position === void 0 && $$bindings.position && position !== void 0)
$$bindings.position(position);
if ($$props.__index === void 0 && $$bindings.__index && __index !== void 0)
$$bindings.__index(__index);
return `${escape(value)}`;
});
({
...htmlComponents,
text: Text,
raw: Text
});
const ChatMessage = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { type } = $$props;
let { message = "" } = $$props;
let { class: classes = "" } = $$props;
let scrollToDiv;
const classSet = {
user: "justify-end text-rose-700",
assistant: "justify-start text-teal-400",
system: "justify-center text-gray-400"
};
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.message === void 0 && $$bindings.message && message !== void 0)
$$bindings.message(message);
if ($$props.class === void 0 && $$bindings.class && classes !== void 0)
$$bindings.class(classes);
return `<div class="${"flex items-center " + escape(classSet[type], true)}"><p class="text-xs px-2">${escape(type === "user" ? "Me" : "Bot")}</p></div>
<div class="${"flex " + escape(classSet[type], true)}"><div class="${"bg-black py-0.5 px-4 max-w-2xl rounded leading-loose " + escape(classes, true) + " " + escape(classSet[type], true)}"><!-- HTML_TAG_START -->${DOMPurify.sanitize(marked.parse(message))}<!-- HTML_TAG_END --></div>
<div${add_attribute("this", scrollToDiv, 0)}></div></div>`;
});
const Input = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $$restProps = compute_rest_props($$props, ["value", "placeholder", "name", "type", "label", "class"]);
let { value } = $$props;
let { placeholder = "" } = $$props;
let { name = "" } = $$props;
let { type = "text" } = $$props;
let { label = "" } = $$props;
let { class: classes = "" } = $$props;
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);
if ($$props.name === void 0 && $$bindings.name && name !== void 0)
$$bindings.name(name);
if ($$props.type === void 0 && $$bindings.type && type !== void 0)
$$bindings.type(type);
if ($$props.label === void 0 && $$bindings.label && label !== void 0)
$$bindings.label(label);
if ($$props.class === void 0 && $$bindings.class && classes !== void 0)
$$bindings.class(classes);
return `<div class="${"flex flex-col min-w-xl " + escape(classes, true)}"><label class="text-xs"${add_attribute("for", name, 0)}>${escape(label)}</label>
<input${spread(
[
{ name: escape_attribute_value(name) },
{
placeholder: escape_attribute_value(placeholder)
},
{
class: "shadow bg-white/10 rounded-md px-4 py-1.5 min-w-xl text-teal-300 border border-transparent focus:outline-none focus:ring-1 focus:ring-teal-300 focus:border-transparent"
},
escape_object($$restProps)
],
{}
)}${add_attribute("value", value, 0)}></div>`;
});
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $chatMessages, $$unsubscribe_chatMessages;
let $answer, $$unsubscribe_answer;
$$unsubscribe_chatMessages = subscribe$1(chatMessages, (value) => $chatMessages = value);
$$unsubscribe_answer = subscribe$1(answer, (value) => $answer = value);
let query = "";
let $$settled;
let $$rendered;
do {
$$settled = true;
$$rendered = `<section class="flex max-w-6xl w-full pt-4 justify-center"><div class="flex flex-col gap-2">${validate_component(ChatHistory, "ChatHistory").$$render($$result, {}, {}, {})}</div>
<div class="flex flex-col w-full px-8 items-center gap-2"><div class="h-[700px] w-full bg-black bg-opacity-20 rounded-md p-4 overflow-y-auto flex flex-col gap-4"><div class="flex flex-col gap-2">${each($chatMessages.messages, (message) => {
return `${validate_component(ChatMessage, "ChatMessage").$$render(
$$result,
{
type: message.role,
message: message.content
},
{},
{}
)}`;
})}
${$answer ? `${validate_component(ChatMessage, "ChatMessage").$$render($$result, { type: "assistant", message: $answer }, {}, {})}` : ``}</div></div>
<form class="flex w-full rounded-md gap-4 bg-black bg-opacity-20 p-2">${validate_component(Input, "Input").$$render(
$$result,
{
type: "text",
class: "w-full",
value: query
},
{
value: ($$value) => {
query = $$value;
$$settled = false;
}
},
{}
)}
<button type="submit" class="bg-black bg-opacity-40 hover:bg-white/5 px-8 py-1.5 border border-black/40 ml-[-0.5rem] rounded-md text-teal-300">Send
</button></form></div></section>`;
} while (!$$settled);
$$unsubscribe_chatMessages();
$$unsubscribe_answer();
return $$rendered;
});
export {
Page as default
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
export const index = 0;
export const component = async () => (await import('../entries/pages/_layout.svelte.js')).default;
export const file = '_app/immutable/entry/_layout.svelte.62a505d3.js';
export const imports = ["_app/immutable/entry/_layout.svelte.62a505d3.js","_app/immutable/chunks/index.3641fafa.js"];
export const stylesheets = ["_app/immutable/assets/_layout.b9bcc4f4.css"];
export const fonts = [];

View File

@@ -0,0 +1,8 @@
export const index = 1;
export const component = async () => (await import('../entries/fallbacks/error.svelte.js')).default;
export const file = '_app/immutable/entry/error.svelte.a6bd0229.js';
export const imports = ["_app/immutable/entry/error.svelte.a6bd0229.js","_app/immutable/chunks/index.3641fafa.js","_app/immutable/chunks/singletons.8077db6c.js","_app/immutable/chunks/index.fa397836.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -0,0 +1,8 @@
export const index = 2;
export const component = async () => (await import('../entries/pages/_page.svelte.js')).default;
export const file = '_app/immutable/entry/_page.svelte.2f89fa28.js';
export const imports = ["_app/immutable/entry/_page.svelte.2f89fa28.js","_app/immutable/chunks/index.3641fafa.js","_app/immutable/chunks/index.fa397836.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -0,0 +1,51 @@
import { installPolyfills } from '@sveltejs/kit/node/polyfills';
import { getRequest, setResponse } from '@sveltejs/kit/node';
import { Server } from '../output/server/index.js';
import { manifest } from './manifest.js';
installPolyfills();
const server = new Server(manifest);
await server.init({
env: /** @type {Record<string, string>} */ (process.env)
});
const DATA_SUFFIX = '/__data.json';
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
*/
export default async (req, res) => {
if (req.url) {
const [path, search] = req.url.split('?');
const params = new URLSearchParams(search);
const pathname = params.get('__pathname');
if (pathname) {
params.delete('__pathname');
req.url = `${pathname}${path.endsWith(DATA_SUFFIX) ? DATA_SUFFIX : ''}?${params}`;
}
}
/** @type {Request} */
let request;
try {
request = await getRequest({ base: `https://${req.headers.host}`, request: req });
} catch (err) {
res.statusCode = /** @type {any} */ (err).status || 400;
return res.end('Invalid request body');
}
setResponse(
res,
await server.respond(request, {
getClientAddress() {
return /** @type {string} */ (request.headers.get('x-forwarded-for'));
}
})
);
};

View File

@@ -0,0 +1,27 @@
export const manifest = {
appDir: "_app",
appPath: "_app",
assets: new Set(["favicon.png"]),
mimeTypes: {".png":"image/png"},
_: {
client: {"start":{"file":"_app/immutable/entry/start.c62adf58.js","imports":["_app/immutable/entry/start.c62adf58.js","_app/immutable/chunks/index.3641fafa.js","_app/immutable/chunks/singletons.8077db6c.js","_app/immutable/chunks/index.fa397836.js"],"stylesheets":[],"fonts":[]},"app":{"file":"_app/immutable/entry/app.c59518f6.js","imports":["_app/immutable/entry/app.c59518f6.js","_app/immutable/chunks/index.3641fafa.js"],"stylesheets":[],"fonts":[]}},
nodes: [
() => import('../output/server/nodes/0.js'),
() => import('../output/server/nodes/1.js'),
() => import('../output/server/nodes/2.js')
],
routes: [
{
id: "/",
pattern: /^\/$/,
params: [],
page: { layouts: [0], errors: [1], leaf: 2 },
endpoint: null
}
],
matchers: async () => {
return { };
}
}
};

View File

@@ -0,0 +1,6 @@
{
"runtime": "nodejs18.x",
"handler": ".svelte-kit/vercel-tmp/index.js",
"launcherType": "Nodejs",
"experimentalResponseStreaming": true
}

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,5 @@
{
"runtime": "edge",
"envVarsInUse": [],
"entrypoint": "index.js"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,78 @@
let HttpError = class HttpError2 {
/**
* @param {number} status
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
*/
constructor(status, body) {
this.status = status;
if (typeof body === "string") {
this.body = { message: body };
} else if (body) {
this.body = body;
} else {
this.body = { message: `Error: ${status}` };
}
}
toString() {
return JSON.stringify(this.body);
}
};
let Redirect = class Redirect2 {
/**
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
* @param {string} location
*/
constructor(status, location) {
this.status = status;
this.location = location;
}
};
let ActionFailure = class ActionFailure2 {
/**
* @param {number} status
* @param {T} [data]
*/
constructor(status, data) {
this.status = status;
this.data = data;
}
};
function error(status, message) {
if (isNaN(status) || status < 400 || status > 599) {
throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);
}
return new HttpError(status, message);
}
function json(data, init) {
const body = JSON.stringify(data);
const headers = new Headers(init?.headers);
if (!headers.has("content-length")) {
headers.set("content-length", encoder.encode(body).byteLength.toString());
}
if (!headers.has("content-type")) {
headers.set("content-type", "application/json");
}
return new Response(body, {
...init,
headers
});
}
const encoder = new TextEncoder();
function text(body, init) {
const headers = new Headers(init?.headers);
if (!headers.has("content-length")) {
headers.set("content-length", encoder.encode(body).byteLength.toString());
}
return new Response(body, {
...init,
headers
});
}
export {
ActionFailure as A,
HttpError as H,
Redirect as R,
error as e,
json as j,
text as t
};

View File

@@ -0,0 +1,92 @@
import { n as noop, a as subscribe, r as run_all, o as safe_not_equal, p as is_function } from "./index3.js";
const subscriber_queue = [];
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
function writable(value, start = noop) {
let stop;
const subscribers = /* @__PURE__ */ new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe2(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe: subscribe2 };
}
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
const stores_array = single ? [stores] : stores;
const auto = fn.length < 2;
return readable(initial_value, (set) => {
let started = false;
const values = [];
let pending = 0;
let cleanup = noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set);
if (auto) {
set(result);
} else {
cleanup = is_function(result) ? result : noop;
}
};
const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {
values[i] = value;
pending &= ~(1 << i);
if (started) {
sync();
}
}, () => {
pending |= 1 << i;
}));
started = true;
sync();
return function stop() {
run_all(unsubscribers);
cleanup();
started = false;
};
});
}
export {
derived as d,
readable as r,
writable as w
};

View File

@@ -0,0 +1,254 @@
function noop() {
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");
}
function subscribe(store, ...callbacks) {
if (store == null) {
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function get_store_value(store) {
let value;
subscribe(store, (_) => value = _)();
return value;
}
function compute_rest_props(props, keys) {
const rest = {};
keys = new Set(keys);
for (const k in props)
if (!keys.has(k) && k[0] !== "$")
rest[k] = props[k];
return rest;
}
let current_component;
function set_current_component(component) {
current_component = component;
}
function get_current_component() {
if (!current_component)
throw new Error("Function called outside component initialization");
return current_component;
}
function setContext(key, context) {
get_current_component().$$.context.set(key, context);
return context;
}
function getContext(key) {
return get_current_component().$$.context.get(key);
}
const _boolean_attributes = [
"allowfullscreen",
"allowpaymentrequest",
"async",
"autofocus",
"autoplay",
"checked",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"inert",
"ismap",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected"
];
const boolean_attributes = /* @__PURE__ */ new Set([..._boolean_attributes]);
const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === "!doctype";
}
const invalid_attribute_name_character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
function spread(args, attrs_to_add) {
const attributes = Object.assign({}, ...args);
if (attrs_to_add) {
const classes_to_add = attrs_to_add.classes;
const styles_to_add = attrs_to_add.styles;
if (classes_to_add) {
if (attributes.class == null) {
attributes.class = classes_to_add;
} else {
attributes.class += " " + classes_to_add;
}
}
if (styles_to_add) {
if (attributes.style == null) {
attributes.style = style_object_to_string(styles_to_add);
} else {
attributes.style = style_object_to_string(merge_ssr_styles(attributes.style, styles_to_add));
}
}
}
let str = "";
Object.keys(attributes).forEach((name) => {
if (invalid_attribute_name_character.test(name))
return;
const value = attributes[name];
if (value === true)
str += " " + name;
else if (boolean_attributes.has(name.toLowerCase())) {
if (value)
str += " " + name;
} else if (value != null) {
str += ` ${name}="${value}"`;
}
});
return str;
}
function merge_ssr_styles(style_attribute, style_directive) {
const style_object = {};
for (const individual_style of style_attribute.split(";")) {
const colon_index = individual_style.indexOf(":");
const name = individual_style.slice(0, colon_index).trim();
const value = individual_style.slice(colon_index + 1).trim();
if (!name)
continue;
style_object[name] = value;
}
for (const name in style_directive) {
const value = style_directive[name];
if (value) {
style_object[name] = value;
} else {
delete style_object[name];
}
}
return style_object;
}
const ATTR_REGEX = /[&"]/g;
const CONTENT_REGEX = /[&<]/g;
function escape(value, is_attr = false) {
const str = String(value);
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
pattern.lastIndex = 0;
let escaped = "";
let last = 0;
while (pattern.test(str)) {
const i = pattern.lastIndex - 1;
const ch = str[i];
escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === '"' ? "&quot;" : "&lt;");
last = i + 1;
}
return escaped + str.substring(last);
}
function escape_attribute_value(value) {
const should_escape = typeof value === "string" || value && typeof value === "object";
return should_escape ? escape(value, true) : value;
}
function escape_object(obj) {
const result = {};
for (const key in obj) {
result[key] = escape_attribute_value(obj[key]);
}
return result;
}
function each(items, fn) {
let str = "";
for (let i = 0; i < items.length; i += 1) {
str += fn(items[i], i);
}
return str;
}
const missing_component = {
$$render: () => ""
};
function validate_component(component, name) {
if (!component || !component.$$render) {
if (name === "svelte:component")
name += " this={...}";
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);
}
return component;
}
let on_destroy;
function create_ssr_component(fn) {
function $$render(result, props, bindings, slots, context) {
const parent_component = current_component;
const $$ = {
on_destroy,
context: new Map(context || (parent_component ? parent_component.$$.context : [])),
// these will be immediately discarded
on_mount: [],
before_update: [],
after_update: [],
callbacks: blank_object()
};
set_current_component({ $$ });
const html = fn(result, props, bindings, slots);
set_current_component(parent_component);
return html;
}
return {
render: (props = {}, { $$slots = {}, context = /* @__PURE__ */ new Map() } = {}) => {
on_destroy = [];
const result = { title: "", head: "", css: /* @__PURE__ */ new Set() };
const html = $$render(result, props, {}, $$slots, context);
run_all(on_destroy);
return {
html,
css: {
code: Array.from(result.css).map((css) => css.code).join("\n"),
map: null
// TODO
},
head: result.title + result.head
};
},
$$render
};
}
function add_attribute(name, value, boolean) {
if (value == null || boolean && !value)
return "";
const assignment = boolean && value === true ? "" : `="${escape(value, true)}"`;
return ` ${name}${assignment}`;
}
function style_object_to_string(style_object) {
return Object.keys(style_object).filter((key) => style_object[key]).map((key) => `${key}: ${escape_attribute_value(style_object[key])};`).join(" ");
}
export {
subscribe as a,
get_store_value as b,
create_ssr_component as c,
each as d,
escape as e,
spread as f,
getContext as g,
escape_object as h,
is_void as i,
add_attribute as j,
compute_rest_props as k,
escape_attribute_value as l,
missing_component as m,
noop as n,
safe_not_equal as o,
is_function as p,
run_all as r,
setContext as s,
validate_component as v
};

View File

@@ -0,0 +1,187 @@
import { c as create_ssr_component, s as setContext, v as validate_component, m as missing_component } from "./index3.js";
let base = "";
let assets = base;
const initial = { base, assets };
function reset() {
base = initial.base;
assets = initial.assets;
}
function set_assets(path) {
assets = initial.assets = path;
}
let public_env = {};
function set_private_env(environment) {
}
function set_public_env(environment) {
public_env = environment;
}
function afterUpdate() {
}
function set_building() {
}
const Root = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { stores } = $$props;
let { page } = $$props;
let { constructors } = $$props;
let { components = [] } = $$props;
let { form } = $$props;
let { data_0 = null } = $$props;
let { data_1 = null } = $$props;
{
setContext("__svelte__", stores);
}
afterUpdate(stores.page.notify);
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.constructors === void 0 && $$bindings.constructors && constructors !== void 0)
$$bindings.constructors(constructors);
if ($$props.components === void 0 && $$bindings.components && components !== void 0)
$$bindings.components(components);
if ($$props.form === void 0 && $$bindings.form && form !== void 0)
$$bindings.form(form);
if ($$props.data_0 === void 0 && $$bindings.data_0 && data_0 !== void 0)
$$bindings.data_0(data_0);
if ($$props.data_1 === void 0 && $$bindings.data_1 && data_1 !== void 0)
$$bindings.data_1(data_1);
let $$settled;
let $$rendered;
do {
$$settled = true;
{
stores.page.set(page);
}
$$rendered = `
${constructors[1] ? `${validate_component(constructors[0] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_0, this: components[0] },
{
this: ($$value) => {
components[0] = $$value;
$$settled = false;
}
},
{
default: () => {
return `${validate_component(constructors[1] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_1, form, this: components[1] },
{
this: ($$value) => {
components[1] = $$value;
$$settled = false;
}
},
{}
)}`;
}
}
)}` : `${validate_component(constructors[0] || missing_component, "svelte:component").$$render(
$$result,
{ data: data_0, form, this: components[0] },
{
this: ($$value) => {
components[0] = $$value;
$$settled = false;
}
},
{}
)}`}
${``}`;
} while (!$$settled);
return $$rendered;
});
const options = {
app_template_contains_nonce: false,
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
csrf_check_origin: true,
embedded: false,
env_public_prefix: "PUBLIC_",
hooks: null,
// added lazily, via `get_hooks`
preload_strategy: "modulepreload",
root: Root,
service_worker: false,
templates: {
app: ({ head, body, assets: assets2, nonce, env }) => '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets2 + '/favicon.png" />\n <meta name="viewport" content="width=device-width" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
error: ({ status, message }) => '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
<style>
body {
--bg: white;
--fg: #222;
--divider: #ccc;
background: var(--bg);
color: var(--fg);
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.error {
display: flex;
align-items: center;
max-width: 32rem;
margin: 0 1rem;
}
.status {
font-weight: 200;
font-size: 3rem;
line-height: 1;
position: relative;
top: -0.05rem;
}
.message {
border-left: 1px solid var(--divider);
padding: 0 0 0 1rem;
margin: 0 0 0 1rem;
min-height: 2.5rem;
display: flex;
align-items: center;
}
.message h1 {
font-weight: 400;
font-size: 1em;
margin: 0;
}
@media (prefers-color-scheme: dark) {
body {
--bg: #222;
--fg: #ddd;
--divider: #666;
}
}
</style>
</head>
<body>
<div class="error">
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
},
version_hash: "10ptubg"
};
function get_hooks() {
return {};
}
export {
assets as a,
base as b,
set_assets as c,
set_building as d,
set_private_env as e,
get_hooks as g,
options as o,
public_env as p,
reset as r,
set_public_env as s
};

View File

@@ -0,0 +1,30 @@
import { g as getContext, c as create_ssr_component, a as subscribe, e as escape } from "../../chunks/index3.js";
const getStores = () => {
const stores = getContext("__svelte__");
return {
page: {
subscribe: stores.page.subscribe
},
navigating: {
subscribe: stores.navigating.subscribe
},
updated: stores.updated
};
};
const page = {
/** @param {(value: any) => void} fn */
subscribe(fn) {
const store = getStores().page;
return store.subscribe(fn);
}
};
const Error$1 = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $page, $$unsubscribe_page;
$$unsubscribe_page = subscribe(page, (value) => $page = value);
$$unsubscribe_page();
return `<h1>${escape($page.status)}</h1>
<p>${escape($page.error?.message)}</p>`;
});
export {
Error$1 as default
};

View File

@@ -0,0 +1,8 @@
import { c as create_ssr_component } from "../../chunks/index3.js";
const app = "";
const Layout = create_ssr_component(($$result, $$props, $$bindings, slots) => {
return `<div class="flex flex-col items-center py-14">${slots.default ? slots.default({}) : ``}</div>`;
});
export {
Layout as default
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
export const index = 0;
export const component = async () => (await import('../entries/pages/_layout.svelte.js')).default;
export const file = '_app/immutable/entry/_layout.svelte.62a505d3.js';
export const imports = ["_app/immutable/entry/_layout.svelte.62a505d3.js","_app/immutable/chunks/index.3641fafa.js"];
export const stylesheets = ["_app/immutable/assets/_layout.b9bcc4f4.css"];
export const fonts = [];

View File

@@ -0,0 +1,8 @@
export const index = 1;
export const component = async () => (await import('../entries/fallbacks/error.svelte.js')).default;
export const file = '_app/immutable/entry/error.svelte.a6bd0229.js';
export const imports = ["_app/immutable/entry/error.svelte.a6bd0229.js","_app/immutable/chunks/index.3641fafa.js","_app/immutable/chunks/singletons.8077db6c.js","_app/immutable/chunks/index.fa397836.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -0,0 +1,51 @@
import { installPolyfills } from '@sveltejs/kit/node/polyfills';
import { getRequest, setResponse } from '@sveltejs/kit/node';
import { Server } from '../output/server/index.js';
import { manifest } from './manifest.js';
installPolyfills();
const server = new Server(manifest);
await server.init({
env: /** @type {Record<string, string>} */ (process.env)
});
const DATA_SUFFIX = '/__data.json';
/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
*/
export default async (req, res) => {
if (req.url) {
const [path, search] = req.url.split('?');
const params = new URLSearchParams(search);
const pathname = params.get('__pathname');
if (pathname) {
params.delete('__pathname');
req.url = `${pathname}${path.endsWith(DATA_SUFFIX) ? DATA_SUFFIX : ''}?${params}`;
}
}
/** @type {Request} */
let request;
try {
request = await getRequest({ base: `https://${req.headers.host}`, request: req });
} catch (err) {
res.statusCode = /** @type {any} */ (err).status || 400;
return res.end('Invalid request body');
}
setResponse(
res,
await server.respond(request, {
getClientAddress() {
return /** @type {string} */ (request.headers.get('x-forwarded-for'));
}
})
);
};

View File

@@ -0,0 +1,20 @@
export const manifest = {
appDir: "_app",
appPath: "_app",
assets: new Set(["favicon.png"]),
mimeTypes: {".png":"image/png"},
_: {
client: {"start":{"file":"_app/immutable/entry/start.c62adf58.js","imports":["_app/immutable/entry/start.c62adf58.js","_app/immutable/chunks/index.3641fafa.js","_app/immutable/chunks/singletons.8077db6c.js","_app/immutable/chunks/index.fa397836.js"],"stylesheets":[],"fonts":[]},"app":{"file":"_app/immutable/entry/app.c59518f6.js","imports":["_app/immutable/entry/app.c59518f6.js","_app/immutable/chunks/index.3641fafa.js"],"stylesheets":[],"fonts":[]}},
nodes: [
() => import('../output/server/nodes/0.js'),
() => import('../output/server/nodes/1.js')
],
routes: [
],
matchers: async () => {
return { };
}
}
};

View File

@@ -0,0 +1,6 @@
{
"runtime": "nodejs18.x",
"handler": ".svelte-kit/vercel-tmp/index.js",
"launcherType": "Nodejs",
"experimentalResponseStreaming": true
}

View File

@@ -0,0 +1 @@
{"type":"module"}