@nowline/embed 0.4.1 → 0.5.0

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 (42) hide show
  1. package/README.md +14 -26
  2. package/dist/auto-scan.d.ts +11 -0
  3. package/dist/auto-scan.d.ts.map +1 -1
  4. package/dist/auto-scan.js +28 -0
  5. package/dist/auto-scan.js.map +1 -1
  6. package/dist/index.d.ts +18 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +8 -20
  9. package/dist/index.js.map +1 -1
  10. package/dist/meta.json +116 -59
  11. package/dist/nowline.esm.js +1020 -133
  12. package/dist/nowline.esm.js.map +4 -4
  13. package/dist/nowline.min.js +82 -82
  14. package/dist/nowline.min.js.map +4 -4
  15. package/dist/share.d.ts +45 -0
  16. package/dist/share.d.ts.map +1 -0
  17. package/dist/share.js +75 -0
  18. package/dist/share.js.map +1 -0
  19. package/dist/theme.d.ts +3 -3
  20. package/dist/theme.d.ts.map +1 -1
  21. package/dist/theme.js +5 -3
  22. package/dist/theme.js.map +1 -1
  23. package/package.json +6 -7
  24. package/src/auto-scan.ts +42 -0
  25. package/src/index.ts +43 -31
  26. package/src/share.ts +108 -0
  27. package/src/theme.ts +7 -5
  28. package/dist/auth/allowlist.d.ts +0 -20
  29. package/dist/auth/allowlist.d.ts.map +0 -1
  30. package/dist/auth/allowlist.js +0 -33
  31. package/dist/auth/allowlist.js.map +0 -1
  32. package/dist/auth/env.d.ts +0 -23
  33. package/dist/auth/env.d.ts.map +0 -1
  34. package/dist/auth/env.js +0 -24
  35. package/dist/auth/env.js.map +0 -1
  36. package/dist/auth/firebase-auth.client.d.ts +0 -21
  37. package/dist/auth/firebase-auth.client.d.ts.map +0 -1
  38. package/dist/auth/firebase-auth.client.js +0 -142
  39. package/dist/auth/firebase-auth.client.js.map +0 -1
  40. package/src/auth/allowlist.ts +0 -32
  41. package/src/auth/env.ts +0 -37
  42. package/src/auth/firebase-auth.client.ts +0 -174
@@ -1,4 +1,4 @@
1
- /*! @nowline/embed 0.4.1 sha=b28a065 built=2026-05-27T23:49:38.587Z env=prod */
1
+ /*! @nowline/embed 0.5.0 sha=04bdff9 built=2026-06-01T06:46:51Z */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -336,9 +336,9 @@ var init_main = __esm({
336
336
  }
337
337
  Diagnostic2.create = create;
338
338
  function is(value) {
339
- var _a;
339
+ var _a2;
340
340
  let candidate = value;
341
- return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
341
+ return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a2 = candidate.codeDescription) === null || _a2 === void 0 ? void 0 : _a2.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
342
342
  }
343
343
  Diagnostic2.is = is;
344
344
  })(Diagnostic || (Diagnostic = {}));
