@fellowhumans/pathmx 0.0.2 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/pathmx.js +824 -140
  2. package/package.json +7 -2
package/dist/pathmx.js CHANGED
@@ -92063,7 +92063,7 @@ var init_values = __esm(() => {
92063
92063
  });
92064
92064
 
92065
92065
  // node_modules/.bun/openai@6.44.0+68a1e3a0c4588df3/node_modules/openai/internal/utils/sleep.mjs
92066
- var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
92066
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
92067
92067
 
92068
92068
  // node_modules/.bun/openai@6.44.0+68a1e3a0c4588df3/node_modules/openai/version.mjs
92069
92069
  var VERSION = "6.44.0";
@@ -93092,8 +93092,8 @@ var init_api_promise = __esm(() => {
93092
93092
  init_parse();
93093
93093
  APIPromise = class APIPromise extends Promise {
93094
93094
  constructor(client, responsePromise, parseResponse = defaultParseResponse) {
93095
- super((resolve2) => {
93096
- resolve2(null);
93095
+ super((resolve) => {
93096
+ resolve(null);
93097
93097
  });
93098
93098
  this.responsePromise = responsePromise;
93099
93099
  this.parseResponse = parseResponse;
@@ -93738,12 +93738,12 @@ class EventStream {
93738
93738
  _EventStream_errored.set(this, false);
93739
93739
  _EventStream_aborted.set(this, false);
93740
93740
  _EventStream_catchingPromiseCreated.set(this, false);
93741
- __classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((resolve2, reject) => {
93742
- __classPrivateFieldSet(this, _EventStream_resolveConnectedPromise, resolve2, "f");
93741
+ __classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((resolve, reject) => {
93742
+ __classPrivateFieldSet(this, _EventStream_resolveConnectedPromise, resolve, "f");
93743
93743
  __classPrivateFieldSet(this, _EventStream_rejectConnectedPromise, reject, "f");
93744
93744
  }), "f");
93745
- __classPrivateFieldSet(this, _EventStream_endPromise, new Promise((resolve2, reject) => {
93746
- __classPrivateFieldSet(this, _EventStream_resolveEndPromise, resolve2, "f");
93745
+ __classPrivateFieldSet(this, _EventStream_endPromise, new Promise((resolve, reject) => {
93746
+ __classPrivateFieldSet(this, _EventStream_resolveEndPromise, resolve, "f");
93747
93747
  __classPrivateFieldSet(this, _EventStream_rejectEndPromise, reject, "f");
93748
93748
  }), "f");
93749
93749
  __classPrivateFieldGet(this, _EventStream_connectedPromise, "f").catch(() => {});
@@ -93795,11 +93795,11 @@ class EventStream {
93795
93795
  return this;
93796
93796
  }
93797
93797
  emitted(event) {
93798
- return new Promise((resolve2, reject) => {
93798
+ return new Promise((resolve, reject) => {
93799
93799
  __classPrivateFieldSet(this, _EventStream_catchingPromiseCreated, true, "f");
93800
93800
  if (event !== "error")
93801
93801
  this.once("error", reject);
93802
- this.once(event, resolve2);
93802
+ this.once(event, resolve);
93803
93803
  });
93804
93804
  }
93805
93805
  async done() {
@@ -94811,7 +94811,7 @@ var init_ChatCompletionStream = __esm(() => {
94811
94811
  if (done) {
94812
94812
  return { value: undefined, done: true };
94813
94813
  }
94814
- return new Promise((resolve2, reject) => readQueue.push({ resolve: resolve2, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
94814
+ return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
94815
94815
  }
94816
94816
  const chunk = pushQueue.shift();
94817
94817
  return { value: chunk, done: false };
@@ -96562,7 +96562,7 @@ var init_AssistantStream = __esm(() => {
96562
96562
  if (done) {
96563
96563
  return { value: undefined, done: true };
96564
96564
  }
96565
- return new Promise((resolve2, reject) => readQueue.push({ resolve: resolve2, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
96565
+ return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
96566
96566
  }
96567
96567
  const chunk = pushQueue.shift();
96568
96568
  return { value: chunk, done: false };
@@ -98305,7 +98305,7 @@ var init_ResponseStream = __esm(() => {
98305
98305
  if (done) {
98306
98306
  return { value: undefined, done: true };
98307
98307
  }
98308
- return new Promise((resolve2, reject) => readQueue.push({ resolve: resolve2, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: undefined, done: true });
98308
+ return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: undefined, done: true });
98309
98309
  }
98310
98310
  const event = pushQueue.shift();
98311
98311
  return { value: event, done: false };
@@ -100758,7 +100758,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
100758
100758
  this._exitCallback = (err) => {
100759
100759
  if (err.code !== "commander.executeSubCommandAsync") {
100760
100760
  throw err;
100761
- } else {}
100761
+ }
100762
100762
  };
100763
100763
  }
100764
100764
  return this;
@@ -104765,7 +104765,7 @@ var require_compile = __commonJS((exports) => {
104765
104765
  const schOrFunc = root2.refs[ref];
104766
104766
  if (schOrFunc)
104767
104767
  return schOrFunc;
104768
- let _sch = resolve3.call(this, root2, ref);
104768
+ let _sch = resolve2.call(this, root2, ref);
104769
104769
  if (_sch === undefined) {
104770
104770
  const schema2 = (_a7 = root2.localRefs) === null || _a7 === undefined ? undefined : _a7[ref];
104771
104771
  const { schemaId } = this.opts;
@@ -104792,7 +104792,7 @@ var require_compile = __commonJS((exports) => {
104792
104792
  function sameSchemaEnv(s1, s2) {
104793
104793
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
104794
104794
  }
104795
- function resolve3(root2, ref) {
104795
+ function resolve2(root2, ref) {
104796
104796
  let sch;
104797
104797
  while (typeof (sch = this.refs[ref]) == "string")
104798
104798
  ref = sch;
@@ -105378,7 +105378,7 @@ var require_fast_uri = __commonJS((exports, module) => {
105378
105378
  }
105379
105379
  return uri;
105380
105380
  }
105381
- function resolve3(baseURI, relativeURI, options) {
105381
+ function resolve2(baseURI, relativeURI, options) {
105382
105382
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
105383
105383
  const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
105384
105384
  schemelessOptions.skipEscape = true;
@@ -105637,7 +105637,7 @@ var require_fast_uri = __commonJS((exports, module) => {
105637
105637
  var fastUri = {
105638
105638
  SCHEMES,
105639
105639
  normalize: normalize3,
105640
- resolve: resolve3,
105640
+ resolve: resolve2,
105641
105641
  resolveComponent,
105642
105642
  equal,
105643
105643
  serialize,
@@ -139319,23 +139319,17 @@ class BuildGraph {
139319
139319
  removeNode(nodeId) {
139320
139320
  this.nodes.delete(nodeId);
139321
139321
  this.replaceEdgesFrom(nodeId, []);
139322
- const incoming = this.edgesByTarget.get(nodeId) ?? [];
139322
+ const incoming = [...this.edgesByTarget.get(nodeId) ?? []];
139323
139323
  for (const edge of incoming) {
139324
139324
  this.removeEdge(edge);
139325
139325
  }
139326
139326
  }
139327
139327
  addEdge(edge) {
139328
- this.edgesBySource.set(edge.from, [
139329
- ...this.edgesBySource.get(edge.from) ?? [],
139330
- edge
139331
- ]);
139332
- this.edgesByTarget.set(edge.to, [
139333
- ...this.edgesByTarget.get(edge.to) ?? [],
139334
- edge
139335
- ]);
139328
+ this.getOrCreateEdgeBucket(this.edgesBySource, edge.from).push(edge);
139329
+ this.getOrCreateEdgeBucket(this.edgesByTarget, edge.to).push(edge);
139336
139330
  }
139337
139331
  replaceEdgesFrom(nodeId, edges) {
139338
- const current = this.edgesBySource.get(nodeId) ?? [];
139332
+ const current = [...this.edgesBySource.get(nodeId) ?? []];
139339
139333
  for (const edge of current) {
139340
139334
  this.removeEdge(edge);
139341
139335
  }
@@ -139360,9 +139354,27 @@ class BuildGraph {
139360
139354
  this.edgesBySource.clear();
139361
139355
  this.edgesByTarget.clear();
139362
139356
  }
139357
+ diagnostics() {
139358
+ return {
139359
+ nodes: this.nodes.size,
139360
+ edges: countEdges(this.edgesBySource),
139361
+ edgesBySourceBuckets: this.edgesBySource.size,
139362
+ edgesByTargetBuckets: this.edgesByTarget.size,
139363
+ emptyEdgesBySourceBuckets: countEmptyBuckets(this.edgesBySource),
139364
+ emptyEdgesByTargetBuckets: countEmptyBuckets(this.edgesByTarget)
139365
+ };
139366
+ }
139367
+ getOrCreateEdgeBucket(index2, nodeId) {
139368
+ let edges = index2.get(nodeId);
139369
+ if (!edges) {
139370
+ edges = [];
139371
+ index2.set(nodeId, edges);
139372
+ }
139373
+ return edges;
139374
+ }
139363
139375
  removeEdge(edge) {
139364
- this.edgesBySource.set(edge.from, (this.edgesBySource.get(edge.from) ?? []).filter((current) => current !== edge));
139365
- this.edgesByTarget.set(edge.to, (this.edgesByTarget.get(edge.to) ?? []).filter((current) => current !== edge));
139376
+ removeEdgeFromIndex(this.edgesBySource, edge.from, edge);
139377
+ removeEdgeFromIndex(this.edgesByTarget, edge.to, edge);
139366
139378
  }
139367
139379
  walk(start, next) {
139368
139380
  const queue = Array.isArray(start) ? [...start] : [start];
@@ -139384,6 +139396,30 @@ class BuildGraph {
139384
139396
  return [...visited];
139385
139397
  }
139386
139398
  }
139399
+ function removeEdgeFromIndex(index2, nodeId, edge) {
139400
+ const edges = index2.get(nodeId);
139401
+ if (!edges)
139402
+ return;
139403
+ const edgeIndex = edges.indexOf(edge);
139404
+ if (edgeIndex >= 0)
139405
+ edges.splice(edgeIndex, 1);
139406
+ if (edges.length === 0)
139407
+ index2.delete(nodeId);
139408
+ }
139409
+ function countEdges(index2) {
139410
+ let count = 0;
139411
+ for (const edges of index2.values())
139412
+ count += edges.length;
139413
+ return count;
139414
+ }
139415
+ function countEmptyBuckets(index2) {
139416
+ let count = 0;
139417
+ for (const edges of index2.values()) {
139418
+ if (edges.length === 0)
139419
+ count += 1;
139420
+ }
139421
+ return count;
139422
+ }
139387
139423
  // packages/build/src/repository/node-ids.ts
139388
139424
  var sourceNodeId = (id) => `source:${id}`;
139389
139425
  var sourceDataNodeId = (id) => `source-data:${id}`;
@@ -143175,6 +143211,19 @@ function createMetadataRecordDelta(previous, current) {
143175
143211
  }
143176
143212
  return Object.keys(delta).length > 0 ? delta : undefined;
143177
143213
  }
143214
+ function createMetadataRecordDeltaForKeys(previous, current, keys2) {
143215
+ const delta = {};
143216
+ for (const key2 of keys2) {
143217
+ if (key2 in current) {
143218
+ if (!stableJsonEqual(previous[key2], current[key2])) {
143219
+ delta[key2] = current[key2];
143220
+ }
143221
+ } else if (key2 in previous) {
143222
+ delta[key2] = null;
143223
+ }
143224
+ }
143225
+ return Object.keys(delta).length > 0 ? delta : undefined;
143226
+ }
143178
143227
  function buildOutputStateToDelta(state) {
143179
143228
  return {
143180
143229
  sources: state.sources,
@@ -143185,11 +143234,11 @@ function buildOutputStateToDelta(state) {
143185
143234
  runtime: state.runtime
143186
143235
  };
143187
143236
  }
143188
- function createBuildOutputMetadataDelta(previous, current) {
143237
+ function createBuildOutputMetadataDelta(previous, current, hints) {
143189
143238
  if (!previous)
143190
143239
  return buildOutputStateToDelta(current);
143191
143240
  const delta = {};
143192
- const sources = createMetadataRecordDelta(previous.sources, current.sources);
143241
+ const sources = hints?.sourceIds ? createMetadataRecordDeltaForKeys(previous.sources, current.sources, hints.sourceIds) : createMetadataRecordDelta(previous.sources, current.sources);
143193
143242
  if (sources)
143194
143243
  delta.sources = sources;
143195
143244
  const sourceFiles = createMetadataRecordDelta(previous.sourceFiles, current.sourceFiles);
@@ -143198,17 +143247,20 @@ function createBuildOutputMetadataDelta(previous, current) {
143198
143247
  if (!stableJsonEqual(previous.missingSourceFilePaths, current.missingSourceFilePaths)) {
143199
143248
  delta.missingSourceFilePaths = current.missingSourceFilePaths;
143200
143249
  }
143201
- const renderedBlocks = createMetadataRecordDelta(previous.renderedBlocks, current.renderedBlocks);
143250
+ const renderedBlocks = hints?.blockIds ? createMetadataRecordDeltaForKeys(previous.renderedBlocks, current.renderedBlocks, hints.blockIds) : createMetadataRecordDelta(previous.renderedBlocks, current.renderedBlocks);
143202
143251
  if (renderedBlocks)
143203
143252
  delta.renderedBlocks = renderedBlocks;
143204
- const artifacts = createMetadataRecordDelta(previous.artifacts, current.artifacts);
143253
+ const artifacts = hints?.artifactPaths ? createMetadataRecordDeltaForKeys(previous.artifacts, current.artifacts, hints.artifactPaths) : createMetadataRecordDelta(previous.artifacts, current.artifacts);
143205
143254
  if (artifacts)
143206
143255
  delta.artifacts = artifacts;
143207
- if (!stableJsonEqual(previous.runtime, current.runtime)) {
143256
+ if (hints?.runtimeChanged === true || hints?.runtimeChanged === undefined && !stableJsonEqual(previous.runtime, current.runtime)) {
143208
143257
  delta.runtime = current.runtime;
143209
143258
  }
143210
143259
  return delta;
143211
143260
  }
143261
+ function isBuildOutputMetadataDeltaEmpty(delta) {
143262
+ return delta.sources === undefined && delta.sourceFiles === undefined && delta.missingSourceFilePaths === undefined && delta.renderedBlocks === undefined && delta.artifacts === undefined && delta.runtime === undefined;
143263
+ }
143212
143264
  function applyMetadataRecordDelta(target, delta) {
143213
143265
  if (!delta)
143214
143266
  return;
@@ -143750,6 +143802,46 @@ function getChangedRenderedBlockIds(changes) {
143750
143802
  }
143751
143803
  return blockIds;
143752
143804
  }
143805
+ function getChangedSourceIds2(changes) {
143806
+ const sourceIds = new Set;
143807
+ if (!changes)
143808
+ return sourceIds;
143809
+ for (const change of changes) {
143810
+ for (const nodeId of [
143811
+ ...change.dirtyNodes,
143812
+ ...change.affectedNodes,
143813
+ ...change.addedNodes,
143814
+ ...change.removedNodes
143815
+ ]) {
143816
+ const sourceId = sourceIdFromNodeId(nodeId);
143817
+ if (sourceId)
143818
+ sourceIds.add(sourceId);
143819
+ }
143820
+ }
143821
+ return sourceIds;
143822
+ }
143823
+ function getChangedArtifactPaths(artifactChanges) {
143824
+ if (!artifactChanges)
143825
+ return new Set;
143826
+ return new Set([
143827
+ ...artifactChanges.written.map((artifact) => artifact.path),
143828
+ ...artifactChanges.deleted.map((deletion) => deletion.path)
143829
+ ]);
143830
+ }
143831
+ function createBuildOutputMetadataDeltaHints(options) {
143832
+ const hasRepositoryChanges = (options.changes?.length ?? 0) > 0;
143833
+ const hasArtifactChanges = (options.artifactChanges?.written.length ?? 0) > 0 || (options.artifactChanges?.deleted.length ?? 0) > 0;
143834
+ if (!hasRepositoryChanges && !hasArtifactChanges)
143835
+ return;
143836
+ return {
143837
+ ...hasRepositoryChanges ? {
143838
+ sourceIds: getChangedSourceIds2(options.changes),
143839
+ blockIds: getChangedRenderedBlockIds(options.changes)
143840
+ } : {},
143841
+ ...hasArtifactChanges ? { artifactPaths: getChangedArtifactPaths(options.artifactChanges) } : {},
143842
+ ...options.runtimeChanged === undefined ? {} : { runtimeChanged: options.runtimeChanged }
143843
+ };
143844
+ }
143753
143845
  function createSourceEntries(ctx) {
143754
143846
  return Object.fromEntries(ctx.repository.getSources().map((source3) => [
143755
143847
  source3.id,
@@ -144292,7 +144384,12 @@ async function writeBuildOutputCache(options) {
144292
144384
  artifacts,
144293
144385
  runtime: runtime3
144294
144386
  };
144295
- if (previousState && stableJson(previousState) === stableJson(state)) {
144387
+ const delta = createBuildOutputMetadataDelta(previousState, state, createBuildOutputMetadataDeltaHints({
144388
+ changes,
144389
+ artifactChanges,
144390
+ runtimeChanged
144391
+ }));
144392
+ if (previousState && isBuildOutputMetadataDeltaEmpty(delta)) {
144296
144393
  setCachedBuildOutputState(ctx, root, state);
144297
144394
  trustedBuildCacheBlobPaths.set(ctx, collectCacheBlobPaths(state));
144298
144395
  for (const [rendered, ref] of renderedBlockRefs) {
@@ -144308,7 +144405,7 @@ async function writeBuildOutputCache(options) {
144308
144405
  await Promise.all([...blobs.values()].map((write) => writeCacheBlob(cacheStorage, write, trustedBlobPaths)));
144309
144406
  });
144310
144407
  await metadataStore.writeDelta(root, {
144311
- buildOutput: createBuildOutputMetadataDelta(previousState, state)
144408
+ buildOutput: delta
144312
144409
  });
144313
144410
  await ctx.performance.measure({
144314
144411
  kind: "cache",
@@ -145979,6 +146076,61 @@ async function createBuildSession(options) {
145979
146076
  }
145980
146077
  return finish(roots);
145981
146078
  }
146079
+ async function readMetadataJournalEntries(state) {
146080
+ if (!state.ctx.env.cache || !state.entrySourceId || !state.outputPath) {
146081
+ return;
146082
+ }
146083
+ const root = {
146084
+ entry: state.entry,
146085
+ sourceId: state.entrySourceId,
146086
+ outputPath: state.outputPath
146087
+ };
146088
+ const manifest5 = await readStorageJson(state.ctx.env.cache, getBuildMetadataManifestPath(root));
146089
+ if (!manifest5)
146090
+ return;
146091
+ const signature = createBuildMetadataStoreSignature(createBuildCacheSignature(state.ctx.plugins));
146092
+ if (manifest5.signature !== signature || manifest5.root.entry !== root.entry || manifest5.root.sourceId !== root.sourceId || manifest5.root.outputPath !== root.outputPath) {
146093
+ return;
146094
+ }
146095
+ return manifest5.journal.length;
146096
+ }
146097
+ async function rootDiagnostics(state) {
146098
+ const pendingCache = state.pendingCache;
146099
+ const metadataJournalEntries = await readMetadataJournalEntries(state);
146100
+ const diagnostics = {
146101
+ entry: state.entry,
146102
+ ...state.pathId ? { pathId: state.pathId } : {},
146103
+ ...state.entrySourceId ? { entrySourceId: state.entrySourceId } : {},
146104
+ ...state.outputPath ? { outputPath: state.outputPath } : {},
146105
+ sources: state.ctx.repository.getSources().length,
146106
+ reachableSources: state.reachableSourcePaths.size,
146107
+ missingSources: state.missingSourcePaths.size,
146108
+ graph: state.ctx.repository.graph.diagnostics(),
146109
+ renderCache: {
146110
+ entries: state.ctx.renderCache.size
146111
+ },
146112
+ artifacts: {
146113
+ entries: state.ctx.artifacts.list().length
146114
+ },
146115
+ deferredTasks: state.ctx.deferredTasks?.summary() ?? createUnavailableDeferredTaskSummary(),
146116
+ pending: {
146117
+ settle: settledPending.has(state.entry),
146118
+ cache: !!pendingCache,
146119
+ cacheChanges: pendingCache?.changes.length ?? 0,
146120
+ cacheArtifacts: pendingCache?.artifacts.size ?? 0
146121
+ },
146122
+ ...metadataJournalEntries === undefined ? {} : { metadataJournal: { entries: metadataJournalEntries } }
146123
+ };
146124
+ return diagnostics;
146125
+ }
146126
+ async function collectDiagnostics() {
146127
+ const roots = await Promise.all(states.map(rootDiagnostics));
146128
+ return {
146129
+ roots,
146130
+ pendingSettleRoots: settledPending.size,
146131
+ pendingCacheRoots: roots.filter((root) => root.pending.cache).length
146132
+ };
146133
+ }
145982
146134
  async function drainDeferredTasksSession(options2 = {}) {
145983
146135
  let latest = await runDeferredTasksSession(options2);
145984
146136
  while (findStatesWithRunnableDeferredTasks(options2).length > 0) {
@@ -146048,6 +146200,9 @@ async function createBuildSession(options) {
146048
146200
  hasPendingSettle() {
146049
146201
  return settledPending.size > 0;
146050
146202
  },
146203
+ diagnostics() {
146204
+ return runExclusive(collectDiagnostics);
146205
+ },
146051
146206
  flushCache() {
146052
146207
  return runExclusive(flushPendingCache);
146053
146208
  }
@@ -157565,7 +157720,7 @@ function finalize(ctx, schema2) {
157565
157720
  result.$schema = "http://json-schema.org/draft-07/schema#";
157566
157721
  } else if (ctx.target === "draft-04") {
157567
157722
  result.$schema = "http://json-schema.org/draft-04/schema#";
157568
- } else if (ctx.target === "openapi-3.0") {} else {}
157723
+ } else if (ctx.target === "openapi-3.0") {}
157569
157724
  if (ctx.external?.uri) {
157570
157725
  const id = ctx.external.registry.get(schema2)?.id;
157571
157726
  if (!id)
@@ -157809,7 +157964,7 @@ var literalProcessor = (schema2, ctx, json2, _params) => {
157809
157964
  if (val === undefined) {
157810
157965
  if (ctx.unrepresentable === "throw") {
157811
157966
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
157812
- } else {}
157967
+ }
157813
157968
  } else if (typeof val === "bigint") {
157814
157969
  if (ctx.unrepresentable === "throw") {
157815
157970
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -161064,12 +161219,12 @@ function createBuildPreset(options = {}) {
161064
161219
  import { access, mkdir, readFile, readdir, rm, stat } from "fs/promises";
161065
161220
  import {
161066
161221
  basename as basename4,
161067
- dirname as dirname3,
161222
+ dirname as dirname2,
161068
161223
  extname as extname2,
161069
161224
  isAbsolute,
161070
161225
  join as join2,
161071
161226
  relative,
161072
- resolve as resolve2
161227
+ resolve
161073
161228
  } from "path";
161074
161229
 
161075
161230
  // node_modules/.bun/beautiful-mermaid@1.1.3/node_modules/beautiful-mermaid/src/theme.ts
@@ -174972,11 +175127,6 @@ function browserTailwindCompiler() {
174972
175127
  };
174973
175128
  }
174974
175129
 
174975
- // packages/build/src/adapters/math-temml.ts
174976
- import { readFileSync } from "fs";
174977
- import { dirname as dirname2, resolve } from "path";
174978
- import { fileURLToPath } from "url";
174979
-
174980
175130
  // node_modules/.bun/temml@0.13.3/node_modules/temml/dist/temml.mjs
174981
175131
  class ParseError {
174982
175132
  constructor(message, token) {
@@ -187043,16 +187193,369 @@ var temml$1 = {
187043
187193
  __defineMacro: defineMacro
187044
187194
  };
187045
187195
 
187046
- // packages/build/src/adapters/math-temml.ts
187047
- function readTemmlLocalCss() {
187048
- const temmlDir = dirname2(fileURLToPath(import.meta.resolve("temml")));
187049
- const cssPath = resolve(temmlDir, "Temml-Local.css");
187050
- const fontPath = resolve(temmlDir, "Temml.woff2");
187051
- const fontBase64 = Buffer.from(readFileSync(fontPath)).toString("base64");
187052
- return readFileSync(cssPath, "utf-8").replace(`url('Temml.woff2')`, `url('data:font/woff2;base64,${fontBase64}')`);
187196
+ // packages/build/src/adapters/temml-assets.generated.ts
187197
+ var temmlLocalCss = `/*
187198
+ Temml.woff2 is a clone of KaTeX_Script-Regular, except that the code points
187199
+ have been changed from ASCII to Unicode Mathematical Alphanumeric Symbols Script capitals,
187200
+ Unicode range 1D49C to 1D4B5.
187201
+ */
187202
+
187203
+ @font-face {
187204
+ font-family: 'Temml';
187205
+ src: url('data:font/woff2;base64,d09GMgABAAAAACS8AA4AAAAAQFQAACRnAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgnAILgmXFxEICthwxX8BNgIkA4EQC0oABCAFhlQHIAyBCh+jNTMDwcYBQMLe3iiCjQOEGjwO+K8PuDEE76D6jHAQlli8ik4tRHgIIzcV0wnC7xzHcbCq6sw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nAMwywDNbOYPNa9WBYNDs1hI/qUdRKmKYxyUDhvWLjHYbN9CCMbFJDmYoT3LBTY6YVyxRNcf00oZ5DzS0902uRktUaf+FVcPaxOUmPbVE0sAid+PXSocxal1Cp6ZCXvqjp1fUpbFmGm3yjDa9pktcu/VieiI5rWe6+Gek72UGbRZIzeQR9JA+W9lJKoc5KztJzY6trhPvrKsZWaUGsjbKjPcgZ9vKIcNSmjennR9oukyZLk2pvWexM8fixGs1UJEj5+XYjoa58EUaf3LIkdgrlu+1mThP97bMOyuHI+qNLJ1zb36fSIFzMQphWjFPq25dqLN/Qeci7q7x4VJ6Ww/ch66tq6kArN8K+CNuuLtClL9iKjkvbr7FQgG+WcyDR6krHiKLKJKmBh4vgazJCTlvKMGqtRHr9xqwDk3l/Mf5Rk377W8imdzqdvWDgwJmzv3ycPn1uu5GnPWxjpU=') format('woff2');
187206
+ font-weight: normal;
187207
+ font-style: normal;
187208
+ }
187209
+
187210
+ math {
187211
+ font-family: "Cambria Math", 'STIXTwoMath-Regular', 'NotoSansMath-Regular', math;
187212
+ font-style: normal;
187213
+ font-weight: normal;
187214
+ line-height: normal;
187215
+ font-size-adjust: none;
187216
+ text-indent: 0;
187217
+ text-transform: none;
187218
+ letter-spacing: normal;
187219
+ word-wrap: normal;
187220
+ direction: ltr;
187221
+ /* Prevent Firefox from omitting the dot on i or j. */
187222
+ font-feature-settings: "dtls" off;
187223
+ }
187224
+
187225
+ math * {
187226
+ border-color: currentColor;
187227
+ }
187228
+
187229
+ /* display: block is necessary in Firefox and Safari.
187230
+ * Not in Chromium, which recognizes display: "block math" written inline. */
187231
+ math.tml-display {
187232
+ display: block;
187233
+ width: 100%;
187234
+ }
187235
+
187236
+ *.mathcal {
187237
+ /* NotoSans */
187238
+ font-feature-settings: 'ss01';
187239
+ }
187240
+
187241
+ math .mathscr {
187242
+ font-family: "Temml";
187243
+ }
187244
+
187245
+ mo.tml-prime {
187246
+ font-family: Temml;
187247
+ }
187248
+
187249
+ /* Cramped superscripts in WebKit */
187250
+ mfrac > :nth-child(2),
187251
+ msqrt,
187252
+ mover > :first-child {
187253
+ math-shift: compact
187254
+ }
187255
+
187256
+ .menclose {
187257
+ display: inline-block;
187258
+ position: relative;
187259
+ padding: 0.5ex 0ex;
187260
+ }
187261
+ .tml-cancelto {
187262
+ display: inline-block;
187263
+ position: absolute;
187264
+ top: 0;
187265
+ left: 0;
187266
+ padding: 0.5ex 0ex;
187267
+ background-color: currentColor;
187268
+ /* Use the SVG as an alpha mask (painted by background-color) */
187269
+ -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='black' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%25' y1='100%25' stroke='black' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
187270
+ mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><defs><marker id='a' markerHeight='5' markerUnits='strokeWidth' markerWidth='7' orient='auto' refX='7' refY='2.5'><path fill='black' d='m0 0 7 2.5L0 5z'/></marker></defs><line x2='100%25' y1='100%25' stroke='black' stroke-width='.06em' marker-end='url(%23a)' vector-effect='non-scaling-stroke'/></svg>");
187271
+ -webkit-mask-repeat: no-repeat;
187272
+ mask-repeat: no-repeat;
187273
+ -webkit-mask-size: 100% 100%;
187274
+ mask-size: 100% 100%;
187275
+ -webkit-mask-position: 0 0;
187276
+ mask-position: 0 0;
187277
+ }
187278
+
187279
+ @supports (-moz-appearance: none) {
187280
+ /* \\vec w/o italic correction for Firefox */
187281
+ .tml-vec {
187282
+ transform: scale(0.75)
187283
+ }
187284
+ /* Fix \\cancelto in Firefox */
187285
+ .ff-narrow {
187286
+ width: 0em;
187287
+ }
187288
+ .ff-nudge-left {
187289
+ margin-left: -0.2em;
187290
+ }
187291
+ /* Squash hidden mrows in \\bordermatrix. Messes with centering, but necessary to squash. */
187292
+ .ff-squash mtd {
187293
+ display: block;
187294
+ height: 0;
187295
+ }
187296
+ }
187297
+
187298
+ @supports (not (-moz-appearance: none)) {
187299
+ /* Chromium and WebKit */
187300
+ /* prime vertical alignment */
187301
+ mo.tml-prime {
187302
+ font-family: Temml;
187303
+ }
187304
+ /* Italic correction on superscripts */
187305
+ .tml-sml-pad {
187306
+ padding-left: 0.05em;
187307
+ }
187308
+ .tml-med-pad {
187309
+ padding-left: 0.10em;
187310
+ }
187311
+ .tml-lrg-pad {
187312
+ padding-left: 0.15em;
187313
+ }
187314
+ }
187315
+
187316
+ @supports (-webkit-backdrop-filter: blur(1px)) {
187317
+ /* WebKit vertical & italic correction on accents */
187318
+ .wbk-acc {
187319
+ /* lower by x-height distance */
187320
+ transform: translate(0em, 0.431em);
187321
+ }
187322
+ .wbk-sml {
187323
+ transform: translate(0.07em, 0);
187324
+ }
187325
+ .wbk-sml-acc {
187326
+ transform: translate(0.07em, 0.431em);
187327
+ }
187328
+ .wbk-sml-vec {
187329
+ transform: scale(0.75) translate(0.07em, 0);
187330
+ }
187331
+ .wbk-med {
187332
+ transform: translate(0.14em, 0);
187333
+ }
187334
+ .wbk-med-acc {
187335
+ transform: translate(0.14em, 0.431em);
187336
+ }
187337
+ .wbk-med-vec {
187338
+ transform: scale(0.75) translate(0.14em, 0);
187339
+ }
187340
+ .wbk-lrg {
187341
+ transform: translate(0.21em, 0);
187342
+ }
187343
+ .wbk-lrg-acc {
187344
+ transform: translate(0.21em, 0.431em);
187345
+ }
187346
+ .wbk-lrg-vec {
187347
+ transform: scale(0.75) translate(0.21em, 0);
187348
+ }
187349
+ }
187350
+
187351
+ /* \\cancel & \\phase use background images. Get them to print. */
187352
+ menclose {
187353
+ -webkit-print-color-adjust: exact; /* Chrome & Edge */
187354
+ print-color-adjust: exact;
187355
+ }
187356
+
187357
+ /* Array cell justification in Firefox & WebKit */
187358
+ .tml-right {
187359
+ text-align: right;
187360
+ }
187361
+ .tml-left {
187362
+ text-align: left;
187363
+ }
187364
+
187365
+ /* For CD labels that grow to the left in Firefox and WebKit */
187366
+ .tml-shift-left { margin-left:-200% }
187367
+
187368
+ /* Styles for Chromium only */
187369
+ @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
187370
+ /* Italic correction on accents */
187371
+ .chr-sml {
187372
+ transform: translate(0.07em, 0)
187373
+ }
187374
+ .chr-sml-vec {
187375
+ transform: scale(0.75) translate(0.07em, 0)
187376
+ }
187377
+ .chr-med {
187378
+ transform: translate(0.14em, 0)
187379
+ }
187380
+ .chr-med-vec {
187381
+ transform: scale(0.75) translate(0.14em, 0)
187382
+ }
187383
+ .chr-lrg {
187384
+ transform: translate(0.21em, 0)
187385
+ }
187386
+ .chr-lrg-vec {
187387
+ transform: scale(0.75) translate(0.21em, 0)
187388
+ }
187389
+
187390
+ /* For CD labels that grow to the left */
187391
+ .tml-shift-left { margin-left:-100% }
187392
+
187393
+ /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
187394
+ /* So use styles. */
187395
+ menclose {
187396
+ position: relative;
187397
+ padding: 0.5ex 0ex;
187398
+ }
187399
+
187400
+ .tml-overline {
187401
+ padding: 0.1em 0 0 0;
187402
+ border-top: 0.065em solid;
187403
+ }
187404
+
187405
+ .tml-underline {
187406
+ padding: 0 0 0.1em 0;
187407
+ border-bottom: 0.065em solid;
187408
+ }
187409
+
187410
+ .tml-cancel {
187411
+ display: inline-block;
187412
+ position: absolute;
187413
+ left: 0.5px;
187414
+ bottom: 0;
187415
+ width: 100%;
187416
+ height: 100%;
187417
+ background-color: currentColor;
187418
+ }
187419
+ .upstrike {
187420
+ clip-path: polygon(0.05em 100%, 0em calc(100% - 0.05em), calc(100% - 0.05em) 0em, 100% 0.05em);
187421
+ }
187422
+ .downstrike {
187423
+ clip-path: polygon(0em 0.05em, 0.05em 0em, 100% calc(100% - 0.05em), calc(100% - 0.05em) 100%);
187424
+ }
187425
+ .sout {
187426
+ clip-path: polygon(0em calc(55% + 0.0333em), 0em calc(55% - 0.0333em), 100% calc(55% - 0.0333em), 100% calc(55% + 0.0333em));
187427
+ }
187428
+ .tml-xcancel {
187429
+ clip-path: polygon(0.05em 0em, 0em 0.05em, calc(50% - 0.05em) 50%, 0em calc(100% - 0.05em), 0.05em 100%, 50% calc(50% + 0.05em), calc(100% - 0.05em) 100%, 100% calc(100% - 0.05em), calc(50% + 0.05em) 50%, 100% 0.05em, calc(100% - 0.05em) 0%, 50% calc(50% - 0.05em));
187430
+ }
187431
+
187432
+ .longdiv-top {
187433
+ border-top: 0.067em solid;
187434
+ padding: 0.1em 0.2em 0.2em 0.433em;
187435
+ }
187436
+ .longdiv-arc {
187437
+ position: absolute;
187438
+ top: 0;
187439
+ bottom: 0.1em;
187440
+ left: -0.4em;
187441
+ width: 0.7em;
187442
+ border: 0.067em solid;
187443
+ transform: translateY(-0.067em);
187444
+ border-radius: 70%;
187445
+ clip-path: inset(0 0 0 0.4em);
187446
+ box-sizing: border-box;}
187447
+ .menclose {display: inline-block;
187448
+ text-align: left;
187449
+ position: relative;
187450
+ }
187451
+
187452
+ .phasor-bottom {
187453
+ border-bottom: 0.067em solid;
187454
+ padding: 0.2em 0.2em 0.1em 0.6em;
187455
+ }
187456
+ .phasor-angle {
187457
+ display: inline-block;
187458
+ position: absolute;
187459
+ left: 0.5px;
187460
+ bottom: -0.04em;
187461
+ height: 100%;
187462
+ aspect-ratio: 0.5;
187463
+ background-color: currentColor;
187464
+ clip-path: polygon(0.05em 100%, 0em calc(100% - 0.05em), calc(100% - 0.05em) 0em, 100% 0.05em);
187465
+ }
187466
+
187467
+ .tml-fbox {
187468
+ padding: 3pt;
187469
+ border: 1px solid;
187470
+ }
187471
+
187472
+ .circle-pad {
187473
+ padding: 0.267em;
187474
+ }
187475
+ .textcircle {
187476
+ position: absolute;
187477
+ top: 0;
187478
+ bottom: 0;
187479
+ right: 0;
187480
+ left: 0;
187481
+ border: 0.067em solid;
187482
+ border-radius: 50%;
187483
+ }
187484
+
187485
+ .actuarial {
187486
+ padding: 0.03889em 0.03889em 0 0.03889em;
187487
+ border-width: 0.08em 0.08em 0em 0em;
187488
+ border-style: solid;
187489
+ margin-right: 0.03889em;
187490
+ }
187491
+
187492
+ /* Stretch \\widetilde */
187493
+ .tml-crooked-2 {
187494
+ transform: scale(2.0, 1.1)
187495
+ }
187496
+ .tml-crooked-3 {
187497
+ transform: scale(3.0, 1.3)
187498
+ }
187499
+ .tml-crooked-4 {
187500
+ transform: scale(4.0, 1.4)
187501
+ }
187502
+ /* set array cell justification */
187503
+ .tml-right {
187504
+ text-align: -webkit-right;
187505
+ }
187506
+ .tml-left {
187507
+ text-align: -webkit-left;
187508
+ }
187053
187509
  }
187510
+
187511
+ .special-fraction {
187512
+ font-family: 'STIX TWO', 'Times New Roman', Times, Tinos, serif;
187513
+ }
187514
+
187515
+ /* flex-wrap for line-breaking in Chromium */
187516
+ math {
187517
+ display: inline-flex;
187518
+ flex-wrap: wrap;
187519
+ align-items: baseline;
187520
+ }
187521
+ math > mrow {
187522
+ padding: 0.5ex 0ex;
187523
+ }
187524
+
187525
+ /* Default mtd top padding is 0.5ex per MathML-Core and user-agent CSS */
187526
+ /* We adjust for jot and small */
187527
+ mtable.tml-jot mtd {
187528
+ padding-top: 0.7ex;
187529
+ padding-bottom: 0.7ex;
187530
+ }
187531
+ mtable.tml-small mtd {
187532
+ padding-top: 0.35ex;
187533
+ padding-bottom: 0.35ex;
187534
+ }
187535
+
187536
+ /* Firefox */
187537
+ @-moz-document url-prefix() {
187538
+ /* Avoid flex-wrap */
187539
+ math { display: inline; }
187540
+ math > mrow { padding: 0 }
187541
+ /* Adjust Firefox spacing between array rows */
187542
+ mtd, mtable.tml-small mtd { padding-top: 0; padding-bottom: 0; }
187543
+ mtable.tml-jot mtd { padding-top: 0.2ex; padding-bottom: 0.ex; }
187544
+ }
187545
+
187546
+ /* AMS environment auto-numbering via CSS counter. */
187547
+ .tml-eqn::before {
187548
+ counter-increment: tmlEqnNo;
187549
+ content: "(" counter(tmlEqnNo) ")";
187550
+ }
187551
+
187552
+ body {
187553
+ counter-reset: tmlEqnNo;
187554
+ }
187555
+ `;
187556
+
187557
+ // packages/build/src/adapters/math-temml.ts
187054
187558
  function temmlMathRenderer(options = {}) {
187055
- let css;
187056
187559
  return {
187057
187560
  cacheKey: JSON.stringify({
187058
187561
  adapter: "temml",
@@ -187066,8 +187569,7 @@ function temmlMathRenderer(options = {}) {
187066
187569
  });
187067
187570
  },
187068
187571
  css() {
187069
- css ??= readTemmlLocalCss();
187070
- return css;
187572
+ return temmlLocalCss;
187071
187573
  }
187072
187574
  };
187073
187575
  }
@@ -188370,7 +188872,7 @@ var RuleFactory = class _RuleFactory {
188370
188872
  let localIncludedRule = repository2[reference.ruleName];
188371
188873
  if (localIncludedRule) {
188372
188874
  ruleId = _RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository2);
188373
- } else {}
188875
+ }
188374
188876
  break;
188375
188877
  case 3:
188376
188878
  case 4:
@@ -188382,11 +188884,11 @@ var RuleFactory = class _RuleFactory {
188382
188884
  let externalIncludedRule = externalGrammar.repository[externalGrammarInclude];
188383
188885
  if (externalIncludedRule) {
188384
188886
  ruleId = _RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);
188385
- } else {}
188887
+ }
188386
188888
  } else {
188387
188889
  ruleId = _RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);
188388
188890
  }
188389
- } else {}
188891
+ }
188390
188892
  break;
188391
188893
  }
188392
188894
  } else {
@@ -203308,19 +203810,19 @@ function getIconsTree(data2, names) {
203308
203810
  const icons = data2.icons;
203309
203811
  const aliases2 = data2.aliases || Object.create(null);
203310
203812
  const resolved = Object.create(null);
203311
- function resolve2(name) {
203813
+ function resolve(name) {
203312
203814
  if (icons[name])
203313
203815
  return resolved[name] = [];
203314
203816
  if (!(name in resolved)) {
203315
203817
  resolved[name] = null;
203316
203818
  const parent = aliases2[name] && aliases2[name].parent;
203317
- const value = parent && resolve2(parent);
203819
+ const value = parent && resolve(parent);
203318
203820
  if (value)
203319
203821
  resolved[name] = [parent].concat(value);
203320
203822
  }
203321
203823
  return resolved[name];
203322
203824
  }
203323
- (names || Object.keys(icons).concat(Object.keys(aliases2))).forEach(resolve2);
203825
+ (names || Object.keys(icons).concat(Object.keys(aliases2))).forEach(resolve);
203324
203826
  return resolved;
203325
203827
  }
203326
203828
 
@@ -205919,7 +206421,7 @@ var EXCLUDED_DIRS = new Set([
205919
206421
  ".git",
205920
206422
  ".obsidian",
205921
206423
  ".pathmx",
205922
- ".pathmx2",
206424
+ ".pathmx",
205923
206425
  ".trash",
205924
206426
  "build",
205925
206427
  "dist",
@@ -206027,7 +206529,12 @@ async function createObsidianIndexSource(options) {
206027
206529
  }
206028
206530
  const managed = parseManagedIndexContent(existingContent);
206029
206531
  if (!managed || managed.hash !== hashString(managed.body)) {
206030
- return { status: "conflict", reason: "user-edited", indexPath, sourcePaths };
206532
+ return {
206533
+ status: "conflict",
206534
+ reason: "user-edited",
206535
+ indexPath,
206536
+ sourcePaths
206537
+ };
206031
206538
  }
206032
206539
  }
206033
206540
  await options.env.sourceStorage.write(indexPath, {
@@ -206089,7 +206596,10 @@ function resultFromMatches(matches3) {
206089
206596
  }
206090
206597
  function obsidianWikilinkResolver() {
206091
206598
  return ({ source: source3, sources, targetPath }) => {
206092
- const sourceByPath = new Map(sources.map((candidate) => [normalizeSourcePath(candidate.path), candidate]));
206599
+ const sourceByPath = new Map(sources.map((candidate) => [
206600
+ normalizeSourcePath(candidate.path),
206601
+ candidate
206602
+ ]));
206093
206603
  const exactPaths = [
206094
206604
  resolveSourcePath(targetPath, source3),
206095
206605
  targetPath.startsWith("/") ? normalizeSourcePath(targetPath.slice(1)) : undefined,
@@ -206137,6 +206647,26 @@ var defaultMarkdownOptions = {
206137
206647
  autolinks: true,
206138
206648
  hardSoftBreaks: true
206139
206649
  };
206650
+ var ensuredBunWriteDirs = new Set;
206651
+ async function ensureBunWriteDir(dir) {
206652
+ if (ensuredBunWriteDirs.has(dir))
206653
+ return;
206654
+ await mkdir(dir, { recursive: true });
206655
+ ensuredBunWriteDirs.add(dir);
206656
+ }
206657
+ async function writeBunFile(filePath, body3) {
206658
+ const dir = dirname2(filePath);
206659
+ await ensureBunWriteDir(dir);
206660
+ try {
206661
+ await Bun.write(filePath, body3);
206662
+ } catch (error52) {
206663
+ if (!isMissingFileError(error52))
206664
+ throw error52;
206665
+ ensuredBunWriteDirs.delete(dir);
206666
+ await ensureBunWriteDir(dir);
206667
+ await Bun.write(filePath, body3);
206668
+ }
206669
+ }
206140
206670
  var textExtensions = new Set([
206141
206671
  ".css",
206142
206672
  ".html",
@@ -206211,8 +206741,7 @@ function createBunFileStorage(rootDir) {
206211
206741
  },
206212
206742
  async write(storagePath, entry) {
206213
206743
  const filePath = join2(rootDir, storagePath);
206214
- await mkdir(dirname3(filePath), { recursive: true });
206215
- await Bun.write(filePath, storageContentToBody(entry.content));
206744
+ await writeBunFile(filePath, storageContentToBody(entry.content));
206216
206745
  },
206217
206746
  async delete(storagePath) {
206218
206747
  await rm(join2(rootDir, storagePath), { force: true });
@@ -206262,13 +206791,12 @@ function createBunArtifactWriter(rootDir, options = {}) {
206262
206791
  return {
206263
206792
  async write(artifact) {
206264
206793
  const filePath = join2(rootDir, artifact.path);
206265
- await mkdir(dirname3(filePath), { recursive: true });
206266
206794
  const body3 = artifact.content === undefined ? await readSourceAsset(artifact, options.env) : artifactContentToBody(artifact);
206267
206795
  if (body3 === undefined) {
206268
206796
  await rm(filePath, { force: true });
206269
206797
  return;
206270
206798
  }
206271
- await Bun.write(filePath, body3);
206799
+ await writeBunFile(filePath, body3);
206272
206800
  },
206273
206801
  async delete(deletion) {
206274
206802
  await rm(join2(rootDir, deletion.path), { force: true });
@@ -206296,12 +206824,12 @@ function createBunMaterializedArtifactExists(outDir, env2) {
206296
206824
  return writer.exists ? writer.exists(artifact) : false;
206297
206825
  };
206298
206826
  }
206299
- var DEFAULT_OUT_DIR = ".pathmx2";
206827
+ var DEFAULT_OUT_DIR = ".pathmx";
206300
206828
  var DEFAULT_ROOT_ENTRY = "index.path.md";
206301
206829
  var DEFAULT_OBSIDIAN_INDEX_PATH = "index.path.md";
206302
206830
  var MISSING_PATH_ENTRY_MESSAGE = "Missing path entry. Provide path entries, add paths to an optional pathmx.config.md or pathmx.json, or create paths/index.path.md or index.path.md.";
206303
206831
  function runtimeAssetPath(value) {
206304
- return value ? resolve2(value) : undefined;
206832
+ return value ? resolve(value) : undefined;
206305
206833
  }
206306
206834
  function createBunRuntimeAssetOptions(options = {}) {
206307
206835
  const viewCssPath = runtimeAssetPath(process.env.PATHMX_RUNTIME_VIEW_CSS);
@@ -206515,7 +207043,7 @@ function toSourcePath(filePath) {
206515
207043
  return filePath.replace(/\\/g, "/").replace(/^\/+/, "");
206516
207044
  }
206517
207045
  async function findPathMXConfig(cwd) {
206518
- let dir = resolve2(cwd);
207046
+ let dir = resolve(cwd);
206519
207047
  while (true) {
206520
207048
  const markdownConfigPath = join2(dir, PATHMX_MARKDOWN_CONFIG_FILE);
206521
207049
  const jsonConfigPath = join2(dir, PATHMX_JSON_CONFIG_FILE);
@@ -206538,7 +207066,7 @@ async function findPathMXConfig(cwd) {
206538
207066
  configKind: "json"
206539
207067
  };
206540
207068
  }
206541
- const parent = dirname3(dir);
207069
+ const parent = dirname2(dir);
206542
207070
  if (parent === dir)
206543
207071
  return;
206544
207072
  dir = parent;
@@ -206615,13 +207143,13 @@ function resolveLoadedConfig(cwd, config2) {
206615
207143
  if ("configDir" in config2)
206616
207144
  return config2;
206617
207145
  return {
206618
- configDir: resolve2(cwd),
207146
+ configDir: resolve(cwd),
206619
207147
  ...config2
206620
207148
  };
206621
207149
  }
206622
207150
  async function resolveConfigSourceDir(config2) {
206623
207151
  if (config2.sourceDir)
206624
- return resolve2(config2.configDir, config2.sourceDir);
207152
+ return resolve(config2.configDir, config2.sourceDir);
206625
207153
  const conventionalSourceDir = join2(config2.configDir, "paths");
206626
207154
  if (await directoryExists(conventionalSourceDir))
206627
207155
  return conventionalSourceDir;
@@ -206672,7 +207200,7 @@ function resolveConfigPathEntry(link, configDir, sourceDir, configPath) {
206672
207200
  if (validationError)
206673
207201
  throw new Error(validationError);
206674
207202
  const hrefPath = splitHtmlUrl(link.href.trim()).pathname;
206675
- const pathFile = resolve2(configDir, hrefPath);
207203
+ const pathFile = resolve(configDir, hrefPath);
206676
207204
  const relativePathEntry = relative(sourceDir, pathFile);
206677
207205
  if (isOutsideSourceDir(relativePathEntry)) {
206678
207206
  throw new Error(`${formatConfigLinkLocation(configPath, link.line)}: Path file must be inside sourceDir: ${link.href}`);
@@ -206695,20 +207223,20 @@ async function pathExists(pathFile) {
206695
207223
  return fileExists(pathFile);
206696
207224
  }
206697
207225
  function findNearestPathsDir(filePath) {
206698
- let dir = dirname3(filePath);
207226
+ let dir = dirname2(filePath);
206699
207227
  while (true) {
206700
207228
  if (basename4(dir) === "paths")
206701
207229
  return dir;
206702
- const parent = dirname3(dir);
207230
+ const parent = dirname2(dir);
206703
207231
  if (parent === dir)
206704
207232
  return;
206705
207233
  dir = parent;
206706
207234
  }
206707
207235
  }
206708
207236
  async function resolveBuildPath(pathEntryInput, cwd) {
206709
- const pathFile = resolve2(cwd, pathEntryInput);
207237
+ const pathFile = resolve(cwd, pathEntryInput);
206710
207238
  await assertPathExists(pathFile);
206711
- const sourceDir = findNearestPathsDir(pathFile) ?? (isAbsolute(pathEntryInput) ? dirname3(pathFile) : cwd);
207239
+ const sourceDir = findNearestPathsDir(pathFile) ?? (isAbsolute(pathEntryInput) ? dirname2(pathFile) : cwd);
206712
207240
  const relativePathEntry = relative(sourceDir, pathFile);
206713
207241
  if (isOutsideSourceDir(relativePathEntry)) {
206714
207242
  throw new Error(`Path file must be inside sourceDir: ${pathEntryInput}`);
@@ -206742,9 +207270,9 @@ function isObsidianSetupPath(pathEntryInput, config2) {
206742
207270
  return isObsidianEnabled(config2) && toSourcePath(pathEntryInput) === getObsidianIndexPath(config2);
206743
207271
  }
206744
207272
  async function resolveBuildPathFromSourceDir(pathEntryInput, cwd, sourceDir, config2) {
206745
- const cwdPathFile = resolve2(cwd, pathEntryInput);
207273
+ const cwdPathFile = resolve(cwd, pathEntryInput);
206746
207274
  const cwdRelativePathEntry = relative(sourceDir, cwdPathFile);
206747
- const sourcePathFile = resolve2(sourceDir, pathEntryInput);
207275
+ const sourcePathFile = resolve(sourceDir, pathEntryInput);
206748
207276
  const pathFile = isAbsolute(pathEntryInput) ? pathEntryInput : await fileExists(cwdPathFile) && !isOutsideSourceDir(cwdRelativePathEntry) ? cwdPathFile : sourcePathFile;
206749
207277
  if (!isObsidianSetupPath(pathEntryInput, config2)) {
206750
207278
  await assertPathExists(pathFile);
@@ -206767,7 +207295,7 @@ async function resolveExplicitBuildPaths(pathEntryInputs, cwd) {
206767
207295
  }
206768
207296
  const sourceDir = paths2[0].sourceDir;
206769
207297
  for (const path2 of paths2.slice(1)) {
206770
- if (resolve2(path2.sourceDir) === resolve2(sourceDir))
207298
+ if (resolve(path2.sourceDir) === resolve(sourceDir))
206771
207299
  continue;
206772
207300
  throw new Error([
206773
207301
  "Build paths must share one sourceDir.",
@@ -206820,13 +207348,13 @@ async function resolveBuildPaths(pathEntryInputs, cwd, config2) {
206820
207348
  }
206821
207349
  function resolveOutDir(cwd, config2, outDir, defaultOutDir = DEFAULT_OUT_DIR) {
206822
207350
  if (outDir)
206823
- return resolve2(cwd, outDir);
207351
+ return resolve(cwd, outDir);
206824
207352
  if (config2?.outDir)
206825
- return resolve2(config2.configDir, config2.outDir);
206826
- return resolve2(config2?.configDir ?? cwd, defaultOutDir);
207353
+ return resolve(config2.configDir, config2.outDir);
207354
+ return resolve(config2?.configDir ?? cwd, defaultOutDir);
206827
207355
  }
206828
207356
  async function resolveSpace(options = {}) {
206829
- const cwd = resolve2(options.cwd ?? process.cwd());
207357
+ const cwd = resolve(options.cwd ?? process.cwd());
206830
207358
  const loadedConfig = options.config === undefined ? await loadPathMXConfig(cwd) : resolveLoadedConfig(cwd, options.config);
206831
207359
  const resolved = await resolveBuildPaths(options.pathEntries ?? [], cwd, loadedConfig);
206832
207360
  const outDir = resolveOutDir(cwd, loadedConfig, options.outDir, options.defaultOutDir);
@@ -206877,10 +207405,10 @@ async function openSpace(options = {}) {
206877
207405
  }
206878
207406
  resolved = await resolveBuildPaths(entries2, space.sourceDir, undefined);
206879
207407
  }
206880
- if (resolve2(resolved.sourceDir) !== resolve2(space.sourceDir)) {
207408
+ if (resolve(resolved.sourceDir) !== resolve(space.sourceDir)) {
206881
207409
  resolved = await resolveBuildPaths(entries2, space.sourceDir, undefined);
206882
207410
  }
206883
- if (resolve2(resolved.sourceDir) !== resolve2(space.sourceDir)) {
207411
+ if (resolve(resolved.sourceDir) !== resolve(space.sourceDir)) {
206884
207412
  throw new Error(`Path entries must resolve inside sourceDir "${space.sourceDir}".`);
206885
207413
  }
206886
207414
  return build({
@@ -207044,6 +207572,60 @@ var {
207044
207572
  Option,
207045
207573
  Help
207046
207574
  } = import__.default;
207575
+ // packages/pathmx/package.json
207576
+ var package_default = {
207577
+ name: "pathmx",
207578
+ version: "0.1.1",
207579
+ private: true,
207580
+ type: "module",
207581
+ types: "./src/index.ts",
207582
+ bin: {
207583
+ pathmx: "./src/bin.ts"
207584
+ },
207585
+ exports: {
207586
+ ".": {
207587
+ types: "./src/index.ts",
207588
+ default: "./src/index.ts"
207589
+ },
207590
+ "./runtime": {
207591
+ types: "./src/runtime.ts",
207592
+ default: "./src/runtime.ts"
207593
+ },
207594
+ "./runtime/react": {
207595
+ types: "./src/runtime-react.ts",
207596
+ default: "./src/runtime-react.ts"
207597
+ },
207598
+ "./runtime/bridge": {
207599
+ types: "./src/runtime-bridge.ts",
207600
+ default: "./src/runtime-bridge.ts"
207601
+ },
207602
+ "./protocol": {
207603
+ types: "./src/protocol.ts",
207604
+ default: "./src/protocol.ts"
207605
+ },
207606
+ "./plugin": {
207607
+ types: "./src/plugin.ts",
207608
+ default: "./src/plugin.ts"
207609
+ },
207610
+ "./mcp": {
207611
+ types: "./src/mcp.ts",
207612
+ default: "./src/mcp.ts"
207613
+ }
207614
+ },
207615
+ scripts: {
207616
+ test: "bun test",
207617
+ typecheck: "tsc --noEmit"
207618
+ },
207619
+ dependencies: {
207620
+ "@pathmx/build": "workspace:*",
207621
+ "@pathmx/cli": "workspace:*",
207622
+ "@pathmx/host": "workspace:*",
207623
+ "@pathmx/mcp": "workspace:*",
207624
+ "@pathmx/protocol": "workspace:*",
207625
+ "@pathmx/runtime": "workspace:*",
207626
+ "@pathmx/server": "workspace:*"
207627
+ }
207628
+ };
207047
207629
  // packages/mcp/src/index.ts
207048
207630
  import { randomUUID } from "crypto";
207049
207631
  import { mkdir as mkdir3, rm as rm4 } from "fs/promises";
@@ -213639,7 +214221,7 @@ class Protocol {
213639
214221
  return;
213640
214222
  }
213641
214223
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
213642
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
214224
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
213643
214225
  options?.signal?.throwIfAborted();
213644
214226
  }
213645
214227
  } catch (error52) {
@@ -213651,7 +214233,7 @@ class Protocol {
213651
214233
  }
213652
214234
  request(request, resultSchema, options) {
213653
214235
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
213654
- return new Promise((resolve3, reject) => {
214236
+ return new Promise((resolve2, reject) => {
213655
214237
  const earlyReject = (error52) => {
213656
214238
  reject(error52);
213657
214239
  };
@@ -213729,7 +214311,7 @@ class Protocol {
213729
214311
  if (!parseResult.success) {
213730
214312
  reject(parseResult.error);
213731
214313
  } else {
213732
- resolve3(parseResult.data);
214314
+ resolve2(parseResult.data);
213733
214315
  }
213734
214316
  } catch (error52) {
213735
214317
  reject(error52);
@@ -213920,12 +214502,12 @@ class Protocol {
213920
214502
  interval = task.pollInterval;
213921
214503
  }
213922
214504
  } catch {}
213923
- return new Promise((resolve3, reject) => {
214505
+ return new Promise((resolve2, reject) => {
213924
214506
  if (signal.aborted) {
213925
214507
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
213926
214508
  return;
213927
214509
  }
213928
- const timeoutId = setTimeout(resolve3, interval);
214510
+ const timeoutId = setTimeout(resolve2, interval);
213929
214511
  signal.addEventListener("abort", () => {
213930
214512
  clearTimeout(timeoutId);
213931
214513
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -214997,7 +215579,7 @@ class McpServer {
214997
215579
  let task = createTaskResult.task;
214998
215580
  const pollInterval = task.pollInterval ?? 5000;
214999
215581
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
215000
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
215582
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
215001
215583
  const updatedTask = await extra.taskStore.getTask(taskId2);
215002
215584
  if (!updatedTask) {
215003
215585
  throw new McpError(ErrorCode.InternalError, `Task ${taskId2} not found during polling`);
@@ -215631,12 +216213,12 @@ class StdioServerTransport {
215631
216213
  this.onclose?.();
215632
216214
  }
215633
216215
  send(message) {
215634
- return new Promise((resolve3) => {
216216
+ return new Promise((resolve2) => {
215635
216217
  const json3 = serializeMessage(message);
215636
216218
  if (this._stdout.write(json3)) {
215637
- resolve3();
216219
+ resolve2();
215638
216220
  } else {
215639
- this._stdout.once("drain", resolve3);
216221
+ this._stdout.once("drain", resolve2);
215640
216222
  }
215641
216223
  });
215642
216224
  }
@@ -215974,9 +216556,9 @@ data:
215974
216556
  const initRequest = messages2.find((m3) => isInitializeRequest(m3));
215975
216557
  const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
215976
216558
  if (this._enableJsonResponse) {
215977
- return new Promise((resolve3) => {
216559
+ return new Promise((resolve2) => {
215978
216560
  this._streamMapping.set(streamId, {
215979
- resolveJson: resolve3,
216561
+ resolveJson: resolve2,
215980
216562
  cleanup: () => {
215981
216563
  this._streamMapping.delete(streamId);
215982
216564
  }
@@ -217602,7 +218184,7 @@ function createPathMXHost(options) {
217602
218184
  }
217603
218185
 
217604
218186
  // packages/mcp/src/index.ts
217605
- var DEFAULT_MCP_OUT_DIR = ".pathmx2-mcp";
218187
+ var DEFAULT_MCP_OUT_DIR = ".pathmx-mcp";
217606
218188
  var DEFAULT_LIVE_MCP_HOST = "127.0.0.1";
217607
218189
  var DEFAULT_LIVE_MCP_PORT = 3002;
217608
218190
  var DEFAULT_LIVE_MCP_PATH = "/mcp";
@@ -217703,10 +218285,12 @@ async function spaceSnapshot(ctx) {
217703
218285
  }
217704
218286
  function contentResult(structuredContent) {
217705
218287
  return {
217706
- content: [{
217707
- type: "text",
217708
- text: JSON.stringify(structuredContent, null, 2)
217709
- }],
218288
+ content: [
218289
+ {
218290
+ type: "text",
218291
+ text: JSON.stringify(structuredContent, null, 2)
218292
+ }
218293
+ ],
217710
218294
  structuredContent
217711
218295
  };
217712
218296
  }
@@ -218010,11 +218594,13 @@ function createPathMXMcpServer(ctx) {
218010
218594
  description: "Current PathMX workspace, host, and refresh status.",
218011
218595
  mimeType: "application/json"
218012
218596
  }, async (uri) => ({
218013
- contents: [{
218014
- uri: uri.href,
218015
- mimeType: "application/json",
218016
- text: JSON.stringify(await spaceSnapshot(ctx), null, 2)
218017
- }]
218597
+ contents: [
218598
+ {
218599
+ uri: uri.href,
218600
+ mimeType: "application/json",
218601
+ text: JSON.stringify(await spaceSnapshot(ctx), null, 2)
218602
+ }
218603
+ ]
218018
218604
  }));
218019
218605
  server.registerResource("pathmx-source", new ResourceTemplate("pathmx://source/{path}", { list: undefined }), {
218020
218606
  title: "PathMX Source",
@@ -218025,11 +218611,13 @@ function createPathMXMcpServer(ctx) {
218025
218611
  const sourcePath = normalizeToolSourcePath(decodeURIComponent(String(rawPath ?? "")));
218026
218612
  const source3 = await readSource(ctx, sourcePath);
218027
218613
  return {
218028
- contents: [{
218029
- uri: uri.href,
218030
- mimeType: source3.contentType ?? "text/plain",
218031
- text: source3.content
218032
- }]
218614
+ contents: [
218615
+ {
218616
+ uri: uri.href,
218617
+ mimeType: source3.contentType ?? "text/plain",
218618
+ text: source3.content
218619
+ }
218620
+ ]
218033
218621
  };
218034
218622
  });
218035
218623
  server.registerTool("pathmx_status", {
@@ -218298,7 +218886,7 @@ async function runPathMXMcpServer(options = {}) {
218298
218886
  }
218299
218887
 
218300
218888
  // packages/cli/src/constants.ts
218301
- var CLI_VERSION = "0.0.2";
218889
+ var CLI_VERSION = package_default.version;
218302
218890
  var PATHMX_PUBLIC_CLI_PACKAGE_NAME = "@fellowhumans/pathmx";
218303
218891
  var DEFAULT_SERVE_HOST = "127.0.0.1";
218304
218892
  var DEFAULT_SERVE_PORT = 3000;
@@ -219249,7 +219837,7 @@ var IGNORED_SOURCE_PARTS = new Set([
219249
219837
  ".git",
219250
219838
  "node_modules",
219251
219839
  ".pathmx",
219252
- ".pathmx2"
219840
+ ".pathmx"
219253
219841
  ]);
219254
219842
  function isIgnoredSourceFileName(fileName) {
219255
219843
  return fileName === ".DS_Store" || fileName.endsWith(".swp") || fileName.endsWith(".swo") || fileName.endsWith(".tmp") || fileName.endsWith("~");
@@ -220494,7 +221082,7 @@ function isMissingFileError3(error52) {
220494
221082
  return Boolean(error52) && typeof error52 === "object" && error52.code === "ENOENT";
220495
221083
  }
220496
221084
  function sleep3(ms) {
220497
- return new Promise((resolve3) => setTimeout(resolve3, ms));
221085
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
220498
221086
  }
220499
221087
 
220500
221088
  // packages/server/src/bun/spaces-gateway.ts
@@ -222145,12 +222733,12 @@ function formatInitSummary(result, cwd) {
222145
222733
  }
222146
222734
 
222147
222735
  // packages/cli/src/commands/source-mutation.ts
222148
- import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve3 } from "path";
222736
+ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve2 } from "path";
222149
222737
  function uniqueValues2(values2) {
222150
222738
  return [...new Set(values2.filter((value) => value !== undefined))];
222151
222739
  }
222152
222740
  function resolveCwdRelativeSourcePath(input, cwd, sourceDir) {
222153
- const absPath = isAbsolute2(input) ? input : resolve3(cwd, input);
222741
+ const absPath = isAbsolute2(input) ? input : resolve2(cwd, input);
222154
222742
  const relPath = relative2(sourceDir, absPath);
222155
222743
  return isOutsideSourceDir(relPath) ? undefined : toSourcePath(relPath);
222156
222744
  }
@@ -247093,7 +247681,7 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
247093
247681
  } catch (err) {
247094
247682
  if (true) {
247095
247683
  console.error("[legend-state] Error loading local cache. This would be a crashing error in production.", err);
247096
- } else {}
247684
+ }
247097
247685
  }
247098
247686
  }
247099
247687
  const prevValue = getNodeValue2(node);
@@ -251036,7 +251624,9 @@ class PlayerRouterStore {
251036
251624
  this.$.ready.set(false);
251037
251625
  }
251038
251626
  navigate(route, options = {}) {
251039
- this.setPrimaryRoute(this.resolvePrimaryRoute(route), {
251627
+ this.setPrimaryRoute(this.resolvePrimaryRoute(route, {
251628
+ unknownRouteFallback: options.unknownRouteFallback ?? "preserve"
251629
+ }), {
251040
251630
  history: options.history ?? "push"
251041
251631
  });
251042
251632
  }
@@ -251044,7 +251634,9 @@ class PlayerRouterStore {
251044
251634
  this.navigate(route, { history: "replace" });
251045
251635
  }
251046
251636
  syncFromLocation(options = {}) {
251047
- const route = this.resolvePrimaryRoute(this.routeFromLocation());
251637
+ const route = this.resolvePrimaryRoute(this.routeFromLocation(), {
251638
+ unknownRouteFallback: "entry"
251639
+ });
251048
251640
  this.setPrimaryRoute(route, {
251049
251641
  history: options.canonicalize ? "replace" : false
251050
251642
  });
@@ -251100,10 +251692,17 @@ class PlayerRouterStore {
251100
251692
  }
251101
251693
  return \`\${url.pathname}\${url.hash}\`;
251102
251694
  }
251103
- resolvePrimaryRoute(route) {
251695
+ resolvePrimaryRoute(route, options = {}) {
251104
251696
  const parsed = this.parseRoute(route);
251105
- const source = this.findSource(parsed.pathname) ?? this.entrySource();
251697
+ const source = this.findSource(parsed.pathname);
251106
251698
  if (!source) {
251699
+ const entrySource = this.entrySource();
251700
+ if (entrySource && (parsed.pathname === "/" || options.unknownRouteFallback !== "preserve")) {
251701
+ return {
251702
+ route: \`\${entrySource.route}\${parsed.hash}\`,
251703
+ sourceId: entrySource.id
251704
+ };
251705
+ }
251107
251706
  return {
251108
251707
  route: \`\${parsed.pathname}\${parsed.hash}\`,
251109
251708
  sourceId: undefined
@@ -251824,6 +252423,21 @@ function RuntimeSurface({
251824
252423
  const preferences2 = import_react17.useMemo(() => ({ colorScheme }), [colorScheme]);
251825
252424
  const live = import_react17.useMemo(() => liveOptions(config), [config.liveSocketPath, config.primaryDocument]);
251826
252425
  const fetchDocument = import_react17.useCallback((route, options) => fetchPathMXDocumentHtml(route, graph.graph, options.signal), [graph]);
252426
+ const navigateDocumentRoute = import_react17.useCallback((path, history) => {
252427
+ const navigate = () => {
252428
+ router.navigate(path, { history });
252429
+ };
252430
+ if (findSourceForRoute(graph.graph, path)) {
252431
+ navigate();
252432
+ return;
252433
+ }
252434
+ graph.revalidate({ force: true }).catch((error) => {
252435
+ app.reportRuntimeError(error);
252436
+ return;
252437
+ }).then(() => {
252438
+ navigate();
252439
+ });
252440
+ }, [app, graph, router]);
251827
252441
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(PathMXRuntimeProvider, {
251828
252442
  live,
251829
252443
  fetchDocument,
@@ -251846,9 +252460,7 @@ function RuntimeSurface({
251846
252460
  if (!event.defaultNavigation)
251847
252461
  return;
251848
252462
  event.preventDefault();
251849
- router.navigate(event.path, {
251850
- history: event.defaultNavigation.history === "replace" ? "replace" : "push"
251851
- });
252463
+ navigateDocumentRoute(event.path, event.defaultNavigation.history === "replace" ? "replace" : "push");
251852
252464
  },
251853
252465
  onError: (event) => {
251854
252466
  app.reportRuntimeError(event.error);
@@ -263494,14 +264106,14 @@ function PlayComposer({
263494
264106
  }, undefined, false, undefined, this),
263495
264107
  /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(IconButton, {
263496
264108
  icon: "send",
263497
- label: "Add",
264109
+ label: "Add annotation",
263498
264110
  onClick: onSubmit,
263499
264111
  variant: "default",
263500
264112
  className: "absolute bottom-2 right-2 bg-primary-background text-accent-foreground"
263501
264113
  }, undefined, false, undefined, this),
263502
264114
  /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(IconButton, {
263503
264115
  icon: "close",
263504
- label: "Close",
264116
+ label: "Close composer",
263505
264117
  onClick: onClose,
263506
264118
  className: "absolute top-1 right-2 text-muted-foreground"
263507
264119
  }, undefined, false, undefined, this)
@@ -263540,6 +264152,14 @@ function PlayComposerButton({
263540
264152
  if (!activeBeatView && composerOpen)
263541
264153
  play.composer.close();
263542
264154
  }, [activeBeatView, composerOpen, play]);
264155
+ function handleShowComposer() {
264156
+ if (!activeBeatView)
264157
+ return;
264158
+ play.composer.open({
264159
+ beatId: activeBeatView.beatId,
264160
+ rect: activeBeatView.rect
264161
+ });
264162
+ }
263543
264163
  if (composerOpen && composerRect) {
263544
264164
  return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(PlayComposer, {
263545
264165
  draft,
@@ -263556,7 +264176,7 @@ function PlayComposerButton({
263556
264176
  label: "Compose",
263557
264177
  className,
263558
264178
  iconClassName,
263559
- onClick: () => play.composer.open()
264179
+ onClick: handleShowComposer
263560
264180
  }, undefined, false, undefined, this);
263561
264181
  }
263562
264182
 
@@ -272711,12 +273331,22 @@ var ROOT_SCROLLBAR_STYLE_PROPERTIES = [
272711
273331
  "scrollbar-width",
272712
273332
  "-ms-overflow-style"
272713
273333
  ];
273334
+ function isElement5(value) {
273335
+ return typeof value === "object" && value !== null && value.nodeType === 1;
273336
+ }
273337
+ function getEventElementTarget2(target) {
273338
+ if (isElement5(target))
273339
+ return target;
273340
+ const parentElement = target?.parentElement;
273341
+ return isElement5(parentElement) ? parentElement : undefined;
273342
+ }
272714
273343
  function rootScrollbarTargets(root2) {
272715
273344
  return [root2.documentElement, root2.body].filter((element) => Boolean(element));
272716
273345
  }
272717
273346
  function createBrowserPlayRootEffects(root2 = document, view2 = window) {
272718
273347
  let snapRestoreFrame;
272719
273348
  let restoreScrollbarStyles;
273349
+ let removeExternalLinkHandler;
272720
273350
  const cancelSnapRestore = () => {
272721
273351
  if (snapRestoreFrame === undefined)
272722
273352
  return;
@@ -272750,14 +273380,69 @@ function createBrowserPlayRootEffects(root2 = document, view2 = window) {
272750
273380
  restoreScrollbarStyles?.();
272751
273381
  restoreScrollbarStyles = undefined;
272752
273382
  };
273383
+ const externalHttpUrlForClick = (event) => {
273384
+ if (event.defaultPrevented || event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
273385
+ return;
273386
+ }
273387
+ const eventTarget = getEventElementTarget2(event.target);
273388
+ const anchor = eventTarget?.closest("a[href]");
273389
+ if (!anchor || anchor.hasAttribute("download"))
273390
+ return;
273391
+ if (anchor.hasAttribute("target"))
273392
+ return;
273393
+ const href = anchor.getAttribute("href")?.trim();
273394
+ if (!href || href.startsWith("#"))
273395
+ return;
273396
+ let url;
273397
+ try {
273398
+ url = new URL(href, view2.location.href);
273399
+ } catch {
273400
+ return;
273401
+ }
273402
+ if (url.origin === view2.location.origin)
273403
+ return;
273404
+ if (url.protocol !== "http:" && url.protocol !== "https:")
273405
+ return;
273406
+ return url;
273407
+ };
273408
+ const openExternalLinksInNewContext = () => {
273409
+ if (removeExternalLinkHandler)
273410
+ return;
273411
+ const handleClick = (event) => {
273412
+ const url = externalHttpUrlForClick(event);
273413
+ if (!url)
273414
+ return;
273415
+ let opened;
273416
+ try {
273417
+ opened = view2.open(url.href, "_blank", "noopener,noreferrer");
273418
+ } catch {
273419
+ return;
273420
+ }
273421
+ event.preventDefault();
273422
+ try {
273423
+ if (opened)
273424
+ opened.opener = null;
273425
+ } catch {}
273426
+ };
273427
+ root2.addEventListener("click", handleClick);
273428
+ removeExternalLinkHandler = () => {
273429
+ root2.removeEventListener("click", handleClick);
273430
+ removeExternalLinkHandler = undefined;
273431
+ };
273432
+ };
273433
+ const restoreExternalLinkBehavior = () => {
273434
+ removeExternalLinkHandler?.();
273435
+ };
272753
273436
  return {
272754
273437
  setPlaying(on) {
272755
273438
  if (on) {
272756
273439
  root2.documentElement.setAttribute("data-pathmx-play", "playing");
272757
273440
  hideRootScrollbars();
273441
+ openExternalLinksInNewContext();
272758
273442
  } else {
272759
273443
  root2.documentElement.removeAttribute("data-pathmx-play");
272760
273444
  restoreRootScrollbars();
273445
+ restoreExternalLinkBehavior();
272761
273446
  }
272762
273447
  },
272763
273448
  setViewportHeight(px2) {
@@ -273458,15 +274143,14 @@ function PlayerAugmentations() {
273458
274143
  className: "pmx-player-control-surface pointer-events-none fixed inset-0 z-50",
273459
274144
  children: [
273460
274145
  /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(PlayAugmentations, {}, undefined, false, undefined, this),
273461
- !playActive && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(jsx_dev_runtime17.Fragment, {
274146
+ !playActive && !exploreActive && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(jsx_dev_runtime17.Fragment, {
273462
274147
  children: [
273463
274148
  /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(PlayerBreadcrumbBar, {}, undefined, false, undefined, this),
273464
274149
  /* @__PURE__ */ jsx_dev_runtime17.jsxDEV("div", {
273465
274150
  className: "absolute bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-3",
273466
274151
  children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ActionButton, {
273467
- "aria-pressed": exploreActive,
273468
274152
  icon: "map",
273469
- label: exploreActive ? "Close explore" : "Explore",
274153
+ label: "Explore",
273470
274154
  onClick: () => view2.toggleExplore()
273471
274155
  }, undefined, false, undefined, this)
273472
274156
  }, undefined, false, undefined, this),
@@ -278383,12 +279067,12 @@ var Idiomorph = function() {
278383
279067
  let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;
278384
279068
  if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {
278385
279069
  if ("href" in newElt && newElt.href || "src" in newElt && newElt.src) {
278386
- let resolve4;
279070
+ let resolve3;
278387
279071
  let promise3 = new Promise(function(_resolve) {
278388
- resolve4 = _resolve;
279072
+ resolve3 = _resolve;
278389
279073
  });
278390
279074
  newElt.addEventListener("load", function() {
278391
- resolve4();
279075
+ resolve3();
278392
279076
  });
278393
279077
  promises.push(promise3);
278394
279078
  }
@@ -279433,11 +280117,11 @@ var buffer = "";
279433
280117
  var resolveStopped;
279434
280118
  var commandQueue = Promise.resolve();
279435
280119
  async function runDesktopSidecar() {
279436
- return new Promise((resolve4) => {
280120
+ return new Promise((resolve3) => {
279437
280121
  resolveStopped = () => {
279438
280122
  process.stdin.off("data", onStdinData);
279439
280123
  process.stdin.pause();
279440
- resolve4();
280124
+ resolve3();
279441
280125
  };
279442
280126
  process.stdin.setEncoding("utf8");
279443
280127
  process.stdin.on("data", onStdinData);
@@ -279725,9 +280409,9 @@ function createExternalLiveBridge(serverUrl) {
279725
280409
  async function stop(replyTo) {
279726
280410
  await stopCurrent();
279727
280411
  send({ type: "stopped", replyTo });
279728
- const resolve4 = resolveStopped;
280412
+ const resolve3 = resolveStopped;
279729
280413
  resolveStopped = undefined;
279730
- resolve4?.();
280414
+ resolve3?.();
279731
280415
  }
279732
280416
  async function stopCurrent() {
279733
280417
  const current = state;