@novely/solid-renderer 0.51.0-next.2 → 0.52.0-next

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.jsx CHANGED
@@ -1,4 +1,4 @@
1
- // ../../node_modules/.pnpm/solid-js@1.9.4/node_modules/solid-js/dist/solid.js
1
+ // ../../node_modules/.pnpm/solid-js@1.9.7/node_modules/solid-js/dist/solid.js
2
2
  var sharedConfig = {
3
3
  context: void 0,
4
4
  registry: void 0,
@@ -25,6 +25,7 @@ function nextHydrateContext() {
25
25
  count: 0
26
26
  };
27
27
  }
28
+ var IS_DEV = false;
28
29
  var equalFn = (a, b) => a === b;
29
30
  var $PROXY = Symbol("solid-proxy");
30
31
  var SUPPORTS_PROXY = typeof Proxy === "function";
@@ -199,12 +200,12 @@ function useContext(context) {
199
200
  }
200
201
  function children(fn) {
201
202
  const children2 = createMemo(fn);
202
- const memo = createMemo(() => resolveChildren(children2()));
203
- memo.toArray = () => {
204
- const c = memo();
203
+ const memo2 = createMemo(() => resolveChildren(children2()));
204
+ memo2.toArray = () => {
205
+ const c = memo2();
205
206
  return Array.isArray(c) ? c : c != null ? [c] : [];
206
207
  };
207
- return memo;
208
+ return memo2;
208
209
  }
209
210
  var SuspenseContext;
210
211
  function readSignal() {
@@ -265,7 +266,7 @@ function writeSignal(node, value, isComp) {
265
266
  }
266
267
  if (Updates.length > 1e6) {
267
268
  Updates = [];
268
- if (false) ;
269
+ if (IS_DEV) ;
269
270
  throw new Error();
270
271
  }
271
272
  }, false);