@@ -2056,7 +2056,7 @@ var require_messages = __commonJS({
2056
2056
  var require_linkedMap = __commonJS({
2057
2057
  "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) {
2058
2058
  "use strict";
2059
- var _a;
2059
+ var _a2;
2060
2060
  Object.defineProperty(exports2, "__esModule", { value: true });
2061
2061
  exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
2062
2062
  var Touch;
@@ -2069,7 +2069,7 @@ var require_linkedMap = __commonJS({
2069
2069
  })(Touch || (exports2.Touch = Touch = {}));
2070
2070
  var LinkedMap = class {
2071
2071
  constructor() {
2072
- this[_a] = "LinkedMap";
2072
+ this[_a2] = "LinkedMap";
2073
2073
  this._map = /* @__PURE__ */ new Map();
2074
2074
  this._head = void 0;
2075
2075
  this._tail = void 0;
@@ -2243,7 +2243,7 @@ var require_linkedMap = __commonJS({
2243
2243
  };
2244
2244
  return iterator;
2245
2245
  }
2246
- [(_a = Symbol.toStringTag, Symbol.iterator)]() {
2246
+ [(_a2 = Symbol.toStringTag, Symbol.iterator)]() {
2247
2247
  return this.entries();
2248
2248
  }
2249
2249
  trimOld(newSize) {
@@ -6372,69 +6372,35 @@ var init_node_read_file = __esm({
6372
6372
  }
6373
6373
  });
6374
6374
 
6375
- // src/auth/env.ts
6376
- var EMBED_VERSION = true ? "0.4.1" : "0.0.0";
6377
- var EMBED_SHA = true ? "b28a065" : "unknown";
6378
-
6379
- // ../browser/dist/diagnostic-row.js
6380
- var DID_YOU_MEAN_RE = /did you mean ['"]?([^'"?]+)['"]?\??/i;
6381
- function fromLangiumDiagnostic(diag, file) {
6382
- return {
6383
- severity: diag.severity === 2 ? "warning" : "error",
6384
- code: diagnosticCode(diag),
6385
- message: diag.message,
6386
- suggestion: extractSuggestion(diag.message),
6387
- file,
6388
- line: (diag.range?.start.line ?? 0) + 1,
6389
- column: (diag.range?.start.character ?? 0) + 1
6390
- };
6391
- }
6392
- function fromParserError(err, file) {
6393
- return {
6394
- severity: "error",
6395
- code: "parse-error",
6396
- message: err.message,
6397
- file,
6398
- line: err.token?.startLine ?? 1,
6399
- column: err.token?.startColumn ?? 1
6400
- };
6401
- }
6402
- function fromLexerError(err, file) {
6403
- return {
6404
- severity: "error",
6405
- code: "lex-error",
6406
- message: err.message,
6407
- file,
6408
- line: err.line ?? 1,
6409
- column: err.column ?? 1
6410
- };
6411
- }
6412
- function fromResolveDiagnostic(diag) {
6413
- return {
6414
- severity: diag.severity,
6415
- code: "include",
6416
- message: diag.message,
6417
- file: diag.sourcePath,
6418
- line: diag.line !== void 0 ? diag.line + 1 : 1,
6419
- column: 1
6420
- };
6375
+ // ../core/dist/diagnostics/index.js
6376
+ var LANGIUM_LEXING_ERROR = "lexing-error";
6377
+ var LANGIUM_PARSING_ERROR = "parsing-error";
6378
+ function isBuiltinParseDiagnostic(data) {
6379
+ if (!data || typeof data !== "object")
6380
+ return false;
6381
+ const code = data.code;
6382
+ return code === LANGIUM_LEXING_ERROR || code === LANGIUM_PARSING_ERROR;
6421
6383
  }
6422
- function fromRenderWarning(message, file, severity = "warning") {
6423
- return {
6424
- severity,
6425
- code: "render.warning",
6426
- message,
6427
- file,
6428
- line: 1,
6429
- column: 1
6430
- };
6384
+ function collectDocumentDiagnostics(doc) {
6385
+ const out = [];
6386
+ for (const error of doc.parseResult.lexerErrors) {
6387
+ out.push({ origin: "lexer", error });
6388
+ }
6389
+ for (const error of doc.parseResult.parserErrors) {
6390
+ out.push({ origin: "parser", error });
6391
+ }
6392
+ for (const diagnostic of doc.diagnostics ?? []) {
6393
+ const row = diagnostic;
6394
+ if (isBuiltinParseDiagnostic(row.data))
6395
+ continue;
6396
+ out.push({ origin: "validation", diagnostic: row });
6397
+ }
6398
+ return out;
6431
6399
  }
6432
- function diagnosticCode(diag) {
6433
- if (typeof diag.code === "string" && diag.code !== "")
6434
- return diag.code;
6435
- if (typeof diag.code === "number")
6436
- return String(diag.code);
6437
- return inferCodeFromMessage(diag.message);
6400
+ var DID_YOU_MEAN_RE = /did you mean ['"]?([^'"?]+)['"]?\??/i;
6401
+ function extractSuggestion(message) {
6402
+ const match = message.match(DID_YOU_MEAN_RE);
6403
+ return match ? match[1].trim() : void 0;
6438
6404
  }
6439
6405
  function inferCodeFromMessage(message) {
6440
6406
  const lower = message.toLowerCase();
@@ -6454,18 +6420,25 @@ function inferCodeFromMessage(message) {
6454
6420
  return "indentation";
6455
6421
  return "validation";
6456
6422
  }
6457
- function extractSuggestion(message) {
6458
- const match = message.match(DID_YOU_MEAN_RE);
6459
- return match ? match[1].trim() : void 0;
6460
- }
6461
-
6462
- // ../browser/dist/no-op-include-resolver.js
6463
- var NOWLINE_BROWSER_NOOP_INCLUDE_TAG = "__nowline_browser_noop_include__";
6464
- async function noOpIncludeReadFile(absPath) {
6465
- throw new Error(`${NOWLINE_BROWSER_NOOP_INCLUDE_TAG}: include "${absPath}" was skipped \u2014 running in single-file mode.`);
6423
+ function stableValidatorCode(data) {
6424
+ if (!data || typeof data !== "object")
6425
+ return void 0;
6426
+ const obj = data;
6427
+ if (typeof obj.code !== "string")
6428
+ return void 0;
6429
+ if (!Array.isArray(obj.args))
6430
+ return void 0;
6431
+ return obj.code;
6466
6432
  }
6467
- function isNoOpIncludeDiagnosticMessage(message) {
6468
- return message.includes(NOWLINE_BROWSER_NOOP_INCLUDE_TAG);
6433
+ function resolveDiagnosticCode(diag) {
6434
+ const stable = stableValidatorCode(diag.data);
6435
+ if (stable)
6436
+ return stable;
6437
+ if (typeof diag.code === "string" && diag.code !== "")
6438
+ return diag.code;
6439
+ if (typeof diag.code === "number")
6440
+ return String(diag.code);
6441
+ return inferCodeFromMessage(diag.message);
6469
6442
  }
6470
6443
 
6471
6444
  // ../../node_modules/.pnpm/langium@4.2.4/node_modules/langium/lib/index.js
@@ -14153,8 +14126,8 @@ function resolveGrammar2(options) {
14153
14126
  return resolveGrammar(topRulesTable, actualOptions.errMsgProvider);
14154
14127
  }
14155
14128
  function validateGrammar2(options) {
14156
- var _a;
14157
- const errMsgProvider = (_a = options.errMsgProvider) !== null && _a !== void 0 ? _a : defaultGrammarValidatorErrorProvider;
14129
+ var _a2;
14130
+ const errMsgProvider = (_a2 = options.errMsgProvider) !== null && _a2 !== void 0 ? _a2 : defaultGrammarValidatorErrorProvider;
14158
14131
  return validateGrammar(options.rules, options.tokenTypes, errMsgProvider, options.grammarName);
14159
14132
  }
14160
14133
 
@@ -14494,8 +14467,8 @@ var BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;
14494
14467
  // ../../node_modules/.pnpm/chevrotain@12.0.0/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js
14495
14468
  var LLkLookaheadStrategy = class {
14496
14469
  constructor(options) {
14497
- var _a;
14498
- this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
14470
+ var _a2;
14471
+ this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : DEFAULT_PARSER_CONFIG.maxLookahead;
14499
14472
  }
14500
14473
  validate(options) {
14501
14474
  const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
@@ -15304,8 +15277,8 @@ var RecognizerApi = class {
15304
15277
  return ruleImplementation;
15305
15278
  }
15306
15279
  BACKTRACK(grammarRule, args) {
15307
- var _a;
15308
- const ruleToCall = (_a = grammarRule.coreRule) !== null && _a !== void 0 ? _a : grammarRule;
15280
+ var _a2;
15281
+ const ruleToCall = (_a2 = grammarRule.coreRule) !== null && _a2 !== void 0 ? _a2 : grammarRule;
15309
15282
  return function() {
15310
15283
  this.isBackTrackingStack.push(1);
15311
15284
  const orgState = this.saveRecogState();
@@ -15384,8 +15357,8 @@ var RecognizerEngine = class {
15384
15357
  const noTokenCategoriesUsed = allTokenTypes.every(
15385
15358
  // intentional "==" to also cover "undefined"
15386
15359
  (tokenConstructor) => {
15387
- var _a;
15388
- return ((_a = tokenConstructor.categoryMatches) === null || _a === void 0 ? void 0 : _a.length) == 0;
15360
+ var _a2;
15361
+ return ((_a2 = tokenConstructor.categoryMatches) === null || _a2 === void 0 ? void 0 : _a2.length) == 0;
15389
15362
  }
15390
15363
  );
15391
15364
  this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher;
@@ -16299,8 +16272,8 @@ var Parser = class _Parser {
16299
16272
  });
16300
16273
  }
16301
16274
  this.TRACE_INIT("ComputeLookaheadFunctions", () => {
16302
- var _a, _b;
16303
- (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
16275
+ var _a2, _b2;
16276
+ (_b2 = (_a2 = this.lookaheadStrategy).initialize) === null || _b2 === void 0 ? void 0 : _b2.call(_a2, {
16304
16277
  rules: Object.values(this.gastProductionsCache)
16305
16278
  });
16306
16279
  this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache));
@@ -18472,10 +18445,10 @@ var PredicateSet = class {
18472
18445
  var EMPTY_PREDICATES = new PredicateSet();
18473
18446
  var LLStarLookaheadStrategy = class extends LLkLookaheadStrategy {
18474
18447
  constructor(options) {
18475
- var _a, _b;
18448
+ var _a2, _b2;
18476
18449
  super();
18477
- this.logging = (_a = options === null || options === void 0 ? void 0 : options.logging) !== null && _a !== void 0 ? _a : ((message) => console.log(message));
18478
- this.incomplete = (_b = options === null || options === void 0 ? void 0 : options.incomplete) !== null && _b !== void 0 ? _b : false;
18450
+ this.logging = (_a2 = options === null || options === void 0 ? void 0 : options.logging) !== null && _a2 !== void 0 ? _a2 : ((message) => console.log(message));
18451
+ this.incomplete = (_b2 = options === null || options === void 0 ? void 0 : options.incomplete) !== null && _b2 !== void 0 ? _b2 : false;
18479
18452
  }
18480
18453
  initialize(options) {
18481
18454
  this.atn = createATN(options.rules);
@@ -18515,11 +18488,11 @@ var LLStarLookaheadStrategy = class extends LLkLookaheadStrategy {
18515
18488
  }, {});
18516
18489
  if (hasPredicates) {
18517
18490
  return function(orAlts) {
18518
- var _a;
18491
+ var _a2;
18519
18492
  const nextToken = this.LA_FAST(1);
18520
18493
  const prediction = choiceToAlt[nextToken.tokenTypeIdx];
18521
18494
  if (orAlts !== void 0 && prediction !== void 0) {
18522
- const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE;
18495
+ const gate = (_a2 = orAlts[prediction]) === null || _a2 === void 0 ? void 0 : _a2.GATE;
18523
18496
  if (gate !== void 0 && gate.call(this) === false) {
18524
18497
  return void 0;
18525
18498
  }
@@ -30903,6 +30876,71 @@ function createNowlineServices(context = {}) {
30903
30876
  return { shared, Nowline };
30904
30877
  }
30905
30878
 
30879
+ // ../browser/dist/diagnostic-row.js
30880
+ function fromLangiumDiagnostic(diag, file) {
30881
+ return {
30882
+ severity: diag.severity === 2 ? "warning" : "error",
30883
+ // resolveDiagnosticCode prefers the stable validator code (NL.Exxxx)
30884
+ // carried in `data` so the preview table matches the CLI / Problems
30885
+ // panel, then falls back to Langium's `code`, then a message heuristic.
30886
+ code: resolveDiagnosticCode(diag),
30887
+ message: diag.message,
30888
+ suggestion: extractSuggestion(diag.message),
30889
+ file,
30890
+ line: (diag.range?.start.line ?? 0) + 1,
30891
+ column: (diag.range?.start.character ?? 0) + 1
30892
+ };
30893
+ }
30894
+ function fromParserError(err, file) {
30895
+ return {
30896
+ severity: "error",
30897
+ code: "parse-error",
30898
+ message: err.message,
30899
+ file,
30900
+ line: err.token?.startLine ?? 1,
30901
+ column: err.token?.startColumn ?? 1
30902
+ };
30903
+ }
30904
+ function fromLexerError(err, file) {
30905
+ return {
30906
+ severity: "error",
30907
+ code: "lex-error",
30908
+ message: err.message,
30909
+ file,
30910
+ line: err.line ?? 1,
30911
+ column: err.column ?? 1
30912
+ };
30913
+ }
30914
+ function fromResolveDiagnostic(diag) {
30915
+ return {
30916
+ severity: diag.severity,
30917
+ code: "include",
30918
+ message: diag.message,
30919
+ file: diag.sourcePath,
30920
+ line: diag.line !== void 0 ? diag.line + 1 : 1,
30921
+ column: 1
30922
+ };
30923
+ }
30924
+ function fromRenderWarning(message, file, severity = "warning") {
30925
+ return {
30926
+ severity,
30927
+ code: "render.warning",
30928
+ message,
30929
+ file,
30930
+ line: 1,
30931
+ column: 1
30932
+ };
30933
+ }
30934
+
30935
+ // ../browser/dist/no-op-include-resolver.js
30936
+ var NOWLINE_BROWSER_NOOP_INCLUDE_TAG = "__nowline_browser_noop_include__";
30937
+ async function noOpIncludeReadFile(absPath) {
30938
+ throw new Error(`${NOWLINE_BROWSER_NOOP_INCLUDE_TAG}: include "${absPath}" was skipped \u2014 running in single-file mode.`);
30939
+ }
30940
+ function isNoOpIncludeDiagnosticMessage(message) {
30941
+ return message.includes(NOWLINE_BROWSER_NOOP_INCLUDE_TAG);
30942
+ }
30943
+
30906
30944
  // ../layout/dist/capacity.js
30907
30945
  var BUILTIN_CAPACITY_ICONS2 = /* @__PURE__ */ new Set([
30908
30946
  "none",
@@ -32096,6 +32134,241 @@ var darkTheme = {
32096
32134
  }
32097
32135
  };
32098
32136
 
32137
+ // ../layout/dist/themes/grayscale.js
32138
+ var grayscaleNamed = {
32139
+ red: "#4a4a4a",
32140
+ blue: "#6b6b6b",
32141
+ green: "#8a8a8a",
32142
+ yellow: "#c8c8c8",
32143
+ orange: "#5c5c5c",
32144
+ purple: "#3a3a3a",
32145
+ gray: "#9e9e9e",
32146
+ navy: "#2a2a2a",
32147
+ white: "#ffffff"
32148
+ };
32149
+ var baseEntity2 = {
32150
+ bg: "none",
32151
+ fg: "#1a1a1a",
32152
+ text: "#1a1a1a",
32153
+ border: "solid",
32154
+ icon: "none",
32155
+ shadow: "none",
32156
+ font: "sans",
32157
+ weight: "normal",
32158
+ italic: false,
32159
+ textSize: "md",
32160
+ padding: "sm",
32161
+ spacing: "sm",
32162
+ headerHeight: "sm",
32163
+ cornerRadius: "sm",
32164
+ bracket: "none",
32165
+ capacityIcon: "multiplier"
32166
+ };
32167
+ var grayscaleTheme = {
32168
+ name: "grayscale",
32169
+ surface: {
32170
+ page: "#f5f5f5",
32171
+ chart: "#ffffff",
32172
+ headerBox: "#ffffff"
32173
+ },
32174
+ entities: {
32175
+ roadmap: {
32176
+ ...baseEntity2,
32177
+ headerHeight: "md",
32178
+ padding: "md"
32179
+ },
32180
+ swimlane: {
32181
+ ...baseEntity2,
32182
+ fg: "#3a3a3a",
32183
+ text: "#3a3a3a",
32184
+ padding: "sm",
32185
+ spacing: "none",
32186
+ textSize: "sm"
32187
+ },
32188
+ item: {
32189
+ ...baseEntity2,
32190
+ bg: "#ffffff",
32191
+ fg: "#9e9e9e",
32192
+ text: "#1a1a1a",
32193
+ shadow: "subtle",
32194
+ cornerRadius: "sm"
32195
+ },
32196
+ parallel: {
32197
+ ...baseEntity2,
32198
+ bracket: "none",
32199
+ padding: "xs"
32200
+ },
32201
+ group: {
32202
+ ...baseEntity2,
32203
+ bracket: "solid",
32204
+ padding: "xs",
32205
+ fg: "#595959"
32206
+ },
32207
+ anchor: {
32208
+ ...baseEntity2,
32209
+ bg: "#1a1a1a",
32210
+ fg: "#1a1a1a",
32211
+ text: "#1a1a1a",
32212
+ cornerRadius: "sm"
32213
+ },
32214
+ milestone: {
32215
+ ...baseEntity2,
32216
+ bg: "#2a2a2a",
32217
+ fg: "#2a2a2a",
32218
+ text: "#ffffff",
32219
+ border: "solid"
32220
+ },
32221
+ footnote: {
32222
+ ...baseEntity2,
32223
+ bg: "none",
32224
+ fg: "#595959",
32225
+ text: "#595959",
32226
+ textSize: "sm"
32227
+ },
32228
+ label: {
32229
+ ...baseEntity2,
32230
+ bg: "#e8e8e8",
32231
+ fg: "#595959",
32232
+ text: "#595959",
32233
+ textSize: "xs",
32234
+ padding: "xs",
32235
+ cornerRadius: "full"
32236
+ }
32237
+ },
32238
+ swimlane: {
32239
+ bandEven: "#ffffff",
32240
+ bandOdd: "#f5f5f5",
32241
+ separator: "#d4d4d4",
32242
+ frameTabText: "#3a3a3a",
32243
+ frameTabMuted: "#737373",
32244
+ border: "#d4d4d4",
32245
+ tabFill: "#e8e8e8",
32246
+ tabStroke: "#bdbdbd",
32247
+ tabText: "#3a3a3a",
32248
+ ownerText: "#737373",
32249
+ footnoteIndicator: "#4a4a4a",
32250
+ rowTintEven: "#ffffff",
32251
+ rowTintOdd: "#f5f5f5",
32252
+ utilizationOk: "#8a8a8a",
32253
+ utilizationWarn: "#595959",
32254
+ utilizationOver: "#1a1a1a"
32255
+ },
32256
+ timeline: {
32257
+ gridLine: "#bdbdbd",
32258
+ minorGridLine: "#d4d4d4",
32259
+ tickMark: "#bdbdbd",
32260
+ labelText: "#737373",
32261
+ panelFill: "#ffffff",
32262
+ border: "#d4d4d4"
32263
+ },
32264
+ header: {
32265
+ cardBorder: "#d4d4d4",
32266
+ author: "#737373"
32267
+ },
32268
+ item: {
32269
+ overflowX: "#1a1a1a",
32270
+ linkIconFg: "#1a1a1a",
32271
+ overflowTailFill: "#e8e8e8",
32272
+ overflowTailStroke: "#4a4a4a",
32273
+ overflowCaption: "#3a3a3a"
32274
+ },
32275
+ parallel: {
32276
+ bracketStroke: "#3a3a3a"
32277
+ },
32278
+ anchorDiamond: {
32279
+ fill: "#ffffff",
32280
+ stroke: "#3a3a3a",
32281
+ label: "#3a3a3a",
32282
+ cutLine: "#737373"
32283
+ },
32284
+ milestoneDiamond: {
32285
+ fill: "#1a1a1a",
32286
+ label: "#1a1a1a",
32287
+ cutLineNormal: "#2a2a2a",
32288
+ cutLineOverrun: "#4a4a4a",
32289
+ slack: "#1a1a1a"
32290
+ },
32291
+ footnotePanel: {
32292
+ fill: "#ffffff",
32293
+ border: "#d4d4d4",
32294
+ header: "#1a1a1a",
32295
+ title: "#1a1a1a",
32296
+ description: "#737373",
32297
+ number: "#4a4a4a"
32298
+ },
32299
+ nowline: {
32300
+ stroke: "#1a1a1a",
32301
+ labelText: "#ffffff",
32302
+ labelBg: "#1a1a1a"
32303
+ },
32304
+ milestone: {
32305
+ dashedInk: "#9e9e9e",
32306
+ overrun: "#4a4a4a"
32307
+ },
32308
+ anchor: {
32309
+ predecessorLine: "#9e9e9e"
32310
+ },
32311
+ dependency: {
32312
+ edgeStroke: "#595959",
32313
+ overflowStroke: "#1a1a1a"
32314
+ },
32315
+ footnote: {
32316
+ indicatorText: "#4a4a4a",
32317
+ descriptionMuted: "#737373"
32318
+ },
32319
+ includeRegion: {
32320
+ border: "#9e9e9e",
32321
+ label: "#3a3a3a",
32322
+ badge: "#737373",
32323
+ fill: "#f5f5f5",
32324
+ tabFill: "#ffffff",
32325
+ tabStroke: "#bdbdbd",
32326
+ tabText: "#1a1a1a",
32327
+ badgeFill: "#e8e8e8",
32328
+ badgeStroke: "#bdbdbd",
32329
+ badgeText: "#595959"
32330
+ },
32331
+ arrowhead: {
32332
+ neutral: "#595959",
32333
+ light: "#9e9e9e",
32334
+ dark: "#1a1a1a"
32335
+ },
32336
+ status: {
32337
+ done: "#8a8a8a",
32338
+ inProgress: "#595959",
32339
+ atRisk: "#737373",
32340
+ blocked: "#3a3a3a",
32341
+ planned: "#bdbdbd",
32342
+ neutral: "#bdbdbd"
32343
+ },
32344
+ statusDot: {
32345
+ onLight: {
32346
+ done: "#3a3a3a",
32347
+ inProgress: "#2a2a2a",
32348
+ atRisk: "#4a4a4a",
32349
+ blocked: "#1a1a1a",
32350
+ planned: "#595959",
32351
+ neutral: "#595959"
32352
+ },
32353
+ onDark: {
32354
+ done: "#d4d4d4",
32355
+ inProgress: "#e8e8e8",
32356
+ atRisk: "#c8c8c8",
32357
+ blocked: "#f0f0f0",
32358
+ planned: "#d4d4d4",
32359
+ neutral: "#d4d4d4"
32360
+ }
32361
+ },
32362
+ attribution: {
32363
+ mark: "#9e9e9e",
32364
+ link: "#1a1a1a"
32365
+ },
32366
+ diagnostic: {
32367
+ overlayBg: "#e8e8e8",
32368
+ errorText: "#1a1a1a"
32369
+ }
32370
+ };
32371
+
32099
32372
  // ../layout/dist/themes/light.js
32100
32373
  var lightNamed = {
32101
32374
  red: "#e53935",
@@ -32108,7 +32381,7 @@ var lightNamed = {
32108
32381
  navy: "#0d47a1",
32109
32382
  white: "#ffffff"
32110
32383
  };
32111
- var baseEntity2 = {
32384
+ var baseEntity3 = {
32112
32385
  bg: "none",
32113
32386
  fg: "#0f172a",
32114
32387
  text: "#0f172a",
@@ -32135,12 +32408,12 @@ var lightTheme = {
32135
32408
  },
32136
32409
  entities: {
32137
32410
  roadmap: {
32138
- ...baseEntity2,
32411
+ ...baseEntity3,
32139
32412
  headerHeight: "md",
32140
32413
  padding: "md"
32141
32414
  },
32142
32415
  swimlane: {
32143
- ...baseEntity2,
32416
+ ...baseEntity3,
32144
32417
  fg: "#334155",
32145
32418
  text: "#334155",
32146
32419
  padding: "sm",
@@ -32148,7 +32421,7 @@ var lightTheme = {
32148
32421
  textSize: "sm"
32149
32422
  },
32150
32423
  item: {
32151
- ...baseEntity2,
32424
+ ...baseEntity3,
32152
32425
  // Status-aware tint applied during layout when bg stays white;
32153
32426
  // see m2d handoff Resolution 3.
32154
32427
  bg: "#ffffff",
@@ -32158,39 +32431,39 @@ var lightTheme = {
32158
32431
  cornerRadius: "sm"
32159
32432
  },
32160
32433
  parallel: {
32161
- ...baseEntity2,
32434
+ ...baseEntity3,
32162
32435
  bracket: "none",
32163
32436
  padding: "xs"
32164
32437
  },
32165
32438
  group: {
32166
- ...baseEntity2,
32439
+ ...baseEntity3,
32167
32440
  bracket: "solid",
32168
32441
  padding: "xs",
32169
32442
  fg: "#475569"
32170
32443
  },
32171
32444
  anchor: {
32172
- ...baseEntity2,
32445
+ ...baseEntity3,
32173
32446
  bg: "#0f172a",
32174
32447
  fg: "#0f172a",
32175
32448
  text: "#0f172a",
32176
32449
  cornerRadius: "sm"
32177
32450
  },
32178
32451
  milestone: {
32179
- ...baseEntity2,
32452
+ ...baseEntity3,
32180
32453
  bg: "#312e81",
32181
32454
  fg: "#312e81",
32182
32455
  text: "#ffffff",
32183
32456
  border: "solid"
32184
32457
  },
32185
32458
  footnote: {
32186
- ...baseEntity2,
32459
+ ...baseEntity3,
32187
32460
  bg: "none",
32188
32461
  fg: "#475569",
32189
32462
  text: "#475569",
32190
32463
  textSize: "sm"
32191
32464
  },
32192
32465
  label: {
32193
- ...baseEntity2,
32466
+ ...baseEntity3,
32194
32467
  bg: "#f1f5f9",
32195
32468
  fg: "#475569",
32196
32469
  text: "#475569",
@@ -32346,8 +32619,20 @@ var lightTheme = {
32346
32619
  // ../layout/dist/themes/index.js
32347
32620
  var themes = {
32348
32621
  light: lightTheme,
32349
- dark: darkTheme
32622
+ dark: darkTheme,
32623
+ grayscale: grayscaleTheme
32624
+ };
32625
+ var THEME_ALIASES = {
32626
+ greyscale: "grayscale"
32350
32627
  };
32628
+ function normalizeThemeName(raw) {
32629
+ const lower = raw.toLowerCase();
32630
+ const canonical = THEME_ALIASES[lower] ?? lower;
32631
+ if (canonical === "light" || canonical === "dark" || canonical === "grayscale") {
32632
+ return canonical;
32633
+ }
32634
+ return void 0;
32635
+ }
32351
32636
  var COLOR_ALIASES = {
32352
32637
  grey: "gray",
32353
32638
  violet: "purple"
@@ -32357,7 +32642,7 @@ function resolveColor(token, theme) {
32357
32642
  return "none";
32358
32643
  if (token.startsWith("#"))
32359
32644
  return token;
32360
- const named2 = theme.name === "dark" ? darkNamed : lightNamed;
32645
+ const named2 = theme.name === "dark" ? darkNamed : theme.name === "grayscale" ? grayscaleNamed : lightNamed;
32361
32646
  const canonical = COLOR_ALIASES[token] ?? token;
32362
32647
  const hit = named2[canonical];
32363
32648
  return typeof hit === "string" ? hit : token;
@@ -32515,8 +32800,8 @@ function applyEntityStyleRef(target, props, ctx) {
32515
32800
  applyStyleDecl(target, ctx.styles.get(styleProp.value), ctx.theme);
32516
32801
  }
32517
32802
  function resolveStyle(entityType, props, ctx) {
32518
- const baseEntity3 = ctx.theme.entities[entityType];
32519
- const out = entityStyleToResolved(baseEntity3, ctx.theme);
32803
+ const baseEntity4 = ctx.theme.entities[entityType];
32804
+ const out = entityStyleToResolved(baseEntity4, ctx.theme);
32520
32805
  const defaultDecl = ctx.defaults.get(entityType);
32521
32806
  if (defaultDecl) {
32522
32807
  for (const p of defaultDecl.properties) {
@@ -35174,9 +35459,9 @@ function classifyLoad(load, capacity, warnFraction, overFraction) {
35174
35459
  return "green";
35175
35460
  }
35176
35461
  function resolveLaneUtilizationThresholds(lane, defaults) {
35177
- const dflt = defaults.get("swimlane");
35178
- const warn = resolveThreshold(propValue(lane.properties, "utilization-warn-at"), dflt ? propValue(dflt.properties, "utilization-warn-at") : void 0, DEFAULT_UTILIZATION_WARN_FRACTION);
35179
- const over = resolveThreshold(propValue(lane.properties, "utilization-over-at"), dflt ? propValue(dflt.properties, "utilization-over-at") : void 0, DEFAULT_UTILIZATION_OVER_FRACTION);
35462
+ const dflt2 = defaults.get("swimlane");
35463
+ const warn = resolveThreshold(propValue(lane.properties, "utilization-warn-at"), dflt2 ? propValue(dflt2.properties, "utilization-warn-at") : void 0, DEFAULT_UTILIZATION_WARN_FRACTION);
35464
+ const over = resolveThreshold(propValue(lane.properties, "utilization-over-at"), dflt2 ? propValue(dflt2.properties, "utilization-over-at") : void 0, DEFAULT_UTILIZATION_OVER_FRACTION);
35180
35465
  return { warn, over };
35181
35466
  }
35182
35467
  function resolveThreshold(laneVal, defaultVal, builtinFraction) {
@@ -36326,6 +36611,14 @@ function sequenceItem(node, cursor, ctx, ownerOverride) {
36326
36611
  planned: "#1e293b",
36327
36612
  neutral: "#1e293b"
36328
36613
  };
36614
+ const STATUS_TINT_GREY = {
36615
+ done: "#ebebeb",
36616
+ "in-progress": "#e4e4e4",
36617
+ "at-risk": "#eeeeee",
36618
+ blocked: "#dcdcdc",
36619
+ planned: "#f5f5f5",
36620
+ neutral: "#f5f5f5"
36621
+ };
36329
36622
  const STATUS_BORDER = {
36330
36623
  done: ctx.styleCtx.theme.status.done,
36331
36624
  "in-progress": ctx.styleCtx.theme.status.inProgress,
@@ -36334,11 +36627,12 @@ function sequenceItem(node, cursor, ctx, ownerOverride) {
36334
36627
  planned: ctx.styleCtx.theme.status.planned,
36335
36628
  neutral: ctx.styleCtx.theme.status.neutral
36336
36629
  };
36337
- const isLight = ctx.styleCtx.theme.name === "light";
36338
- const themeDefaultBg = isLight ? "#ffffff" : "#0f172a";
36339
- const themeDefaultFg = "#94a3b8";
36630
+ const themeName = ctx.styleCtx.theme.name;
36631
+ const isDark = themeName === "dark";
36632
+ const themeDefaultBg = isDark ? "#0f172a" : "#ffffff";
36633
+ const themeDefaultFg = themeName === "grayscale" ? "#9e9e9e" : "#94a3b8";
36340
36634
  if (style.bg === themeDefaultBg) {
36341
- style.bg = isLight ? STATUS_TINT_LIGHT[status] : STATUS_TINT_DARK[status];
36635
+ style.bg = themeName === "grayscale" ? STATUS_TINT_GREY[status] : isDark ? STATUS_TINT_DARK[status] : STATUS_TINT_LIGHT[status];
36342
36636
  }
36343
36637
  if (style.fg === themeDefaultFg) {
36344
36638
  style.fg = STATUS_BORDER[status];
@@ -38742,14 +39036,14 @@ async function parseSource(source, options = {}) {
38742
39036
  const doc = docFactory.fromString(source, freshUri());
38743
39037
  await services.shared.workspace.DocumentBuilder.build([doc], { validation: true });
38744
39038
  const diagnostics = [];
38745
- for (const err of doc.parseResult.lexerErrors) {
38746
- diagnostics.push(fromLexerError(err, filePath));
38747
- }
38748
- for (const err of doc.parseResult.parserErrors) {
38749
- diagnostics.push(fromParserError(err, filePath));
38750
- }
38751
- for (const diag of doc.diagnostics ?? []) {
38752
- diagnostics.push(fromLangiumDiagnostic(diag, filePath));
39039
+ for (const raw of collectDocumentDiagnostics(doc)) {
39040
+ if (raw.origin === "lexer") {
39041
+ diagnostics.push(fromLexerError(raw.error, filePath));
39042
+ } else if (raw.origin === "parser") {
39043
+ diagnostics.push(fromParserError(raw.error, filePath));
39044
+ } else {
39045
+ diagnostics.push(fromLangiumDiagnostic(raw.diagnostic, filePath));
39046
+ }
38753
39047
  }
38754
39048
  return { ast: doc.parseResult.value, diagnostics };
38755
39049
  }
@@ -38853,6 +39147,580 @@ function __resetEmbedPipelineForTests() {
38853
39147
  __resetBrowserPipelineForTests();
38854
39148
  }
38855
39149
 
39150
+ // ../../node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js
39151
+ var u8 = Uint8Array;
39152
+ var u16 = Uint16Array;
39153
+ var i32 = Int32Array;
39154
+ var fleb = new u8([
39155
+ 0,
39156
+ 0,
39157
+ 0,
39158
+ 0,
39159
+ 0,
39160
+ 0,
39161
+ 0,
39162
+ 0,
39163
+ 1,
39164
+ 1,
39165
+ 1,
39166
+ 1,
39167
+ 2,
39168
+ 2,
39169
+ 2,
39170
+ 2,
39171
+ 3,
39172
+ 3,
39173
+ 3,
39174
+ 3,
39175
+ 4,
39176
+ 4,
39177
+ 4,
39178
+ 4,
39179
+ 5,
39180
+ 5,
39181
+ 5,
39182
+ 5,
39183
+ 0,
39184
+ /* unused */
39185
+ 0,
39186
+ 0,
39187
+ /* impossible */
39188
+ 0
39189
+ ]);
39190
+ var fdeb = new u8([
39191
+ 0,
39192
+ 0,
39193
+ 0,
39194
+ 0,
39195
+ 1,
39196
+ 1,
39197
+ 2,
39198
+ 2,
39199
+ 3,
39200
+ 3,
39201
+ 4,
39202
+ 4,
39203
+ 5,
39204
+ 5,
39205
+ 6,
39206
+ 6,
39207
+ 7,
39208
+ 7,
39209
+ 8,
39210
+ 8,
39211
+ 9,
39212
+ 9,
39213
+ 10,
39214
+ 10,
39215
+ 11,
39216
+ 11,
39217
+ 12,
39218
+ 12,
39219
+ 13,
39220
+ 13,
39221
+ /* unused */
39222
+ 0,
39223
+ 0
39224
+ ]);
39225
+ var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
39226
+ var freb = function(eb, start) {
39227
+ var b = new u16(31);
39228
+ for (var i = 0; i < 31; ++i) {
39229
+ b[i] = start += 1 << eb[i - 1];
39230
+ }
39231
+ var r = new i32(b[30]);
39232
+ for (var i = 1; i < 30; ++i) {
39233
+ for (var j = b[i]; j < b[i + 1]; ++j) {
39234
+ r[j] = j - b[i] << 5 | i;
39235
+ }
39236
+ }
39237
+ return { b, r };
39238
+ };
39239
+ var _a = freb(fleb, 2);
39240
+ var fl = _a.b;
39241
+ var revfl = _a.r;
39242
+ fl[28] = 258, revfl[258] = 28;
39243
+ var _b = freb(fdeb, 0);
39244
+ var fd = _b.b;
39245
+ var revfd = _b.r;
39246
+ var rev = new u16(32768);
39247
+ for (i = 0; i < 32768; ++i) {
39248
+ x = (i & 43690) >> 1 | (i & 21845) << 1;
39249
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
39250
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
39251
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
39252
+ }
39253
+ var x;
39254
+ var i;
39255
+ var hMap = (function(cd, mb, r) {
39256
+ var s = cd.length;
39257
+ var i = 0;
39258
+ var l = new u16(mb);
39259
+ for (; i < s; ++i) {
39260
+ if (cd[i])
39261
+ ++l[cd[i] - 1];
39262
+ }
39263
+ var le = new u16(mb);
39264
+ for (i = 1; i < mb; ++i) {
39265
+ le[i] = le[i - 1] + l[i - 1] << 1;
39266
+ }
39267
+ var co;
39268
+ if (r) {
39269
+ co = new u16(1 << mb);
39270
+ var rvb = 15 - mb;
39271
+ for (i = 0; i < s; ++i) {
39272
+ if (cd[i]) {
39273
+ var sv = i << 4 | cd[i];
39274
+ var r_1 = mb - cd[i];
39275
+ var v = le[cd[i] - 1]++ << r_1;
39276
+ for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
39277
+ co[rev[v] >> rvb] = sv;
39278
+ }
39279
+ }
39280
+ }
39281
+ } else {
39282
+ co = new u16(s);
39283
+ for (i = 0; i < s; ++i) {
39284
+ if (cd[i]) {
39285
+ co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
39286
+ }
39287
+ }
39288
+ }
39289
+ return co;
39290
+ });
39291
+ var flt = new u8(288);
39292
+ for (i = 0; i < 144; ++i)
39293
+ flt[i] = 8;
39294
+ var i;
39295
+ for (i = 144; i < 256; ++i)
39296
+ flt[i] = 9;
39297
+ var i;
39298
+ for (i = 256; i < 280; ++i)
39299
+ flt[i] = 7;
39300
+ var i;
39301
+ for (i = 280; i < 288; ++i)
39302
+ flt[i] = 8;
39303
+ var i;
39304
+ var fdt = new u8(32);
39305
+ for (i = 0; i < 32; ++i)
39306
+ fdt[i] = 5;
39307
+ var i;
39308
+ var flm = /* @__PURE__ */ hMap(flt, 9, 0);
39309
+ var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
39310
+ var shft = function(p) {
39311
+ return (p + 7) / 8 | 0;
39312
+ };
39313
+ var slc = function(v, s, e) {
39314
+ if (s == null || s < 0)
39315
+ s = 0;
39316
+ if (e == null || e > v.length)
39317
+ e = v.length;
39318
+ return new u8(v.subarray(s, e));
39319
+ };
39320
+ var wbits = function(d, p, v) {
39321
+ v <<= p & 7;
39322
+ var o = p / 8 | 0;
39323
+ d[o] |= v;
39324
+ d[o + 1] |= v >> 8;
39325
+ };
39326
+ var wbits16 = function(d, p, v) {
39327
+ v <<= p & 7;
39328
+ var o = p / 8 | 0;
39329
+ d[o] |= v;
39330
+ d[o + 1] |= v >> 8;
39331
+ d[o + 2] |= v >> 16;
39332
+ };
39333
+ var hTree = function(d, mb) {
39334
+ var t = [];
39335
+ for (var i = 0; i < d.length; ++i) {
39336
+ if (d[i])
39337
+ t.push({ s: i, f: d[i] });
39338
+ }
39339
+ var s = t.length;
39340
+ var t2 = t.slice();
39341
+ if (!s)
39342
+ return { t: et, l: 0 };
39343
+ if (s == 1) {
39344
+ var v = new u8(t[0].s + 1);
39345
+ v[t[0].s] = 1;
39346
+ return { t: v, l: 1 };
39347
+ }
39348
+ t.sort(function(a, b) {
39349
+ return a.f - b.f;
39350
+ });
39351
+ t.push({ s: -1, f: 25001 });
39352
+ var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
39353
+ t[0] = { s: -1, f: l.f + r.f, l, r };
39354
+ while (i1 != s - 1) {
39355
+ l = t[t[i0].f < t[i2].f ? i0++ : i2++];
39356
+ r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
39357
+ t[i1++] = { s: -1, f: l.f + r.f, l, r };
39358
+ }
39359
+ var maxSym = t2[0].s;
39360
+ for (var i = 1; i < s; ++i) {
39361
+ if (t2[i].s > maxSym)
39362
+ maxSym = t2[i].s;
39363
+ }
39364
+ var tr2 = new u16(maxSym + 1);
39365
+ var mbt = ln(t[i1 - 1], tr2, 0);
39366
+ if (mbt > mb) {
39367
+ var i = 0, dt = 0;
39368
+ var lft = mbt - mb, cst = 1 << lft;
39369
+ t2.sort(function(a, b) {
39370
+ return tr2[b.s] - tr2[a.s] || a.f - b.f;
39371
+ });
39372
+ for (; i < s; ++i) {
39373
+ var i2_1 = t2[i].s;
39374
+ if (tr2[i2_1] > mb) {
39375
+ dt += cst - (1 << mbt - tr2[i2_1]);
39376
+ tr2[i2_1] = mb;
39377
+ } else
39378
+ break;
39379
+ }
39380
+ dt >>= lft;
39381
+ while (dt > 0) {
39382
+ var i2_2 = t2[i].s;
39383
+ if (tr2[i2_2] < mb)
39384
+ dt -= 1 << mb - tr2[i2_2]++ - 1;
39385
+ else
39386
+ ++i;
39387
+ }
39388
+ for (; i >= 0 && dt; --i) {
39389
+ var i2_3 = t2[i].s;
39390
+ if (tr2[i2_3] == mb) {
39391
+ --tr2[i2_3];
39392
+ ++dt;
39393
+ }
39394
+ }
39395
+ mbt = mb;
39396
+ }
39397
+ return { t: new u8(tr2), l: mbt };
39398
+ };
39399
+ var ln = function(n, l, d) {
39400
+ return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
39401
+ };
39402
+ var lc = function(c) {
39403
+ var s = c.length;
39404
+ while (s && !c[--s])
39405
+ ;
39406
+ var cl = new u16(++s);
39407
+ var cli = 0, cln = c[0], cls = 1;
39408
+ var w = function(v) {
39409
+ cl[cli++] = v;
39410
+ };
39411
+ for (var i = 1; i <= s; ++i) {
39412
+ if (c[i] == cln && i != s)
39413
+ ++cls;
39414
+ else {
39415
+ if (!cln && cls > 2) {
39416
+ for (; cls > 138; cls -= 138)
39417
+ w(32754);
39418
+ if (cls > 2) {
39419
+ w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
39420
+ cls = 0;
39421
+ }
39422
+ } else if (cls > 3) {
39423
+ w(cln), --cls;
39424
+ for (; cls > 6; cls -= 6)
39425
+ w(8304);
39426
+ if (cls > 2)
39427
+ w(cls - 3 << 5 | 8208), cls = 0;
39428
+ }
39429
+ while (cls--)
39430
+ w(cln);
39431
+ cls = 1;
39432
+ cln = c[i];
39433
+ }
39434
+ }
39435
+ return { c: cl.subarray(0, cli), n: s };
39436
+ };
39437
+ var clen = function(cf, cl) {
39438
+ var l = 0;
39439
+ for (var i = 0; i < cl.length; ++i)
39440
+ l += cf[i] * cl[i];
39441
+ return l;
39442
+ };
39443
+ var wfblk = function(out, pos, dat) {
39444
+ var s = dat.length;
39445
+ var o = shft(pos + 2);
39446
+ out[o] = s & 255;
39447
+ out[o + 1] = s >> 8;
39448
+ out[o + 2] = out[o] ^ 255;
39449
+ out[o + 3] = out[o + 1] ^ 255;
39450
+ for (var i = 0; i < s; ++i)
39451
+ out[o + i + 4] = dat[i];
39452
+ return (o + 4 + s) * 8;
39453
+ };
39454
+ var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
39455
+ wbits(out, p++, final);
39456
+ ++lf[256];
39457
+ var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
39458
+ var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
39459
+ var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
39460
+ var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
39461
+ var lcfreq = new u16(19);
39462
+ for (var i = 0; i < lclt.length; ++i)
39463
+ ++lcfreq[lclt[i] & 31];
39464
+ for (var i = 0; i < lcdt.length; ++i)
39465
+ ++lcfreq[lcdt[i] & 31];
39466
+ var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
39467
+ var nlcc = 19;
39468
+ for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
39469
+ ;
39470
+ var flen = bl + 5 << 3;
39471
+ var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
39472
+ var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
39473
+ if (bs >= 0 && flen <= ftlen && flen <= dtlen)
39474
+ return wfblk(out, p, dat.subarray(bs, bs + bl));
39475
+ var lm, ll, dm, dl;
39476
+ wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
39477
+ if (dtlen < ftlen) {
39478
+ lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
39479
+ var llm = hMap(lct, mlcb, 0);
39480
+ wbits(out, p, nlc - 257);
39481
+ wbits(out, p + 5, ndc - 1);
39482
+ wbits(out, p + 10, nlcc - 4);
39483
+ p += 14;
39484
+ for (var i = 0; i < nlcc; ++i)
39485
+ wbits(out, p + 3 * i, lct[clim[i]]);
39486
+ p += 3 * nlcc;
39487
+ var lcts = [lclt, lcdt];
39488
+ for (var it = 0; it < 2; ++it) {
39489
+ var clct = lcts[it];
39490
+ for (var i = 0; i < clct.length; ++i) {
39491
+ var len = clct[i] & 31;
39492
+ wbits(out, p, llm[len]), p += lct[len];
39493
+ if (len > 15)
39494
+ wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
39495
+ }
39496
+ }
39497
+ } else {
39498
+ lm = flm, ll = flt, dm = fdm, dl = fdt;
39499
+ }
39500
+ for (var i = 0; i < li; ++i) {
39501
+ var sym = syms[i];
39502
+ if (sym > 255) {
39503
+ var len = sym >> 18 & 31;
39504
+ wbits16(out, p, lm[len + 257]), p += ll[len + 257];
39505
+ if (len > 7)
39506
+ wbits(out, p, sym >> 23 & 31), p += fleb[len];
39507
+ var dst = sym & 31;
39508
+ wbits16(out, p, dm[dst]), p += dl[dst];
39509
+ if (dst > 3)
39510
+ wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
39511
+ } else {
39512
+ wbits16(out, p, lm[sym]), p += ll[sym];
39513
+ }
39514
+ }
39515
+ wbits16(out, p, lm[256]);
39516
+ return p + ll[256];
39517
+ };
39518
+ var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
39519
+ var et = /* @__PURE__ */ new u8(0);
39520
+ var dflt = function(dat, lvl, plvl, pre, post, st) {
39521
+ var s = st.z || dat.length;
39522
+ var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
39523
+ var w = o.subarray(pre, o.length - post);
39524
+ var lst = st.l;
39525
+ var pos = (st.r || 0) & 7;
39526
+ if (lvl) {
39527
+ if (pos)
39528
+ w[0] = st.r >> 3;
39529
+ var opt = deo[lvl - 1];
39530
+ var n = opt >> 13, c = opt & 8191;
39531
+ var msk_1 = (1 << plvl) - 1;
39532
+ var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
39533
+ var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
39534
+ var hsh = function(i2) {
39535
+ return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1;
39536
+ };
39537
+ var syms = new i32(25e3);
39538
+ var lf = new u16(288), df = new u16(32);
39539
+ var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
39540
+ for (; i + 2 < s; ++i) {
39541
+ var hv = hsh(i);
39542
+ var imod = i & 32767, pimod = head[hv];
39543
+ prev[imod] = pimod;
39544
+ head[hv] = imod;
39545
+ if (wi <= i) {
39546
+ var rem = s - i;
39547
+ if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
39548
+ pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
39549
+ li = lc_1 = eb = 0, bs = i;
39550
+ for (var j = 0; j < 286; ++j)
39551
+ lf[j] = 0;
39552
+ for (var j = 0; j < 30; ++j)
39553
+ df[j] = 0;
39554
+ }
39555
+ var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
39556
+ if (rem > 2 && hv == hsh(i - dif)) {
39557
+ var maxn = Math.min(n, rem) - 1;
39558
+ var maxd = Math.min(32767, i);
39559
+ var ml = Math.min(258, rem);
39560
+ while (dif <= maxd && --ch_1 && imod != pimod) {
39561
+ if (dat[i + l] == dat[i + l - dif]) {
39562
+ var nl = 0;
39563
+ for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)
39564
+ ;
39565
+ if (nl > l) {
39566
+ l = nl, d = dif;
39567
+ if (nl > maxn)
39568
+ break;
39569
+ var mmd = Math.min(dif, nl - 2);
39570
+ var md = 0;
39571
+ for (var j = 0; j < mmd; ++j) {
39572
+ var ti = i - dif + j & 32767;
39573
+ var pti = prev[ti];
39574
+ var cd = ti - pti & 32767;
39575
+ if (cd > md)
39576
+ md = cd, pimod = ti;
39577
+ }
39578
+ }
39579
+ }
39580
+ imod = pimod, pimod = prev[imod];
39581
+ dif += imod - pimod & 32767;
39582
+ }
39583
+ }
39584
+ if (d) {
39585
+ syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
39586
+ var lin = revfl[l] & 31, din = revfd[d] & 31;
39587
+ eb += fleb[lin] + fdeb[din];
39588
+ ++lf[257 + lin];
39589
+ ++df[din];
39590
+ wi = i + l;
39591
+ ++lc_1;
39592
+ } else {
39593
+ syms[li++] = dat[i];
39594
+ ++lf[dat[i]];
39595
+ }
39596
+ }
39597
+ }
39598
+ for (i = Math.max(i, wi); i < s; ++i) {
39599
+ syms[li++] = dat[i];
39600
+ ++lf[dat[i]];
39601
+ }
39602
+ pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
39603
+ if (!lst) {
39604
+ st.r = pos & 7 | w[pos / 8 | 0] << 3;
39605
+ pos -= 7;
39606
+ st.h = head, st.p = prev, st.i = i, st.w = wi;
39607
+ }
39608
+ } else {
39609
+ for (var i = st.w || 0; i < s + lst; i += 65535) {
39610
+ var e = i + 65535;
39611
+ if (e >= s) {
39612
+ w[pos / 8 | 0] = lst;
39613
+ e = s;
39614
+ }
39615
+ pos = wfblk(w, pos + 1, dat.subarray(i, e));
39616
+ }
39617
+ st.i = s;
39618
+ }
39619
+ return slc(o, 0, pre + shft(pos) + post);
39620
+ };
39621
+ var adler = function() {
39622
+ var a = 1, b = 0;
39623
+ return {
39624
+ p: function(d) {
39625
+ var n = a, m = b;
39626
+ var l = d.length | 0;
39627
+ for (var i = 0; i != l; ) {
39628
+ var e = Math.min(i + 2655, l);
39629
+ for (; i < e; ++i)
39630
+ m += n += d[i];
39631
+ n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);
39632
+ }
39633
+ a = n, b = m;
39634
+ },
39635
+ d: function() {
39636
+ a %= 65521, b %= 65521;
39637
+ return (a & 255) << 24 | (a & 65280) << 8 | (b & 255) << 8 | b >> 8;
39638
+ }
39639
+ };
39640
+ };
39641
+ var dopt = function(dat, opt, pre, post, st) {
39642
+ if (!st) {
39643
+ st = { l: 1 };
39644
+ if (opt.dictionary) {
39645
+ var dict = opt.dictionary.subarray(-32768);
39646
+ var newDat = new u8(dict.length + dat.length);
39647
+ newDat.set(dict);
39648
+ newDat.set(dat, dict.length);
39649
+ dat = newDat;
39650
+ st.w = dict.length;
39651
+ }
39652
+ }
39653
+ return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
39654
+ };
39655
+ var wbytes = function(d, b, v) {
39656
+ for (; v; ++b)
39657
+ d[b] = v, v >>>= 8;
39658
+ };
39659
+ var zlh = function(c, o) {
39660
+ var lv = o.level, fl2 = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;
39661
+ c[0] = 120, c[1] = fl2 << 6 | (o.dictionary && 32);
39662
+ c[1] |= 31 - (c[0] << 8 | c[1]) % 31;
39663
+ if (o.dictionary) {
39664
+ var h = adler();
39665
+ h.p(o.dictionary);
39666
+ wbytes(c, 2, h.d());
39667
+ }
39668
+ };
39669
+ function zlibSync(data, opts) {
39670
+ if (!opts)
39671
+ opts = {};
39672
+ var a = adler();
39673
+ a.p(data);
39674
+ var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);
39675
+ return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;
39676
+ }
39677
+ var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
39678
+ var tds = 0;
39679
+ try {
39680
+ td.decode(et, { stream: true });
39681
+ tds = 1;
39682
+ } catch (e) {
39683
+ }
39684
+
39685
+ // src/share.ts
39686
+ var DEFAULT_SHARE_BASE = "https://free.nowline.io/open";
39687
+ function _encodePayload(source) {
39688
+ const bytes = new TextEncoder().encode(source);
39689
+ const compressed = zlibSync(bytes);
39690
+ const chunk = 32768;
39691
+ let bin = "";
39692
+ for (let i = 0; i < compressed.length; i += chunk) {
39693
+ bin += String.fromCharCode(...compressed.subarray(i, i + chunk));
39694
+ }
39695
+ return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
39696
+ }
39697
+ function buildShareLink({ source, sourceUrl, share }) {
39698
+ if (share === false || share === "none") {
39699
+ return null;
39700
+ }
39701
+ if (typeof share === "object") {
39702
+ if (sourceUrl !== void 0 && _isHttps(sourceUrl)) {
39703
+ return share.remoteUrl.replace("{url}", encodeURIComponent(sourceUrl));
39704
+ }
39705
+ return share.textUrl.replace("{text}", _encodePayload(source));
39706
+ }
39707
+ const base = share === true ? DEFAULT_SHARE_BASE : share;
39708
+ const url = new URL(base);
39709
+ if (sourceUrl !== void 0 && _isHttps(sourceUrl)) {
39710
+ url.hash = `url=${encodeURIComponent(sourceUrl)}`;
39711
+ } else {
39712
+ url.hash = `text=${_encodePayload(source)}`;
39713
+ }
39714
+ return url.toString();
39715
+ }
39716
+ function _isHttps(url) {
39717
+ try {
39718
+ return new URL(url).protocol === "https:";
39719
+ } catch {
39720
+ return false;
39721
+ }
39722
+ }
39723
+
38856
39724
  // src/auto-scan.ts
38857
39725
  var runCounter = 0;
38858
39726
  async function runAutoScan(inputs) {
@@ -38864,6 +39732,7 @@ async function runAutoScan(inputs) {
38864
39732
  let rendered = 0;
38865
39733
  let failed = 0;
38866
39734
  const baseRunId = ++runCounter;
39735
+ const share = inputs.share ?? true;
38867
39736
  const tasks = [];
38868
39737
  let blockIndex = 0;
38869
39738
  for (const code of Array.from(blocks)) {
@@ -38880,11 +39749,31 @@ async function runAutoScan(inputs) {
38880
39749
  today: inputs.today,
38881
39750
  idPrefix
38882
39751
  };
39752
+ const parent = target.parentElement;
39753
+ const nextSibling = target.nextSibling;
39754
+ const perBlockUrl = code.getAttribute("data-nowline-source-url") ?? void 0;
39755
+ const resolvedSourceUrl = perBlockUrl ?? inputs.sourceUrl;
38883
39756
  tasks.push(
38884
39757
  renderSource2(source, opts).then(
38885
39758
  (svg) => {
38886
39759
  replaceWithSvg(target, svg);
38887
39760
  rendered++;
39761
+ if (parent !== null) {
39762
+ const href = buildShareLink({
39763
+ source,
39764
+ sourceUrl: resolvedSourceUrl,
39765
+ share
39766
+ });
39767
+ if (href !== null) {
39768
+ const a = doc.createElement("a");
39769
+ a.className = "nowline-share";
39770
+ a.href = href;
39771
+ a.target = "_blank";
39772
+ a.rel = "noopener noreferrer";
39773
+ a.textContent = "Share on Nowline";
39774
+ parent.insertBefore(a, nextSibling);
39775
+ }
39776
+ }
38888
39777
  },
38889
39778
  (err) => {
38890
39779
  failed++;
@@ -38925,19 +39814,20 @@ function resolveSystemTheme() {
38925
39814
  }
38926
39815
  }
38927
39816
  function effectiveTheme(theme, systemTheme) {
38928
- if (theme === "light" || theme === "dark") return theme;
39817
+ if (theme && theme !== "auto") return normalizeThemeName(theme) ?? systemTheme;
38929
39818
  return systemTheme;
38930
39819
  }
38931
39820
 
38932
39821
  // src/index.ts
38933
- var version = EMBED_VERSION;
38934
- var sha = EMBED_SHA;
39822
+ var version = true ? "0.5.0" : "0.0.0";
39823
+ var sha = true ? "04bdff9" : "unknown";
38935
39824
  var DEFAULT_SELECTOR = "pre code.language-nowline, code.language-nowline";
38936
39825
  var initialConfig = {
38937
39826
  theme: "auto",
38938
39827
  startOnLoad: true,
38939
39828
  selector: DEFAULT_SELECTOR,
38940
- systemTheme: resolveSystemTheme()
39829
+ systemTheme: resolveSystemTheme(),
39830
+ share: true
38941
39831
  };
38942
39832
  var config = { ...initialConfig };
38943
39833
  var autoStartScheduled = false;
@@ -38949,6 +39839,8 @@ function initialize(options = {}) {
38949
39839
  locale: options.locale ?? config.locale,
38950
39840
  width: options.width ?? config.width,
38951
39841
  today: options.today ?? config.today,
39842
+ share: options.share ?? config.share,
39843
+ sourceUrl: options.sourceUrl ?? config.sourceUrl,
38952
39844
  // Re-read `prefers-color-scheme` on every initialize() so callers
38953
39845
  // who explicitly want the latest system theme can ask for it by
38954
39846
  // calling initialize() again. Auto-scan paths still use the value
@@ -38981,6 +39873,8 @@ async function init(overrides) {
38981
39873
  locale: overrides?.locale ?? config.locale,
38982
39874
  width: overrides?.width ?? config.width,
38983
39875
  today: overrides?.today ?? config.today,
39876
+ share: overrides?.share ?? config.share,
39877
+ sourceUrl: overrides?.sourceUrl ?? config.sourceUrl,
38984
39878
  document: overrides?.document
38985
39879
  };
38986
39880
  return runAutoScan(inputs);
@@ -38988,13 +39882,6 @@ async function init(overrides) {
38988
39882
  var run = init;
38989
39883
  if (typeof document !== "undefined" && !autoStartScheduled) {
38990
39884
  autoStartScheduled = true;
38991
- if (false) {
38992
- void null.then(({ startDevAuthGate }) => {
38993
- startDevAuthGate();
38994
- }).catch((err) => {
38995
- console.error("[nowline] dev auth gate failed to load:", err);
38996
- });
38997
- }
38998
39885
  const start = () => {
38999
39886
  if (!config.startOnLoad) return;
39000
39887
  void init();