@@ -277,11 +278,7 @@ function updateComputation(node) {
277
278
  if (!node.fn) return;
278
279
  cleanNode(node);
279
280
  const time = ExecCount;
280
- runComputation(
281
- node,
282
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
283
- time
284
- );
281
+ runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
285
282
  if (Transition && !Transition.running && Transition.sources.has(node)) {
286
283
  queueMicrotask(() => {
287
284
  runUpdates(() => {
@@ -512,8 +509,7 @@ function lookUpstream(node, ignore) {
512
509
  if (source.sources) {
513
510
  const state = runningTransition ? source.tState : source.state;
514
511
  if (state === STALE) {
515
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
516
- runTop(source);
512
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
517
513
  } else if (state === PENDING) lookUpstream(source, ignore);
518
514
  }
519
515
  }
@@ -589,13 +585,12 @@ function handleError(err, owner = Owner) {
589
585
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
590
586
  const error = castError(err);
591
587
  if (!fns) throw error;
592
- if (Effects)
593
- Effects.push({
594
- fn() {
595
- runErrors(error, fns, owner);
596
- },
597
- state: STALE
598
- });
588
+ if (Effects) Effects.push({
589
+ fn() {
590
+ runErrors(error, fns, owner);
591
+ },
592
+ state: STALE
593
+ });
599
594
  else runErrors(error, fns, owner);
600
595
  }
601
596
  function resolveChildren(children2) {
@@ -613,16 +608,13 @@ function resolveChildren(children2) {
613
608
  function createProvider(id, options) {
614
609
  return function provider(props) {
615
610
  let res;
616
- createRenderEffect(
617
- () => res = untrack(() => {
618
- Owner.context = {
619
- ...Owner.context,
620
- [id]: props.value
621
- };
622
- return children(() => props.children);
623
- }),
624
- void 0
625
- );
611
+ createRenderEffect(() => res = untrack(() => {
612
+ Owner.context = {
613
+ ...Owner.context,
614
+ [id]: props.value
615
+ };
616
+ return children(() => props.children);
617
+ }), void 0);
626
618
  return res;
627
619
  };
628
620
  }
@@ -831,29 +823,25 @@ function mergeProps(...sources) {
831
823
  sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
832
824
  }
833
825
  if (SUPPORTS_PROXY && proxy) {
834
- return new Proxy(
835
- {
836
- get(property) {
837
- for (let i = sources.length - 1; i >= 0; i--) {
838
- const v = resolveSource(sources[i])[property];
839
- if (v !== void 0) return v;
840
- }
841
- },
842
- has(property) {
843
- for (let i = sources.length - 1; i >= 0; i--) {
844
- if (property in resolveSource(sources[i])) return true;
845
- }
846
- return false;
847
- },
848
- keys() {
849
- const keys = [];
850
- for (let i = 0; i < sources.length; i++)
851
- keys.push(...Object.keys(resolveSource(sources[i])));
852
- return [...new Set(keys)];
826
+ return new Proxy({
827
+ get(property) {
828
+ for (let i = sources.length - 1; i >= 0; i--) {
829
+ const v = resolveSource(sources[i])[property];
830
+ if (v !== void 0) return v;
853
831
  }
854
832
  },
855
- propTraps
856
- );
833
+ has(property) {
834
+ for (let i = sources.length - 1; i >= 0; i--) {
835
+ if (property in resolveSource(sources[i])) return true;
836
+ }
837
+ return false;
838
+ },
839
+ keys() {
840
+ const keys = [];
841
+ for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
842
+ return [...new Set(keys)];
843
+ }
844
+ }, propTraps);
857
845
  }
858
846
  const sourcesMap = {};
859
847
  const defined = /* @__PURE__ */ Object.create(null);
@@ -893,37 +881,29 @@ function splitProps(props, ...keys) {
893
881
  if (SUPPORTS_PROXY && $PROXY in props) {
894
882
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
895
883
  const res = keys.map((k) => {
896
- return new Proxy(
897
- {
898
- get(property) {
899
- return k.includes(property) ? props[property] : void 0;
900
- },
901
- has(property) {
902
- return k.includes(property) && property in props;
903
- },
904
- keys() {
905
- return k.filter((property) => property in props);
906
- }
884
+ return new Proxy({
885
+ get(property) {
886
+ return k.includes(property) ? props[property] : void 0;
907
887
  },
908
- propTraps
909
- );
910
- });
911
- res.push(
912
- new Proxy(
913
- {
914
- get(property) {
915
- return blocked.has(property) ? void 0 : props[property];
916
- },
917
- has(property) {
918
- return blocked.has(property) ? false : property in props;
919
- },
920
- keys() {
921
- return Object.keys(props).filter((k) => !blocked.has(k));
922
- }
888
+ has(property) {
889
+ return k.includes(property) && property in props;
923
890
  },
924
- propTraps
925
- )
926
- );
891
+ keys() {
892
+ return k.filter((property) => property in props);
893
+ }
894
+ }, propTraps);
895
+ });
896
+ res.push(new Proxy({
897
+ get(property) {
898
+ return blocked.has(property) ? void 0 : props[property];
899
+ },
900
+ has(property) {
901
+ return blocked.has(property) ? false : property in props;
902
+ },
903
+ keys() {
904
+ return Object.keys(props).filter((k) => !blocked.has(k));
905
+ }
906
+ }, propTraps));
927
907
  return res;
928
908
  }
929
909
  const otherObject = {};
@@ -966,124 +946,71 @@ function Index(props) {
966
946
  }
967
947
  function Show(props) {
968
948
  const keyed = props.keyed;
969
- const condition = createMemo(() => props.when, void 0, {
970
- equals: (a, b) => keyed ? a === b : !a === !b
949
+ const conditionValue = createMemo(() => props.when, void 0, void 0);
950
+ const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, {
951
+ equals: (a, b) => !a === !b
971
952
  });
972
- return createMemo(
973
- () => {
974
- const c = condition();
975
- if (c) {
976
- const child = props.children;
977
- const fn = typeof child === "function" && child.length > 0;
978
- return fn ? untrack(
979
- () => child(
980
- keyed ? c : () => {
981
- if (!untrack(condition)) throw narrowedError("Show");
982
- return props.when;
983
- }
984
- )
985
- ) : child;
986
- }
987
- return props.fallback;
988
- },
989
- void 0,
990
- void 0
991
- );
953
+ return createMemo(() => {
954
+ const c = condition();
955
+ if (c) {
956
+ const child = props.children;
957
+ const fn = typeof child === "function" && child.length > 0;
958
+ return fn ? untrack(() => child(keyed ? c : () => {
959
+ if (!untrack(condition)) throw narrowedError("Show");
960
+ return conditionValue();
961
+ })) : child;
962
+ }
963
+ return props.fallback;
964
+ }, void 0, void 0);
992
965
  }
993
966
  function Switch(props) {
994
- let keyed = false;
995
- const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
996
- const conditions = children(() => props.children), evalConditions = createMemo(
997
- () => {
998
- let conds = conditions();
999
- if (!Array.isArray(conds)) conds = [conds];
1000
- for (let i = 0; i < conds.length; i++) {
1001
- const c = conds[i].when;
1002
- if (c) {
1003
- keyed = !!conds[i].keyed;
1004
- return [i, c, conds[i]];
1005
- }
1006
- }
1007
- return [-1];
1008
- },
1009
- void 0,
1010
- {
1011
- equals
967
+ const chs = children(() => props.children);
968
+ const switchFunc = createMemo(() => {
969
+ const ch = chs();
970
+ const mps = Array.isArray(ch) ? ch : [ch];
971
+ let func = () => void 0;
972
+ for (let i = 0; i < mps.length; i++) {
973
+ const index = i;
974
+ const mp = mps[i];
975
+ const prevFunc = func;
976
+ const conditionValue = createMemo(() => prevFunc() ? void 0 : mp.when, void 0, void 0);
977
+ const condition = mp.keyed ? conditionValue : createMemo(conditionValue, void 0, {
978
+ equals: (a, b) => !a === !b
979
+ });
980
+ func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : void 0);
1012
981
  }
1013
- );
1014
- return createMemo(
1015
- () => {
1016
- const [index, when, cond] = evalConditions();
1017
- if (index < 0) return props.fallback;
1018
- const c = cond.children;
1019
- const fn = typeof c === "function" && c.length > 0;
1020
- return fn ? untrack(
1021
- () => c(
1022
- keyed ? when : () => {
1023
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1024
- return cond.when;
1025
- }
1026
- )
1027
- ) : c;
1028
- },
1029
- void 0,
1030
- void 0
1031
- );
982
+ return func;
983
+ });
984
+ return createMemo(() => {
985
+ const sel = switchFunc()();
986
+ if (!sel) return props.fallback;
987
+ const [index, conditionValue, mp] = sel;
988
+ const child = mp.children;
989
+ const fn = typeof child === "function" && child.length > 0;
990
+ return fn ? untrack(() => child(mp.keyed ? conditionValue() : () => {
991
+ if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
992
+ return conditionValue();
993
+ })) : child;
994
+ }, void 0, void 0);
1032
995
  }
1033
996
  function Match(props) {
1034
997
  return props;
1035
998
  }
1036
999
 
1037
- // ../../node_modules/.pnpm/solid-js@1.9.4/node_modules/solid-js/web/dist/web.js
1038
- var booleans = [
1039
- "allowfullscreen",
1040
- "async",
1041
- "autofocus",
1042
- "autoplay",
1043
- "checked",
1044
- "controls",
1045
- "default",
1046
- "disabled",
1047
- "formnovalidate",
1048
- "hidden",
1049
- "indeterminate",
1050
- "inert",
1051
- "ismap",
1052
- "loop",
1053
- "multiple",
1054
- "muted",
1055
- "nomodule",
1056
- "novalidate",
1057
- "open",
1058
- "playsinline",
1059
- "readonly",
1060
- "required",
1061
- "reversed",
1062
- "seamless",
1063
- "selected"
1064
- ];
1065
- var Properties = /* @__PURE__ */ new Set([
1066
- "className",
1067
- "value",
1068
- "readOnly",
1069
- "formNoValidate",
1070
- "isMap",
1071
- "noModule",
1072
- "playsInline",
1073
- ...booleans
1074
- ]);
1075
- var ChildProperties = /* @__PURE__ */ new Set([
1076
- "innerHTML",
1077
- "textContent",
1078
- "innerText",
1079
- "children"
1080
- ]);
1000
+ // ../../node_modules/.pnpm/solid-js@1.9.7/node_modules/solid-js/web/dist/web.js
1001
+ var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
1002
+ var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "noValidate", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
1003
+ var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
1081
1004
  var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1082
1005
  className: "class",
1083
1006
  htmlFor: "for"
1084
1007
  });
1085
1008
  var PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1086
1009
  class: "className",
1010
+ novalidate: {
1011
+ $: "noValidate",
1012
+ FORM: 1
1013
+ },
1087
1014
  formnovalidate: {
1088
1015
  $: "formNoValidate",
1089
1016
  BUTTON: 1,
@@ -1111,34 +1038,12 @@ function getPropAlias(prop, tagName) {
1111
1038
  const a = PropAliases[prop];
1112
1039
  return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
1113
1040
  }
1114
- var DelegatedEvents = /* @__PURE__ */ new Set([
1115
- "beforeinput",
1116
- "click",
1117
- "dblclick",
1118
- "contextmenu",
1119
- "focusin",
1120
- "focusout",
1121
- "input",
1122
- "keydown",
1123
- "keyup",
1124
- "mousedown",
1125
- "mousemove",
1126
- "mouseout",
1127
- "mouseover",
1128
- "mouseup",
1129
- "pointerdown",
1130
- "pointermove",
1131
- "pointerout",
1132
- "pointerover",
1133
- "pointerup",
1134
- "touchend",
1135
- "touchmove",
1136
- "touchstart"
1137
- ]);
1041
+ var DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
1138
1042
  var SVGNamespace = {
1139
1043
  xlink: "http://www.w3.org/1999/xlink",
1140
1044
  xml: "http://www.w3.org/XML/1998/namespace"
1141
1045
  };
1046
+ var memo = (fn) => createMemo(() => fn());
1142
1047
  function reconcileArrays(parentNode, a, b) {
1143
1048
  let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
1144
1049
  while (aStart < aEnd || bStart < bEnd) {
@@ -1199,12 +1104,12 @@ function render(code, element, init, options = {}) {
1199
1104
  element.textContent = "";
1200
1105
  };
1201
1106
  }
1202
- function template(html, isImportNode, isSVG) {
1107
+ function template(html, isImportNode, isSVG, isMathML) {
1203
1108
  let node;
1204
1109
  const create = () => {
1205
- const t = document.createElement("template");
1110
+ const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
1206
1111
  t.innerHTML = html;
1207
- return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
1112
+ return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
1208
1113
  };
1209
1114
  const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
1210
1115
  fn.cloneNode = fn;
@@ -1291,9 +1196,7 @@ function style(node, value, prev) {
1291
1196
  function spread(node, props = {}, isSVG, skipChildren) {
1292
1197
  const prevProps = {};
1293
1198
  if (!skipChildren) {
1294
- createRenderEffect(
1295
- () => prevProps.children = insertExpression(node, props.children, prevProps.children)
1296
- );
1199
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
1297
1200
  }
1298
1201
  createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
1299
1202
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
@@ -1332,8 +1235,7 @@ function toPropertyName(name) {
1332
1235
  }
1333
1236
  function toggleClassKey(node, key, value) {
1334
1237
  const classNames = key.trim().split(/\s+/);
1335
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
1336
- node.classList.toggle(classNames[i], value);
1238
+ for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
1337
1239
  }
1338
1240
  function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
1339
1241
  let isCE, isProp, isChildProp, propAlias, forceProp;
@@ -1525,11 +1427,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1525
1427
  } else if (t === "function") {
1526
1428
  if (unwrap) {
1527
1429
  while (typeof item === "function") item = item();
1528
- dynamic = normalizeIncomingArray(
1529
- normalized,
1530
- Array.isArray(item) ? item : [item],
1531
- Array.isArray(prev) ? prev : [prev]
1532
- ) || dynamic;
1430
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1533
1431
  } else {
1534
1432
  normalized.push(item);
1535
1433
  dynamic = true;
@@ -1554,8 +1452,7 @@ function cleanChildren(parent, current, marker, replacement) {
1554
1452
  const el = current[i];
1555
1453
  if (node !== el) {
1556
1454
  const isParent = el.parentNode === parent;
1557
- if (!inserted && !i)
1558
- isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1455
+ if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1559
1456
  else isParent && el.remove();
1560
1457
  } else inserted = true;
1561
1458
  }
@@ -1569,50 +1466,176 @@ function createElement(tagName, isSVG = false) {
1569
1466
  return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
1570
1467
  }
1571
1468
  function Portal(props) {
1572
- const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1469
+ const {
1470
+ useShadow
1471
+ } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1573
1472
  let content;
1574
1473
  let hydrating = !!sharedConfig.context;
1575
- createEffect(
1576
- () => {
1577
- if (hydrating) getOwner().user = hydrating = false;
1578
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1579
- const el = mount();
1580
- if (el instanceof HTMLHeadElement) {
1581
- const [clean2, setClean] = createSignal(false);
1582
- const cleanup = () => setClean(true);
1583
- createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1584
- onCleanup(cleanup);
1585
- } else {
1586
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1587
- mode: "open"
1588
- }) : container;
1589
- Object.defineProperty(container, "_$host", {
1590
- get() {
1591
- return marker.parentNode;
1592
- },
1593
- configurable: true
1594
- });
1595
- insert(renderRoot, content);
1596
- el.appendChild(container);
1597
- props.ref && props.ref(container);
1598
- onCleanup(() => el.removeChild(container));
1599
- }
1600
- },
1601
- void 0,
1602
- {
1603
- render: !hydrating
1474
+ createEffect(() => {
1475
+ if (hydrating) getOwner().user = hydrating = false;
1476
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1477
+ const el = mount();
1478
+ if (el instanceof HTMLHeadElement) {
1479
+ const [clean2, setClean] = createSignal(false);
1480
+ const cleanup = () => setClean(true);
1481
+ createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1482
+ onCleanup(cleanup);
1483
+ } else {
1484
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1485
+ mode: "open"
1486
+ }) : container;
1487
+ Object.defineProperty(container, "_$host", {
1488
+ get() {
1489
+ return marker.parentNode;
1490
+ },
1491
+ configurable: true
1492
+ });
1493
+ insert(renderRoot, content);
1494
+ el.appendChild(container);
1495
+ props.ref && props.ref(container);
1496
+ onCleanup(() => el.removeChild(container));
1604
1497
  }
1605
- );
1498
+ }, void 0, {
1499
+ render: !hydrating
1500
+ });
1606
1501
  return marker;
1607
1502
  }
1608
1503
 
1609
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/task/index.js
1504
+ // src/utils.ts
1505
+ var capitalize = (str) => {
1506
+ return str[0].toUpperCase() + str.slice(1);
1507
+ };
1508
+ var isCSSImage = (str) => {
1509
+ const startsWith = String.prototype.startsWith.bind(str);
1510
+ return startsWith("http") || startsWith("/") || startsWith(".") || startsWith("data");
1511
+ };
1512
+ var createImageSync = (src) => {
1513
+ const image = document.createElement("img");
1514
+ image.src = src;
1515
+ return image;
1516
+ };
1517
+ var createImage = (src) => {
1518
+ const { promise, resolve } = Promise.withResolvers();
1519
+ const image = document.createElement("img");
1520
+ image.addEventListener("load", () => {
1521
+ resolve(image);
1522
+ });
1523
+ image.addEventListener("abort", () => {
1524
+ resolve(null);
1525
+ });
1526
+ image.addEventListener("error", () => {
1527
+ resolve(null);
1528
+ });
1529
+ image.src = src;
1530
+ if (image.complete) {
1531
+ resolve(image.naturalHeight === 0 ? null : image);
1532
+ }
1533
+ return promise;
1534
+ };
1535
+ var waitForImage = (image) => {
1536
+ const { promise, resolve } = Promise.withResolvers();
1537
+ if (image.complete) {
1538
+ resolve(image.naturalHeight !== 0);
1539
+ }
1540
+ image.addEventListener("load", () => {
1541
+ resolve(true);
1542
+ });
1543
+ image.addEventListener("abort", () => {
1544
+ resolve(false);
1545
+ });
1546
+ image.addEventListener("error", () => {
1547
+ resolve(false);
1548
+ });
1549
+ return promise;
1550
+ };
1551
+ var createCanvas = () => {
1552
+ return document.createElement("canvas");
1553
+ };
1554
+ var getContext = (canvas) => {
1555
+ return canvas.getContext("2d");
1556
+ };
1557
+ var canvasDrawImages = async (canvas = createCanvas(), ctx = getContext(canvas), images) => {
1558
+ await Promise.allSettled(images.map((image) => waitForImage(image)));
1559
+ if (canvas.dataset.resized === "false" || !canvas.dataset.resized) {
1560
+ const sizesSorted = images.slice().sort((a, b) => b.width - a.width);
1561
+ const sizes = sizesSorted[0];
1562
+ const scaleBy = canvas.dataset.scaleBy ? Number(canvas.dataset.scaleBy) : 1;
1563
+ canvas.width = Math.min(sizes.naturalWidth * scaleBy * 2, sizes.naturalWidth) * devicePixelRatio;
1564
+ canvas.height = Math.min(sizes.naturalHeight * scaleBy * 2, sizes.naturalHeight) * devicePixelRatio;
1565
+ canvas.dataset.resized = "true";
1566
+ }
1567
+ for (const image of images) {
1568
+ ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
1569
+ }
1570
+ return [canvas, ctx];
1571
+ };
1572
+ var onKey = (cb, ...keys) => {
1573
+ return (e) => {
1574
+ if (keys.some((key) => key === e.key)) {
1575
+ cb(e);
1576
+ }
1577
+ };
1578
+ };
1579
+ var simple = (fn) => {
1580
+ return (...args) => {
1581
+ let result;
1582
+ batch(() => {
1583
+ untrack(() => {
1584
+ result = fn(...args);
1585
+ });
1586
+ });
1587
+ return result;
1588
+ };
1589
+ };
1590
+ var getDocumentStyles = () => {
1591
+ let css = "";
1592
+ for (const styleSheet of Array.from(document.styleSheets)) {
1593
+ if (!styleSheet.href || styleSheet.href.startsWith(location.origin)) {
1594
+ for (const { cssText } of Array.from(styleSheet.cssRules)) {
1595
+ css += cssText;
1596
+ }
1597
+ }
1598
+ }
1599
+ return css;
1600
+ };
1601
+ var once = (fn) => {
1602
+ let ran = false;
1603
+ return () => {
1604
+ if (ran) return;
1605
+ ran = true;
1606
+ fn();
1607
+ };
1608
+ };
1609
+ var createRetrieved = (fn) => {
1610
+ const key = Symbol();
1611
+ let value = key;
1612
+ return () => {
1613
+ if (value === key) {
1614
+ value = fn();
1615
+ }
1616
+ return value;
1617
+ };
1618
+ };
1619
+ var from = (producer) => {
1620
+ const [s, set] = createSignal(producer.get(), {
1621
+ equals: false
1622
+ });
1623
+ onCleanup(producer.subscribe(set));
1624
+ return s;
1625
+ };
1626
+ var removeTagsFromHTML = (html) => {
1627
+ const container = document.createElement("div");
1628
+ container.innerHTML = html;
1629
+ return container.textContent || "";
1630
+ };
1631
+
1632
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/task/index.js
1610
1633
  var tasks = 0;
1611
1634
  function cleanTasks() {
1612
1635
  tasks = 0;
1613
1636
  }
1614
1637
 
1615
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/clean-stores/index.js
1638
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/clean-stores/index.js
1616
1639
  var clean = Symbol("clean");
1617
1640
  var cleanStores = (...stores) => {
1618
1641
  if (false) {
@@ -1629,7 +1652,7 @@ var cleanStores = (...stores) => {
1629
1652
  }
1630
1653
  };
1631
1654
 
1632
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/atom/index.js
1655
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/atom/index.js
1633
1656
  var listenerQueue = [];
1634
1657
  var lqIndex = 0;
1635
1658
  var QUEUE_ITEMS_PER_LISTENER = 4;
@@ -1712,7 +1735,7 @@ var atom = (initialValue) => {
1712
1735
  return $atom;
1713
1736
  };
1714
1737
 
1715
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/lifecycle/index.js
1738
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/lifecycle/index.js
1716
1739
  var MOUNT = 5;
1717
1740
  var UNMOUNT = 6;
1718
1741
  var REVERT_MUTATION = 10;
@@ -1782,7 +1805,7 @@ var onMount2 = ($store, initialize) => {
1782
1805
  });
1783
1806
  };
1784
1807
 
1785
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/deep-map/path.js
1808
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/deep-map/path.js
1786
1809
  function getPath(obj, path) {
1787
1810
  let allKeys = getAllKeysFromPath(path);
1788
1811
  let res = obj;
@@ -1840,7 +1863,7 @@ function ensureKey(obj, key, nextKey) {
1840
1863
  }
1841
1864
  }
1842
1865
 
1843
- // ../../node_modules/.pnpm/nanostores@0.11.3/node_modules/nanostores/deep-map/index.js
1866
+ // ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/deep-map/index.js
1844
1867
  function deepMap(initial = {}) {
1845
1868
  let $deepMap = atom(initial);
1846
1869
  $deepMap.setKey = (key, value) => {
@@ -1853,7 +1876,7 @@ function deepMap(initial = {}) {
1853
1876
  return $deepMap;
1854
1877
  }
1855
1878
 
1856
- // ../../node_modules/.pnpm/yocto-queue@1.1.1/node_modules/yocto-queue/index.js
1879
+ // ../../node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js
1857
1880
  var Node = class {
1858
1881
  value;
1859
1882
  next;
@@ -1909,6 +1932,11 @@ var Queue = class {
1909
1932
  current = current.next;
1910
1933
  }
1911
1934
  }
1935
+ *drain() {
1936
+ while (this.#head) {
1937
+ yield this.dequeue();
1938
+ }
1939
+ }
1912
1940
  };
1913
1941
 
1914
1942
  // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
@@ -1984,7 +2012,7 @@ function validateConcurrency(concurrency) {
1984
2012
  }
1985
2013
  }
1986
2014
 
1987
- // ../../node_modules/.pnpm/simple-web-audio@0.9.0_postcss@8.5.3/node_modules/simple-web-audio/dist/index.mjs
2015
+ // ../../node_modules/.pnpm/simple-web-audio@0.9.0_postcss@8.5.6/node_modules/simple-web-audio/dist/index.mjs
1988
2016
  var waitForInteraction = (() => {
1989
2017
  const { promise, resolve } = Promise.withResolvers();
1990
2018
  const onUserInteraction = () => {
@@ -2837,161 +2865,6 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
2837
2865
  };
2838
2866
  var handleVibrateAction = vibrate;
2839
2867
 
2840
- // src/shared.ts
2841
- var PRELOADED_IMAGE_MAP = /* @__PURE__ */ new Map();
2842
- var PRELOADING_IMAGE_MAP = /* @__PURE__ */ new Map();
2843
- var { useShared, removeShared } = createShared(() => {
2844
- return {
2845
- characters: {}
2846
- };
2847
- });
2848
-
2849
- // src/utils.ts
2850
- var capitalize = (str) => {
2851
- return str[0].toUpperCase() + str.slice(1);
2852
- };
2853
- var isCSSImage = (str) => {
2854
- const startsWith = String.prototype.startsWith.bind(str);
2855
- return startsWith("http") || startsWith("/") || startsWith(".") || startsWith("data");
2856
- };
2857
- var createImage = (src) => {
2858
- const img = document.createElement("img");
2859
- Object.assign(img, {
2860
- src
2861
- });
2862
- return img;
2863
- };
2864
- var imageLoaded = (image) => {
2865
- const { promise, resolve } = Promise.withResolvers();
2866
- if (image.complete && image.naturalHeight !== 0) {
2867
- resolve(true);
2868
- return promise;
2869
- }
2870
- image.addEventListener("load", async () => {
2871
- if (image.decode) {
2872
- await image.decode().catch(noop);
2873
- }
2874
- resolve(true);
2875
- });
2876
- image.addEventListener("abort", () => {
2877
- resolve(false);
2878
- });
2879
- image.addEventListener("error", () => {
2880
- resolve(false);
2881
- });
2882
- return promise;
2883
- };
2884
- var imagePreloadWithCaching = async (src) => {
2885
- if (PRELOADING_IMAGE_MAP.has(src)) {
2886
- const image2 = PRELOADING_IMAGE_MAP.get(src);
2887
- await imageLoaded(image2);
2888
- PRELOADING_IMAGE_MAP.delete(src);
2889
- PRELOADED_IMAGE_MAP.set(src, image2);
2890
- return image2;
2891
- }
2892
- if (PRELOADED_IMAGE_MAP.has(src)) {
2893
- const image2 = PRELOADED_IMAGE_MAP.get(src);
2894
- return image2;
2895
- }
2896
- const image = createImage(src);
2897
- PRELOADING_IMAGE_MAP.set(src, image);
2898
- await imageLoaded(image);
2899
- PRELOADING_IMAGE_MAP.delete(src);
2900
- PRELOADED_IMAGE_MAP.set(src, image);
2901
- return image;
2902
- };
2903
- var imagePreloadWithCachingNotComplete = (src) => {
2904
- if (PRELOADING_IMAGE_MAP.has(src)) {
2905
- PRELOADING_IMAGE_MAP.get(src);
2906
- }
2907
- if (PRELOADED_IMAGE_MAP.has(src)) {
2908
- return PRELOADED_IMAGE_MAP.get(src);
2909
- }
2910
- const image = createImage(src);
2911
- PRELOADING_IMAGE_MAP.set(src, image);
2912
- return image;
2913
- };
2914
- var createCanvas = () => {
2915
- return document.createElement("canvas");
2916
- };
2917
- var getContext = (canvas) => {
2918
- return canvas.getContext("2d");
2919
- };
2920
- var canvasDrawImages = async (canvas = createCanvas(), ctx = getContext(canvas), images) => {
2921
- await Promise.allSettled(images.map((image) => imageLoaded(image)));
2922
- if (canvas.dataset.resized === "false" || !canvas.dataset.resized) {
2923
- const sizesSorted = images.slice().sort((a, b) => b.width - a.width);
2924
- const sizes = sizesSorted[0];
2925
- const scaleBy = canvas.dataset.scaleBy ? Number(canvas.dataset.scaleBy) : 1;
2926
- canvas.width = Math.min(sizes.naturalWidth * scaleBy * 2, sizes.naturalWidth) * devicePixelRatio;
2927
- canvas.height = Math.min(sizes.naturalHeight * scaleBy * 2, sizes.naturalHeight) * devicePixelRatio;
2928
- canvas.dataset.resized = "true";
2929
- }
2930
- for (const image of images) {
2931
- ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
2932
- }
2933
- return [canvas, ctx];
2934
- };
2935
- var onKey = (cb, ...keys) => {
2936
- return (e) => {
2937
- if (keys.some((key) => key === e.key)) {
2938
- cb(e);
2939
- }
2940
- };
2941
- };
2942
- var simple = (fn) => {
2943
- return (...args) => {
2944
- let result;
2945
- batch(() => {
2946
- untrack(() => {
2947
- result = fn(...args);
2948
- });
2949
- });
2950
- return result;
2951
- };
2952
- };
2953
- var getDocumentStyles = () => {
2954
- let css = "";
2955
- for (const styleSheet of Array.from(document.styleSheets)) {
2956
- if (!styleSheet.href || styleSheet.href.startsWith(location.origin)) {
2957
- for (const { cssText } of Array.from(styleSheet.cssRules)) {
2958
- css += cssText;
2959
- }
2960
- }
2961
- }
2962
- return css;
2963
- };
2964
- var once = (fn) => {
2965
- let ran = false;
2966
- return () => {
2967
- if (ran) return;
2968
- ran = true;
2969
- fn();
2970
- };
2971
- };
2972
- var createRetrieved = (fn) => {
2973
- const key = Symbol();
2974
- let value = key;
2975
- return () => {
2976
- if (value === key) {
2977
- value = fn();
2978
- }
2979
- return value;
2980
- };
2981
- };
2982
- var from = (producer) => {
2983
- const [s, set] = createSignal(producer.get(), {
2984
- equals: false
2985
- });
2986
- onCleanup(producer.subscribe(set));
2987
- return s;
2988
- };
2989
- var removeTagsFromHTML = (html) => {
2990
- const container = document.createElement("div");
2991
- container.innerHTML = html;
2992
- return container.textContent || "";
2993
- };
2994
-
2995
2868
  // src/hooks/useMedia.ts
2996
2869
  var useMedia = (media) => {
2997
2870
  const mq = matchMedia(media);
@@ -3168,13 +3041,13 @@ var ControlPanelButtons = (props) => {
3168
3041
  createRenderEffect(() => setAttribute(_el$7, "title", data.t(props.auto() ? "Stop" : "Auto")));
3169
3042
  return _el$7;
3170
3043
  })(), (() => {
3171
- var _el$9 = _tmpl$3(), _el$10 = _el$9.firstChild;
3044
+ var _el$9 = _tmpl$3(), _el$0 = _el$9.firstChild;
3172
3045
  _el$9.$$click = () => {
3173
3046
  data.options.save("auto");
3174
3047
  data.options.exit(true);
3175
3048
  props.openSettings();
3176
3049
  };
3177
- insert(_el$10, () => data.t("Settings"));
3050
+ insert(_el$0, () => data.t("Settings"));
3178
3051
  insert(_el$9, createComponent(Icon, {
3179
3052
  "class": "control-panel__button__icon",
3180
3053
  icon: "#novely-settings-icon"
@@ -3182,31 +3055,31 @@ var ControlPanelButtons = (props) => {
3182
3055
  createRenderEffect(() => setAttribute(_el$9, "title", data.t("Settings")));
3183
3056
  return _el$9;
3184
3057
  })(), (() => {
3185
- var _el$11 = _tmpl$3(), _el$12 = _el$11.firstChild;
3186
- _el$11.$$click = () => {
3058
+ var _el$1 = _tmpl$3(), _el$10 = _el$1.firstChild;
3059
+ _el$1.$$click = () => {
3187
3060
  data.options.exit();
3188
3061
  };
3189
- insert(_el$12, () => data.t("Exit"));
3190
- insert(_el$11, createComponent(Icon, {
3062
+ insert(_el$10, () => data.t("Exit"));
3063
+ insert(_el$1, createComponent(Icon, {
3191
3064
  "class": "control-panel__button__icon",
3192
3065
  icon: "#novely-x-icon"
3193
3066
  }), null);
3194
- createRenderEffect(() => setAttribute(_el$11, "title", data.t("Exit")));
3195
- return _el$11;
3067
+ createRenderEffect(() => setAttribute(_el$1, "title", data.t("Exit")));
3068
+ return _el$1;
3196
3069
  })(), createComponent(Show, {
3197
3070
  get when() {
3198
3071
  return data.media.hyperWide();
3199
3072
  },
3200
3073
  get children() {
3201
- var _el$13 = _tmpl$4();
3202
- _el$13.$$click = () => {
3074
+ var _el$11 = _tmpl$4();
3075
+ _el$11.$$click = () => {
3203
3076
  props.closeDropdown();
3204
3077
  };
3205
- insert(_el$13, createComponent(Icon, {
3078
+ insert(_el$11, createComponent(Icon, {
3206
3079
  icon: "#novely-x-icon"
3207
3080
  }));
3208
- createRenderEffect(() => setAttribute(_el$13, "title", data.t("CloseMenu")));
3209
- return _el$13;
3081
+ createRenderEffect(() => setAttribute(_el$11, "title", data.t("CloseMenu")));
3082
+ return _el$11;
3210
3083
  }
3211
3084
  })];
3212
3085
  };
@@ -3227,7 +3100,7 @@ var DialogName = (props) => {
3227
3100
  get when() {
3228
3101
  return props.mood;
3229
3102
  },
3230
- children: (mood) => [" ", _tmpl$23(), " ", createMemo(mood)]
3103
+ children: (mood) => [" ", _tmpl$23(), " ", memo(mood)]
3231
3104
  }), null);
3232
3105
  createRenderEffect((_p$) => {
3233
3106
  var _v$ = color(), _v$2 = props.character ? 1 : 0, _v$3 = props.character ? "visible" : "hidden";
@@ -3300,7 +3173,7 @@ var Modal = (props) => {
3300
3173
  })();
3301
3174
  };
3302
3175
 
3303
- // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.1.0_solid-js@1.9.4/node_modules/@solid-primitives/transition-group/dist/index.js
3176
+ // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.1.1_solid-js@1.9.7/node_modules/@solid-primitives/transition-group/dist/index.js
3304
3177
  var noop2 = () => {
3305
3178
  };
3306
3179
  var noopTransition = (el, done) => done();
@@ -3366,10 +3239,10 @@ function createSwitchTransition(source, options) {
3366
3239
  return returned;
3367
3240
  }
3368
3241
 
3369
- // ../../node_modules/.pnpm/@solid-primitives+utils@6.3.0_solid-js@1.9.4/node_modules/@solid-primitives/utils/dist/index.js
3242
+ // ../../node_modules/.pnpm/@solid-primitives+utils@6.3.1_solid-js@1.9.7/node_modules/@solid-primitives/utils/dist/index.js
3370
3243
  var access = (v) => typeof v === "function" && !v.length ? v() : v;
3371
3244
 
3372
- // ../../node_modules/.pnpm/@solid-primitives+refs@1.1.0_solid-js@1.9.4/node_modules/@solid-primitives/refs/dist/index.js
3245
+ // ../../node_modules/.pnpm/@solid-primitives+refs@1.1.1_solid-js@1.9.7/node_modules/@solid-primitives/refs/dist/index.js
3373
3246
  var defaultElementPredicate = isServer ? (item) => item != null && typeof item === "object" && "t" in item : (item) => item instanceof Element;
3374
3247
  function getFirstChild(value, predicate) {
3375
3248
  if (predicate(value))
@@ -3390,7 +3263,7 @@ function resolveFirst(fn, predicate = defaultElementPredicate, serverPredicate =
3390
3263
  return createMemo(() => getFirstChild(children2(), isServer ? serverPredicate : predicate));
3391
3264
  }
3392
3265
 
3393
- // ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.9.4/node_modules/solid-transition-group/dist/index.js
3266
+ // ../../node_modules/.pnpm/solid-transition-group@0.3.0_solid-js@1.9.7/node_modules/solid-transition-group/dist/index.js
3394
3267
  function createClassnames(props) {
3395
3268
  return createMemo(() => {
3396
3269
  const name = props.name || "s";
@@ -3470,19 +3343,16 @@ var TRANSITION_MODE_MAP = {
3470
3343
  };
3471
3344
  var Transition2 = (props) => {
3472
3345
  const classnames = createClassnames(props);
3473
- return createSwitchTransition(
3474
- resolveFirst(() => props.children),
3475
- {
3476
- mode: TRANSITION_MODE_MAP[props.mode],
3477
- appear: props.appear,
3478
- onEnter(el, done) {
3479
- enterTransition(classnames(), props, el, done);
3480
- },
3481
- onExit(el, done) {
3482
- exitTransition(classnames(), props, el, done);
3483
- }
3346
+ return createSwitchTransition(resolveFirst(() => props.children), {
3347
+ mode: TRANSITION_MODE_MAP[props.mode],
3348
+ appear: props.appear,
3349
+ onEnter(el, done) {
3350
+ enterTransition(classnames(), props, el, done);
3351
+ },
3352
+ onExit(el, done) {
3353
+ exitTransition(classnames(), props, el, done);
3484
3354
  }
3485
- );
3355
+ });
3486
3356
  };
3487
3357
 
3488
3358
  // src/context-state.ts
@@ -3494,9 +3364,16 @@ var { useContextState, removeContextState } = createContextStateRoot(() => {
3494
3364
  };
3495
3365
  });
3496
3366
 
3367
+ // src/shared.ts
3368
+ var { useShared, removeShared } = createShared(() => {
3369
+ return {
3370
+ characters: {}
3371
+ };
3372
+ });
3373
+
3497
3374
  // src/components/Save.tsx
3498
3375
  var _tmpl$7 = /* @__PURE__ */ template(`<div class=saves__list-item__overlay>`);
3499
- var _tmpl$24 = /* @__PURE__ */ template(`<iframe tabindex=-1 class=saves__list-item__iframe src=about:blank>`, true, false);
3376
+ var _tmpl$24 = /* @__PURE__ */ template(`<iframe tabindex=-1 class=saves__list-item__iframe src=about:blank>`, true, false, false);
3500
3377
  var _tmpl$33 = /* @__PURE__ */ template(`<li class=saves__list-item><div class=saves__list-item__load role=button tabindex=0></div><div class=saves__list-item__description><div></div><div></div></div><button type=reset class="button saves__button-reset"><span>`);
3501
3378
  var _tmpl$42 = /* @__PURE__ */ template(`<div class=saves__list-item__iframe>`);
3502
3379
  var CURRENT_DATE = /* @__PURE__ */ new Date();
@@ -3589,7 +3466,7 @@ var Save = (props) => {
3589
3466
  const promises = assets.map(async (asset) => {
3590
3467
  const type2 = await options.getResourseType(asset);
3591
3468
  if (type2 === "image") {
3592
- await imagePreloadWithCaching(asset);
3469
+ await createImage(asset);
3593
3470
  }
3594
3471
  });
3595
3472
  await Promise.allSettled(promises);
@@ -4095,15 +3972,15 @@ var DialogOverview = (props) => {
4095
3972
  return entries();
4096
3973
  },
4097
3974
  children: (entry) => (() => {
4098
- var _el$6 = _tmpl$43(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$11 = _el$9.nextSibling, _el$12 = _el$11.firstChild;
3975
+ var _el$6 = _tmpl$43(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$1 = _el$9.nextSibling, _el$10 = _el$1.firstChild;
4099
3976
  insert(_el$8, () => removeTagsFromHTML(entry.name));
4100
3977
  insert(_el$9, createComponent(Show, {
4101
3978
  get when() {
4102
3979
  return entry.voice;
4103
3980
  },
4104
3981
  get children() {
4105
- var _el$10 = _tmpl$34();
4106
- _el$10.$$click = async () => {
3982
+ var _el$0 = _tmpl$34();
3983
+ _el$0.$$click = async () => {
4107
3984
  if (!entry.voice) return;
4108
3985
  const voice = props.audio.getAudio("voice", entry.voice);
4109
3986
  const source = currentlyPlayingSource();
@@ -4129,15 +4006,15 @@ var DialogOverview = (props) => {
4129
4006
  });
4130
4007
  }
4131
4008
  };
4132
- insert(_el$10, createComponent(Icon, {
4009
+ insert(_el$0, createComponent(Icon, {
4133
4010
  get icon() {
4134
4011
  return currentlyPlayingSource() === entry.voice ? "#novely-stop-icon" : "#novely-play-icon";
4135
4012
  }
4136
4013
  }));
4137
- return _el$10;
4014
+ return _el$0;
4138
4015
  }
4139
4016
  }));
4140
- insert(_el$12, () => removeTagsFromHTML(entry.text));
4017
+ insert(_el$10, () => removeTagsFromHTML(entry.text));
4141
4018
  return _el$6;
4142
4019
  })()
4143
4020
  })
@@ -4165,7 +4042,7 @@ var Await = (props) => {
4165
4042
  });
4166
4043
  };
4167
4044
 
4168
- // ../../node_modules/.pnpm/@solid-primitives+destructure@0.2.0_solid-js@1.9.4/node_modules/@solid-primitives/destructure/dist/index.js
4045
+ // ../../node_modules/.pnpm/@solid-primitives+destructure@0.2.1_solid-js@1.9.7/node_modules/@solid-primitives/destructure/dist/index.js
4169
4046
  var isReactiveObject = (value) => typeof value === "object" && value !== null;
4170
4047
  function createProxyCache(obj, get) {
4171
4048
  return new Proxy({}, {
@@ -4184,7 +4061,7 @@ function createProxyCache(obj, get) {
4184
4061
  }
4185
4062
  function destructure(source, options) {
4186
4063
  const config = options ?? {};
4187
- const memo = config.memo ?? typeof source === "function";
4064
+ const memo2 = config.memo ?? typeof source === "function";
4188
4065
  const getter = typeof source === "function" ? (key) => () => source()[key] : (key) => () => source[key];
4189
4066
  const obj = access(source);
4190
4067
  if (config.lazy) {
@@ -4192,17 +4069,17 @@ function destructure(source, options) {
4192
4069
  return createProxyCache(obj, (key) => {
4193
4070
  const calc = getter(key);
4194
4071
  if (config.deep && isReactiveObject(obj[key]))
4195
- return runWithOwner(owner, () => destructure(calc, { ...config, memo }));
4196
- return memo ? runWithOwner(owner, () => createMemo(calc, void 0, options)) : calc;
4072
+ return runWithOwner(owner, () => destructure(calc, { ...config, memo: memo2 }));
4073
+ return memo2 ? runWithOwner(owner, () => createMemo(calc, void 0, options)) : calc;
4197
4074
  });
4198
4075
  }
4199
4076
  const result = Array.isArray(obj) ? [] : {};
4200
4077
  for (const [key, value] of Object.entries(obj)) {
4201
4078
  const calc = getter(key);
4202
4079
  if (config.deep && isReactiveObject(value))
4203
- result[key] = destructure(calc, { ...config, memo });
4080
+ result[key] = destructure(calc, { ...config, memo: memo2 });
4204
4081
  else
4205
- result[key] = memo ? createMemo(calc, void 0, options) : calc;
4082
+ result[key] = memo2 ? createMemo(calc, void 0, options) : calc;
4206
4083
  }
4207
4084
  return result;
4208
4085
  }
@@ -4217,12 +4094,12 @@ var _tmpl$62 = /* @__PURE__ */ template(`<button type=submit class="button dialo
4217
4094
  var _tmpl$72 = /* @__PURE__ */ template(`<div class=exit-dialog-buttons><button type=button class=button></button><button type=button class=button>`);
4218
4095
  var _tmpl$82 = /* @__PURE__ */ template(`<button type=button class="button control-panel__button">`);
4219
4096
  var _tmpl$92 = /* @__PURE__ */ template(`<span class=control-panel-container-fix aria-hidden=true>&#8203;`);
4220
- var _tmpl$102 = /* @__PURE__ */ template(`<div class=control-panel-container-backdrop>`);
4221
- var _tmpl$112 = /* @__PURE__ */ template(`<div class=control-panel><div role=menubar class=control-panel-container>`);
4222
- var _tmpl$122 = /* @__PURE__ */ template(`<div class="loading overlay game"><div class=loading__animation><div></div><div></div><div></div><div>`);
4223
- var _tmpl$132 = /* @__PURE__ */ template(`<div><div class=background></div><div class=characters></div><div class=action-dialog><div class=action-dialog-container role=button tabindex=0><div class=action-dialog-content></div></div></div><div></div><div class=action-text role=button tabindex=0></div><div class=action-image>`);
4224
- var _tmpl$14 = /* @__PURE__ */ template(`<button type=button class="button choice-dialog__choice"><span>`);
4225
- var _tmpl$15 = /* @__PURE__ */ template(`<div class=action-image__image-container>`);
4097
+ var _tmpl$0 = /* @__PURE__ */ template(`<div class=control-panel-container-backdrop>`);
4098
+ var _tmpl$1 = /* @__PURE__ */ template(`<div class=control-panel><div role=menubar class=control-panel-container>`);
4099
+ var _tmpl$102 = /* @__PURE__ */ template(`<div class="loading overlay game"><div class=loading__animation><div></div><div></div><div></div><div>`);
4100
+ var _tmpl$112 = /* @__PURE__ */ template(`<div><div class=background></div><div class=characters></div><div class=action-dialog><div class=action-dialog-container role=button tabindex=0><div class=action-dialog-content></div></div></div><div></div><div class=action-text role=button tabindex=0></div><div class=action-image>`);
4101
+ var _tmpl$122 = /* @__PURE__ */ template(`<button type=button class="button choice-dialog__choice"><span>`);
4102
+ var _tmpl$132 = /* @__PURE__ */ template(`<div class=action-image__image-container>`);
4226
4103
  var Game = (props) => {
4227
4104
  const data = useData();
4228
4105
  const {
@@ -4312,7 +4189,7 @@ var Game = (props) => {
4312
4189
  createEffect(() => {
4313
4190
  const currentBackground = background().background;
4314
4191
  if (isCSSImage(currentBackground)) {
4315
- imagePreloadWithCaching(currentBackground).then(() => {
4192
+ createImage(currentBackground).then(() => {
4316
4193
  if (currentBackground === background().background) {
4317
4194
  setBg(`url(${JSON.stringify(currentBackground)})`);
4318
4195
  }
@@ -4322,7 +4199,7 @@ var Game = (props) => {
4322
4199
  }
4323
4200
  });
4324
4201
  return (() => {
4325
- var _el$ = _tmpl$132(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling, _el$5 = _el$4.firstChild, _el$7 = _el$5.firstChild, _el$17 = _el$4.nextSibling, _el$18 = _el$17.nextSibling, _el$24 = _el$18.nextSibling;
4202
+ var _el$ = _tmpl$112(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling, _el$5 = _el$4.firstChild, _el$7 = _el$5.firstChild, _el$15 = _el$4.nextSibling, _el$16 = _el$15.nextSibling, _el$22 = _el$16.nextSibling;
4326
4203
  setAttribute(_el$3, "data-characters", true);
4327
4204
  insert(_el$3, createComponent(For, {
4328
4205
  get each() {
@@ -4426,21 +4303,22 @@ var Game = (props) => {
4426
4303
  return visible();
4427
4304
  },
4428
4305
  get children() {
4429
- var _el$26 = _tmpl$14(), _el$27 = _el$26.firstChild;
4430
- _el$26.$$click = () => {
4306
+ var _el$24 = _tmpl$122(), _el$25 = _el$24.firstChild;
4307
+ _el$24.$$click = () => {
4431
4308
  onSelect();
4432
4309
  if (disabled()) return;
4433
4310
  choice().resolve?.(index);
4434
4311
  };
4435
- insert(_el$27, text2);
4436
- insert(_el$26, createComponent(Show, {
4312
+ insert(_el$25, text2);
4313
+ insert(_el$24, createComponent(Show, {
4437
4314
  when: image !== "",
4438
4315
  get children() {
4439
4316
  return createComponent(Canvas, {
4440
4317
  "class": "choice-dialog__choice-image",
4441
4318
  resize: false,
4442
4319
  render: async (canvas, ctx) => {
4443
- const img = await imagePreloadWithCaching(image);
4320
+ const img = await createImage(image);
4321
+ if (!img) return;
4444
4322
  canvas.width = img.width;
4445
4323
  canvas.height = img.height;
4446
4324
  ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
@@ -4448,8 +4326,8 @@ var Game = (props) => {
4448
4326
  });
4449
4327
  }
4450
4328
  }), null);
4451
- createRenderEffect(() => setAttribute(_el$26, "aria-disabled", disabled()));
4452
- return _el$26;
4329
+ createRenderEffect(() => setAttribute(_el$24, "aria-disabled", disabled()));
4330
+ return _el$24;
4453
4331
  }
4454
4332
  });
4455
4333
  }
@@ -4457,7 +4335,7 @@ var Game = (props) => {
4457
4335
  return _el$9;
4458
4336
  })()];
4459
4337
  }
4460
- }), _el$17);
4338
+ }), _el$15);
4461
4339
  insert(_el$, createComponent(Modal, {
4462
4340
  "class": "input-dialog",
4463
4341
  isModal: false,
@@ -4468,22 +4346,22 @@ var Game = (props) => {
4468
4346
  trapFocus: () => !props.isPreview && !exitPromptShown(),
4469
4347
  get children() {
4470
4348
  return [(() => {
4471
- var _el$10 = _tmpl$44();
4472
- insert(_el$10, () => input().label);
4473
- return _el$10;
4474
- })(), createMemo(() => input().element), (() => {
4475
- var _el$11 = _tmpl$52();
4476
- insert(_el$11, () => input().error);
4477
- return _el$11;
4349
+ var _el$0 = _tmpl$44();
4350
+ insert(_el$0, () => input().label);
4351
+ return _el$0;
4352
+ })(), memo(() => input().element), (() => {
4353
+ var _el$1 = _tmpl$52();
4354
+ insert(_el$1, () => input().error);
4355
+ return _el$1;
4478
4356
  })(), (() => {
4479
- var _el$12 = _tmpl$62();
4480
- _el$12.$$click = onInputButtonClick;
4481
- insert(_el$12, () => data.t("Sumbit"));
4482
- createRenderEffect(() => setAttribute(_el$12, "aria-disabled", Boolean(input().error)));
4483
- return _el$12;
4357
+ var _el$10 = _tmpl$62();
4358
+ _el$10.$$click = onInputButtonClick;
4359
+ insert(_el$10, () => data.t("Sumbit"));
4360
+ createRenderEffect(() => setAttribute(_el$10, "aria-disabled", Boolean(input().error)));
4361
+ return _el$10;
4484
4362
  })()];
4485
4363
  }
4486
- }), _el$17);
4364
+ }), _el$15);
4487
4365
  insert(_el$, createComponent(Modal, {
4488
4366
  "class": "exit-dialog",
4489
4367
  isModal: true,
@@ -4491,34 +4369,34 @@ var Game = (props) => {
4491
4369
  trapFocus: () => !props.isPreview && exitPromptShown(),
4492
4370
  get children() {
4493
4371
  return [(() => {
4494
- var _el$13 = _tmpl$26();
4495
- insert(_el$13, () => data.t("ExitDialogWarning"));
4496
- return _el$13;
4372
+ var _el$11 = _tmpl$26();
4373
+ insert(_el$11, () => data.t("ExitDialogWarning"));
4374
+ return _el$11;
4497
4375
  })(), (() => {
4498
- var _el$14 = _tmpl$72(), _el$15 = _el$14.firstChild, _el$16 = _el$15.nextSibling;
4499
- _el$15.$$click = () => {
4376
+ var _el$12 = _tmpl$72(), _el$13 = _el$12.firstChild, _el$14 = _el$13.nextSibling;
4377
+ _el$13.$$click = () => {
4500
4378
  data.$rendererState.setKey("exitPromptShown", false);
4501
4379
  };
4502
- insert(_el$15, () => data.t("ExitDialogBack"));
4503
- _el$16.$$click = () => {
4380
+ insert(_el$13, () => data.t("ExitDialogBack"));
4381
+ _el$14.$$click = () => {
4504
4382
  data.options.exit(true);
4505
4383
  };
4506
- insert(_el$16, () => data.t("ExitDialogExit"));
4507
- return _el$14;
4384
+ insert(_el$14, () => data.t("ExitDialogExit"));
4385
+ return _el$12;
4508
4386
  })()];
4509
4387
  }
4510
- }), _el$17);
4511
- setAttribute(_el$17, "data-custom", true);
4512
- insert(_el$17, createComponent(For, {
4388
+ }), _el$15);
4389
+ setAttribute(_el$15, "data-custom", true);
4390
+ insert(_el$15, createComponent(For, {
4513
4391
  get each() {
4514
4392
  return customs();
4515
4393
  },
4516
4394
  children: (value) => value.node
4517
4395
  }));
4518
- addEventListener2(_el$18, "keydown", onKey(TextWriter.click, " "), true);
4519
- addEventListener2(_el$18, "keypress", onKey(TextWriter.click, "Enter"));
4520
- addEventListener2(_el$18, "click", TextWriter.click, true);
4521
- insert(_el$18, createComponent(TextWriter.Typewriter, {
4396
+ addEventListener2(_el$16, "keydown", onKey(TextWriter.click, " "), true);
4397
+ addEventListener2(_el$16, "keypress", onKey(TextWriter.click, "Enter"));
4398
+ addEventListener2(_el$16, "click", TextWriter.click, true);
4399
+ insert(_el$16, createComponent(TextWriter.Typewriter, {
4522
4400
  get content() {
4523
4401
  return text().content;
4524
4402
  }
@@ -4528,8 +4406,8 @@ var Game = (props) => {
4528
4406
  return !props.isPreview;
4529
4407
  },
4530
4408
  get children() {
4531
- var _el$19 = _tmpl$112(), _el$23 = _el$19.firstChild;
4532
- insert(_el$19, createComponent(Show, {
4409
+ var _el$17 = _tmpl$1(), _el$21 = _el$17.firstChild;
4410
+ insert(_el$17, createComponent(Show, {
4533
4411
  get when() {
4534
4412
  return data.media.hyperWide();
4535
4413
  },
@@ -4539,46 +4417,46 @@ var Game = (props) => {
4539
4417
  return !controlPanelMenuExpanded();
4540
4418
  },
4541
4419
  get children() {
4542
- var _el$20 = _tmpl$82();
4543
- _el$20.$$click = () => {
4420
+ var _el$18 = _tmpl$82();
4421
+ _el$18.$$click = () => {
4544
4422
  setControlPanelMenuExpanded((prev) => !prev);
4545
4423
  };
4546
- setAttribute(_el$20, "aria-controls", controlPanelMenuID);
4547
- insert(_el$20, createComponent(Icon, {
4424
+ setAttribute(_el$18, "aria-controls", controlPanelMenuID);
4425
+ insert(_el$18, createComponent(Icon, {
4548
4426
  icon: "#novely-list-icon"
4549
4427
  }));
4550
4428
  createRenderEffect((_p$) => {
4551
4429
  var _v$3 = data.t("OpenMenu"), _v$4 = controlPanelMenuExpanded();
4552
- _v$3 !== _p$.e && setAttribute(_el$20, "title", _p$.e = _v$3);
4553
- _v$4 !== _p$.t && setAttribute(_el$20, "aria-expanded", _p$.t = _v$4);
4430
+ _v$3 !== _p$.e && setAttribute(_el$18, "title", _p$.e = _v$3);
4431
+ _v$4 !== _p$.t && setAttribute(_el$18, "aria-expanded", _p$.t = _v$4);
4554
4432
  return _p$;
4555
4433
  }, {
4556
4434
  e: void 0,
4557
4435
  t: void 0
4558
4436
  });
4559
- return _el$20;
4437
+ return _el$18;
4560
4438
  }
4561
4439
  });
4562
4440
  }
4563
- }), _el$23);
4564
- insert(_el$19, createComponent(Show, {
4441
+ }), _el$21);
4442
+ insert(_el$17, createComponent(Show, {
4565
4443
  get when() {
4566
- return createMemo(() => !!(data.media.hyperWide() && controlPanelMenuExpanded()))() && !exitPromptShown();
4444
+ return memo(() => !!(data.media.hyperWide() && controlPanelMenuExpanded()))() && !exitPromptShown();
4567
4445
  },
4568
4446
  get children() {
4569
- return [_tmpl$92(), _tmpl$102()];
4447
+ return [_tmpl$92(), _tmpl$0()];
4570
4448
  }
4571
- }), _el$23);
4449
+ }), _el$21);
4572
4450
  use((element) => {
4573
4451
  clickOutside(element, () => {
4574
4452
  if (untrack(data.media.hyperWide) && untrack(controlPanelMenuExpanded)) {
4575
4453
  setControlPanelMenuExpanded(false);
4576
4454
  }
4577
4455
  });
4578
- }, _el$23);
4579
- setAttribute(_el$23, "id", controlPanelMenuID);
4580
- _el$23.classList.toggle("control-panel-container--center", !!(controls === "inside"));
4581
- insert(_el$23, createComponent(ControlPanelButtons, {
4456
+ }, _el$21);
4457
+ setAttribute(_el$21, "id", controlPanelMenuID);
4458
+ _el$21.classList.toggle("control-panel-container--center", !!(controls === "inside"));
4459
+ insert(_el$21, createComponent(ControlPanelButtons, {
4582
4460
  openSettings: () => {
4583
4461
  data.$rendererState.setKey("screen", "settings");
4584
4462
  },
@@ -4593,17 +4471,17 @@ var Game = (props) => {
4593
4471
  }));
4594
4472
  createRenderEffect((_p$) => {
4595
4473
  var _v$5 = !!(data.media.hyperWide() && !controlPanelMenuExpanded()), _v$6 = !!(data.media.hyperWide() && controlPanelMenuExpanded());
4596
- _v$5 !== _p$.e && _el$23.classList.toggle("control-panel-container--wide-closed", _p$.e = _v$5);
4597
- _v$6 !== _p$.t && _el$23.classList.toggle("control-panel-container--wide-open", _p$.t = _v$6);
4474
+ _v$5 !== _p$.e && _el$21.classList.toggle("control-panel-container--wide-closed", _p$.e = _v$5);
4475
+ _v$6 !== _p$.t && _el$21.classList.toggle("control-panel-container--wide-open", _p$.t = _v$6);
4598
4476
  return _p$;
4599
4477
  }, {
4600
4478
  e: void 0,
4601
4479
  t: void 0
4602
4480
  });
4603
- return _el$19;
4481
+ return _el$17;
4604
4482
  }
4605
- }), _el$24);
4606
- insert(_el$24, createComponent(Index, {
4483
+ }), _el$22);
4484
+ insert(_el$22, createComponent(Index, {
4607
4485
  get each() {
4608
4486
  return images();
4609
4487
  },
@@ -4642,9 +4520,9 @@ var Game = (props) => {
4642
4520
  return image().visible;
4643
4521
  },
4644
4522
  get children() {
4645
- var _el$28 = _tmpl$15();
4646
- insert(_el$28, () => image().image);
4647
- return _el$28;
4523
+ var _el$26 = _tmpl$132();
4524
+ insert(_el$26, () => image().image);
4525
+ return _el$26;
4648
4526
  }
4649
4527
  });
4650
4528
  }
@@ -4663,23 +4541,23 @@ var Game = (props) => {
4663
4541
  return loading();
4664
4542
  },
4665
4543
  get children() {
4666
- return _tmpl$122();
4544
+ return _tmpl$102();
4667
4545
  }
4668
4546
  }), null);
4669
4547
  createRenderEffect((_p$) => {
4670
- var _v$7 = `${props.className || ""} game`, _v$8 = !!props.isPreview, _v$9 = bg().startsWith("url") ? void 0 : bg(), _v$10 = bg().startsWith("url") ? bg() : void 0, _v$11 = charactersCount(), _v$12 = !!dialog().visible, _v$13 = !dialog().visible, _v$14 = !(dialog().miniature.character && dialog().miniature.emotion), _v$15 = !dialog().content, _v$16 = !!props.isPreview, _v$17 = !!Boolean(text().content), _v$18 = !text().content;
4548
+ var _v$7 = `${props.className || ""} game`, _v$8 = !!props.isPreview, _v$9 = bg().startsWith("url") ? void 0 : bg(), _v$0 = bg().startsWith("url") ? bg() : void 0, _v$1 = charactersCount(), _v$10 = !!dialog().visible, _v$11 = !dialog().visible, _v$12 = !(dialog().miniature.character && dialog().miniature.emotion), _v$13 = !dialog().content, _v$14 = !!props.isPreview, _v$15 = !!Boolean(text().content), _v$16 = !text().content;
4671
4549
  _v$7 !== _p$.e && className(_el$, _p$.e = _v$7);
4672
4550
  _v$8 !== _p$.t && _el$.classList.toggle("preview", _p$.t = _v$8);
4673
4551
  _v$9 !== _p$.a && ((_p$.a = _v$9) != null ? _el$2.style.setProperty("background-color", _v$9) : _el$2.style.removeProperty("background-color"));
4674
- _v$10 !== _p$.o && ((_p$.o = _v$10) != null ? _el$2.style.setProperty("background-image", _v$10) : _el$2.style.removeProperty("background-image"));
4675
- _v$11 !== _p$.i && ((_p$.i = _v$11) != null ? _el$3.style.setProperty("--shown-characters-count", _v$11) : _el$3.style.removeProperty("--shown-characters-count"));
4676
- _v$12 !== _p$.n && _el$4.classList.toggle("action-dialog--visible", _p$.n = _v$12);
4677
- _v$13 !== _p$.s && _el$4.classList.toggle("action-dialog--hidden", _p$.s = _v$13);
4678
- _v$14 !== _p$.h && setAttribute(_el$5, "data-no-person", _p$.h = _v$14);
4679
- _v$15 !== _p$.r && setAttribute(_el$5, "aria-disabled", _p$.r = _v$15);
4680
- _v$16 !== _p$.d && _el$7.classList.toggle("action-dialog-content--disable-shadow", _p$.d = _v$16);
4681
- _v$17 !== _p$.l && _el$18.classList.toggle("action-text--shown", _p$.l = _v$17);
4682
- _v$18 !== _p$.u && setAttribute(_el$18, "aria-disabled", _p$.u = _v$18);
4552
+ _v$0 !== _p$.o && ((_p$.o = _v$0) != null ? _el$2.style.setProperty("background-image", _v$0) : _el$2.style.removeProperty("background-image"));
4553
+ _v$1 !== _p$.i && ((_p$.i = _v$1) != null ? _el$3.style.setProperty("--shown-characters-count", _v$1) : _el$3.style.removeProperty("--shown-characters-count"));
4554
+ _v$10 !== _p$.n && _el$4.classList.toggle("action-dialog--visible", _p$.n = _v$10);
4555
+ _v$11 !== _p$.s && _el$4.classList.toggle("action-dialog--hidden", _p$.s = _v$11);
4556
+ _v$12 !== _p$.h && setAttribute(_el$5, "data-no-person", _p$.h = _v$12);
4557
+ _v$13 !== _p$.r && setAttribute(_el$5, "aria-disabled", _p$.r = _v$13);
4558
+ _v$14 !== _p$.d && _el$7.classList.toggle("action-dialog-content--disable-shadow", _p$.d = _v$14);
4559
+ _v$15 !== _p$.l && _el$16.classList.toggle("action-text--shown", _p$.l = _v$15);
4560
+ _v$16 !== _p$.u && setAttribute(_el$16, "aria-disabled", _p$.u = _v$16);
4683
4561
  return _p$;
4684
4562
  }, {
4685
4563
  e: void 0,
@@ -4701,17 +4579,17 @@ var Game = (props) => {
4701
4579
  delegateEvents(["click", "keydown"]);
4702
4580
 
4703
4581
  // src/screens/loading.tsx
4704
- var _tmpl$16 = /* @__PURE__ */ template(`<div class=loading><div class=loading__animation><div></div><div></div><div></div><div>`);
4582
+ var _tmpl$14 = /* @__PURE__ */ template(`<div class=loading><div class=loading__animation><div></div><div></div><div></div><div>`);
4705
4583
  var Loading = (props) => {
4706
4584
  return (() => {
4707
- var _el$ = _tmpl$16();
4585
+ var _el$ = _tmpl$14();
4708
4586
  createRenderEffect(() => _el$.classList.toggle("overlay", !!props.overlay));
4709
4587
  return _el$;
4710
4588
  })();
4711
4589
  };
4712
4590
 
4713
4591
  // src/screens/mainmenu.tsx
4714
- var _tmpl$17 = /* @__PURE__ */ template(`<div class=main-menu><div class=main-menu__controls><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text>`);
4592
+ var _tmpl$15 = /* @__PURE__ */ template(`<div class=main-menu><div class=main-menu__controls><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text></span></button><button type=button class="button main-menu__button"><span class=main-menu__button__text>`);
4715
4593
  var _tmpl$27 = /* @__PURE__ */ template(`<button>`);
4716
4594
  var MainMenu = () => {
4717
4595
  const {
@@ -4728,7 +4606,7 @@ var MainMenu = () => {
4728
4606
  $rendererState.mutate((s) => s.screen, screen);
4729
4607
  });
4730
4608
  return (() => {
4731
- var _el$ = _tmpl$17(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$10 = _el$9.firstChild;
4609
+ var _el$ = _tmpl$15(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$0 = _el$9.firstChild;
4732
4610
  _el$3.$$click = () => {
4733
4611
  options.newGame();
4734
4612
  };
@@ -4753,7 +4631,7 @@ var MainMenu = () => {
4753
4631
  _el$9.$$click = () => {
4754
4632
  goto("settings");
4755
4633
  };
4756
- insert(_el$10, () => t("Settings"));
4634
+ insert(_el$0, () => t("Settings"));
4757
4635
  insert(_el$9, createComponent(Icon, {
4758
4636
  icon: "#novely-settings-icon"
4759
4637
  }), null);
@@ -4767,9 +4645,9 @@ var MainMenu = () => {
4767
4645
  return rendererStore().mainmenu;
4768
4646
  },
4769
4647
  children: (item) => (() => {
4770
- var _el$11 = _tmpl$27();
4771
- spread(_el$11, mergeProps(() => item(goto)), false, false);
4772
- return _el$11;
4648
+ var _el$1 = _tmpl$27();
4649
+ spread(_el$1, mergeProps(() => item(goto)), false, false);
4650
+ return _el$1;
4773
4651
  })()
4774
4652
  })
4775
4653
  }), null);
@@ -4779,7 +4657,7 @@ var MainMenu = () => {
4779
4657
  delegateEvents(["click"]);
4780
4658
 
4781
4659
  // src/screens/saves.tsx
4782
- var _tmpl$18 = /* @__PURE__ */ template(`<ol class=saves__list>`);
4660
+ var _tmpl$16 = /* @__PURE__ */ template(`<ol class=saves__list>`);
4783
4661
  var _tmpl$28 = /* @__PURE__ */ template(`<div class=saves><div class=saves__controls><button type=button class="button saves__button"></button></div><div class=saves__list-container>`);
4784
4662
  var _tmpl$36 = /* @__PURE__ */ template(`<div class="saves__list saves__list--empty">`);
4785
4663
  var Saves = () => {
@@ -4865,7 +4743,7 @@ var Saves = () => {
4865
4743
  })();
4866
4744
  },
4867
4745
  get children() {
4868
- var _el$5 = _tmpl$18();
4746
+ var _el$5 = _tmpl$16();
4869
4747
  use(setList, _el$5);
4870
4748
  insert(_el$5, createComponent(For, {
4871
4749
  get each() {
@@ -4896,7 +4774,7 @@ var Saves = () => {
4896
4774
  delegateEvents(["click"]);
4897
4775
 
4898
4776
  // src/screens/settings.tsx
4899
- var _tmpl$19 = /* @__PURE__ */ template(`<div class="root settings"><div class=settings__controls><button type=button class="button settings__button"></button><button type=button class="button settings__button"></button></div><div class=settings__options>`);
4777
+ var _tmpl$17 = /* @__PURE__ */ template(`<div class="root settings"><div class=settings__controls><button type=button class="button settings__button"></button><button type=button class="button settings__button"></button></div><div class=settings__options>`);
4900
4778
  var _tmpl$29 = /* @__PURE__ */ template(`<option>`);
4901
4779
  var Settings = (props) => {
4902
4780
  const {
@@ -4940,7 +4818,7 @@ var Settings = (props) => {
4940
4818
  return fn;
4941
4819
  };
4942
4820
  return (() => {
4943
- var _el$ = _tmpl$19(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling;
4821
+ var _el$ = _tmpl$17(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling;
4944
4822
  _el$3.$$click = () => {
4945
4823
  $rendererState.setKey("screen", "mainmenu");
4946
4824
  };
@@ -5045,7 +4923,7 @@ var Settings = (props) => {
5045
4923
  delegateEvents(["click"]);
5046
4924
 
5047
4925
  // src/components/Root.tsx
5048
- var _tmpl$20 = /* @__PURE__ */ template(`<div class=root>`);
4926
+ var _tmpl$18 = /* @__PURE__ */ template(`<div class=root>`);
5049
4927
  var createRootComponent = ({
5050
4928
  $rendererState,
5051
4929
  $contextState,
@@ -5078,7 +4956,7 @@ var createRootComponent = ({
5078
4956
  emitter.emit("screen:change", currentScreen);
5079
4957
  });
5080
4958
  return (() => {
5081
- var _el$ = _tmpl$20();
4959
+ var _el$ = _tmpl$18();
5082
4960
  var _ref$ = setRoot;
5083
4961
  typeof _ref$ === "function" ? use(_ref$, _el$) : setRoot = _el$;
5084
4962
  insert(_el$, createComponent(Provider, {
@@ -5186,7 +5064,7 @@ var showImage = (asset, { classesBase, classesIn, wait } = {}) => {
5186
5064
  const { promise, resolve } = Promise.withResolvers();
5187
5065
  const ctx = useContextState(contextKey);
5188
5066
  const index = getIndex(ctx, key);
5189
- const image = imagePreloadWithCachingNotComplete(asset.source).cloneNode(true);
5067
+ const image = createImageSync(asset.source).cloneNode(true);
5190
5068
  const classesBaseSplitted = classesBase?.split(" ") || [];
5191
5069
  const classesInSplitted = classesIn?.split(" ") || [];
5192
5070
  image.classList.add(...classesBaseSplitted);
@@ -5402,7 +5280,7 @@ var createRenderer = ({
5402
5280
  emotions: {},
5403
5281
  emotion(emotion, shouldRender) {
5404
5282
  if (!this.emotions[emotion]) {
5405
- this.emotions[emotion] = options.getCharacterAssets(character, emotion).map((src) => imagePreloadWithCachingNotComplete(src));
5283
+ this.emotions[emotion] = options.getCharacterAssets(character, emotion).map((src) => createImageSync(src));
5406
5284
  }
5407
5285
  if (!shouldRender) return;
5408
5286
  const stored = this.emotions[emotion];
@@ -5416,7 +5294,7 @@ var createRenderer = ({
5416
5294
  element.style.setProperty("width", width + "px");
5417
5295
  element.style.setProperty("height", height + "px");
5418
5296
  }
5419
- Promise.allSettled(stored.map((image) => imageLoaded(image))).then(() => {
5297
+ Promise.allSettled(stored.map((image) => waitForImage(image))).then(() => {
5420
5298
  const sizesSorted = stored.slice().sort((a, b) => b.width - a.width);
5421
5299
  const sizes = sizesSorted[0];
5422
5300
  element.style.setProperty("width", sizes.naturalWidth + "px");
@@ -5578,11 +5456,11 @@ var createRenderer = ({
5578
5456
  },
5579
5457
  misc: {
5580
5458
  preloadImage: (src) => {
5581
- renderer.misc.preloadImageBlocking(src);
5459
+ createImageSync(src);
5582
5460
  return src;
5583
5461
  },
5584
5462
  preloadImageBlocking: async (src) => {
5585
- await imagePreloadWithCaching(src);
5463
+ await createImage(src);
5586
5464
  },
5587
5465
  preloadAudioBlocking
5588
5466
  },