@samva/cli 0.4.0 → 0.6.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 (4) hide show
  1. package/AGENTS.md +14 -2
  2. package/README.md +84 -34
  3. package/dist/bin.mjs +1890 -953
  4. package/package.json +8 -9
package/dist/bin.mjs CHANGED
@@ -13567,7 +13567,7 @@ var layer12 = /* @__PURE__ */ layer.pipe(/* @__PURE__ */ provideMerge(/* @__PURE
13567
13567
  // package.json
13568
13568
  var package_default = {
13569
13569
  name: "@samva/cli",
13570
- version: "0.4.0",
13570
+ version: "0.6.0",
13571
13571
  description: "Samva CLI \u2014 email and platform operations from your terminal",
13572
13572
  keywords: [
13573
13573
  "cli",
@@ -13615,21 +13615,20 @@ var package_default = {
13615
13615
  devDependencies: {
13616
13616
  "@effect/platform-bun": "catalog:effect",
13617
13617
  "@effect/vitest": "catalog:effect",
13618
- "@samva/markup": "workspace:0.8.0",
13619
- "@samva/vite": "workspace:0.8.0",
13618
+ "@samva/markup": "workspace:0.10.0",
13619
+ "@samva/vite": "workspace:0.10.0",
13620
13620
  "@types/node": "catalog:",
13621
13621
  "better-auth": "catalog:",
13622
- "better-result": "catalog:",
13623
13622
  effect: "catalog:effect",
13624
- samva: "workspace:0.7.0",
13623
+ samva: "workspace:0.9.0",
13625
13624
  typescript: "catalog:",
13626
13625
  vitest: "catalog:"
13627
13626
  },
13628
13627
  optionalDependencies: {
13629
- "@samva/cli-darwin-arm64": "workspace:0.4.0",
13630
- "@samva/cli-darwin-x64": "workspace:0.4.0",
13631
- "@samva/cli-linux-arm64": "workspace:0.4.0",
13632
- "@samva/cli-linux-x64": "workspace:0.4.0"
13628
+ "@samva/cli-darwin-arm64": "workspace:0.6.0",
13629
+ "@samva/cli-darwin-x64": "workspace:0.6.0",
13630
+ "@samva/cli-linux-arm64": "workspace:0.6.0",
13631
+ "@samva/cli-linux-x64": "workspace:0.6.0"
13633
13632
  },
13634
13633
  engines: {
13635
13634
  node: ">=18"
@@ -18533,490 +18532,6 @@ var AGENT_AUTH_HINT = "For CI and agents, set SAMVA_API_KEY instead of samva log
18533
18532
 
18534
18533
  // src/commands/brands.ts
18535
18534
  import { join as join3, relative, resolve as resolve5 } from "path";
18536
-
18537
- // ../../node_modules/.bun/better-result@3.0.1/node_modules/better-result/dist/index.mjs
18538
- function e(e, t) {
18539
- return e === 2 ? (...e) => e.length >= 2 ? t(e[0], e[1]) : (n) => t(n, e[0]) : e === 3 ? (...e) => e.length >= 3 ? t(e[0], e[1], e[2]) : (n) => t(n, e[0], e[1]) : e === 4 ? (...e) => e.length >= 4 ? t(e[0], e[1], e[2], e[3]) : (n) => t(n, e[0], e[1], e[2]) : (...n) => n.length >= e ? t(...n) : (e) => t(e, ...n);
18540
- }
18541
- var t = (e) => e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
18542
- var n = class e extends Error {
18543
- _tag = `Panic`;
18544
- static is(t) {
18545
- return t instanceof e;
18546
- }
18547
- constructor(e) {
18548
- if (super(e.message, e.cause === undefined ? undefined : { cause: e.cause }), Object.assign(this, e), Object.setPrototypeOf(this, new.target.prototype), this.name = `Panic`, e.cause instanceof Error && e.cause.stack) {
18549
- let t = e.cause.stack.replace(/\n/g, `
18550
- `);
18551
- this.stack = `${this.stack}
18552
- Caused by: ${t}`;
18553
- }
18554
- }
18555
- toJSON() {
18556
- return { ...this, _tag: this._tag, name: this.name, message: this.message, cause: t(this.cause), stack: this.stack };
18557
- }
18558
- *[Symbol.iterator]() {
18559
- return yield* d(this), i(`Unreachable: Err yielded in Panic but generator continued`, this);
18560
- }
18561
- };
18562
- var i = (e, t) => {
18563
- throw new n({ message: e, cause: t });
18564
- };
18565
- var a = (e, t) => {
18566
- try {
18567
- return e();
18568
- } catch (e) {
18569
- throw i(t, e);
18570
- }
18571
- };
18572
- var o = async (e, t) => {
18573
- try {
18574
- return await e();
18575
- } catch (e) {
18576
- throw i(t, e);
18577
- }
18578
- };
18579
- var s = class e {
18580
- status = `ok`;
18581
- constructor(e) {
18582
- this.value = e;
18583
- }
18584
- isOk() {
18585
- return true;
18586
- }
18587
- isErr() {
18588
- return false;
18589
- }
18590
- map(t) {
18591
- return a(() => new e(t(this.value)), `map callback threw`);
18592
- }
18593
- mapError(e) {
18594
- return this;
18595
- }
18596
- tryRecover(e) {
18597
- return this;
18598
- }
18599
- tryRecoverAsync(e) {
18600
- return Promise.resolve(this);
18601
- }
18602
- andThen(e) {
18603
- return a(() => e(this.value), `andThen callback threw`);
18604
- }
18605
- andThenAsync(e) {
18606
- return o(() => e(this.value), `andThenAsync callback threw`);
18607
- }
18608
- match(e) {
18609
- return a(() => e.ok(this.value), `match ok handler threw`);
18610
- }
18611
- unwrap(e) {
18612
- return this.value;
18613
- }
18614
- unwrapOr(e) {
18615
- return this.value;
18616
- }
18617
- tap(e) {
18618
- return a(() => (e(this.value), this), `tap callback threw`);
18619
- }
18620
- tapAsync(e) {
18621
- return o(async () => (await e(this.value), this), `tapAsync callback threw`);
18622
- }
18623
- tapError(e) {
18624
- return this;
18625
- }
18626
- tapErrorAsync(e) {
18627
- return Promise.resolve(this);
18628
- }
18629
- tapBoth(e) {
18630
- return a(() => (e.ok(this.value), this), `tapBoth ok callback threw`);
18631
- }
18632
- tapBothAsync(e) {
18633
- return o(async () => (await e.ok(this.value), this), `tapBothAsync ok callback threw`);
18634
- }
18635
- *[Symbol.iterator]() {
18636
- return this.value;
18637
- }
18638
- };
18639
- var c = class e {
18640
- status = `error`;
18641
- constructor(e) {
18642
- this.error = e;
18643
- }
18644
- isOk() {
18645
- return false;
18646
- }
18647
- isErr() {
18648
- return true;
18649
- }
18650
- map(e) {
18651
- return this;
18652
- }
18653
- mapError(t) {
18654
- return a(() => new e(t(this.error)), `mapError callback threw`);
18655
- }
18656
- tryRecover(e) {
18657
- return a(() => e(this.error), `tryRecover callback threw`);
18658
- }
18659
- tryRecoverAsync(e) {
18660
- return o(() => e(this.error), `tryRecoverAsync callback threw`);
18661
- }
18662
- andThen(e) {
18663
- return this;
18664
- }
18665
- andThenAsync(e) {
18666
- return Promise.resolve(this);
18667
- }
18668
- match(e) {
18669
- return a(() => e.err(this.error), `match err handler threw`);
18670
- }
18671
- unwrap(e) {
18672
- return i(e ?? `Unwrap called on Err: ${String(this.error)}`, this.error);
18673
- }
18674
- unwrapOr(e) {
18675
- return e;
18676
- }
18677
- tap(e) {
18678
- return this;
18679
- }
18680
- tapError(e) {
18681
- return a(() => (e(this.error), this), `tapError callback threw`);
18682
- }
18683
- tapAsync(e) {
18684
- return Promise.resolve(this);
18685
- }
18686
- tapErrorAsync(e) {
18687
- return o(async () => (await e(this.error), this), `tapErrorAsync callback threw`);
18688
- }
18689
- tapBoth(e) {
18690
- return a(() => (e.err(this.error), this), `tapBoth err callback threw`);
18691
- }
18692
- tapBothAsync(e) {
18693
- return o(async () => (await e.err(this.error), this), `tapBothAsync err callback threw`);
18694
- }
18695
- *[Symbol.iterator]() {
18696
- return yield this, i(`Unreachable: Err yielded in Result.gen but generator continued`, this.error);
18697
- }
18698
- };
18699
- function l(e) {
18700
- return new s(e);
18701
- }
18702
- var u = (e) => e.status === `ok`;
18703
- var d = (e) => new c(e);
18704
- var f = (e) => e.status === `error`;
18705
- var p = (e) => e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
18706
- var m = (e) => e instanceof Error && (`_tag` in e) && typeof e._tag == `string` && (`toJSON` in e) && typeof e.toJSON == `function`;
18707
- var h = (e) => {
18708
-
18709
- class t extends Error {
18710
- _tag = e;
18711
- constructor(t) {
18712
- let n = t && `message` in t && typeof t.message == `string` ? t.message : undefined, r = t && `cause` in t ? t.cause : undefined;
18713
- if (super(n, r === undefined ? undefined : { cause: r }), t && Object.assign(this, t), Object.setPrototypeOf(this, new.target.prototype), this.name = e, r instanceof Error && r.stack) {
18714
- let e2 = r.stack.replace(/\n/g, `
18715
- `);
18716
- this.stack = `${this.stack}
18717
- Caused by: ${e2}`;
18718
- }
18719
- }
18720
- toJSON() {
18721
- return { ...this, _tag: this._tag, name: this.name, message: this.message, cause: p(this.cause), stack: this.stack };
18722
- }
18723
- match(e2) {
18724
- return g(this, e2);
18725
- }
18726
- *[Symbol.iterator]() {
18727
- return yield* d(this), i(`Unreachable: Err yielded in TaggedError but generator continued`, this);
18728
- }
18729
- static is(e2) {
18730
- return e2 instanceof this;
18731
- }
18732
- }
18733
- return t;
18734
- };
18735
- h.is = m;
18736
- var g = e(2, (e, t) => {
18737
- let n = t[e._tag];
18738
- try {
18739
- return n(e);
18740
- } catch (e) {
18741
- return i(`matchError handler threw`, e);
18742
- }
18743
- });
18744
- var x = class extends h(`UnhandledException`) {
18745
- constructor(e) {
18746
- let t = e.cause instanceof Error ? `Unhandled exception: ${e.cause.message}` : `Unhandled exception: ${String(e.cause)}`;
18747
- super({ message: t, cause: e.cause });
18748
- }
18749
- };
18750
- var S = class extends h(`ResultDeserializationError`) {
18751
- constructor(e) {
18752
- super({ message: e.issues ? `Failed to deserialize Result payload` : `Failed to deserialize value as Result: expected { status: "ok", value } or { status: "error", error }`, value: e.value, issues: e.issues });
18753
- }
18754
- };
18755
- var C = class extends h(`ResultSerializationError`) {
18756
- constructor(e) {
18757
- super({ message: `Failed to serialize Result payload`, value: e.value, issues: e.issues });
18758
- }
18759
- };
18760
- var w = (e, t) => {
18761
- try {
18762
- return e();
18763
- } catch (e) {
18764
- throw i(t, e);
18765
- }
18766
- };
18767
- var T = (e, t) => {
18768
- let n = (t) => {
18769
- if (typeof e == `function`)
18770
- try {
18771
- return l(e(t));
18772
- } catch (e) {
18773
- return d(new x({ cause: e }));
18774
- }
18775
- try {
18776
- return l(e.try(t));
18777
- } catch (t) {
18778
- try {
18779
- return d(e.catch(t));
18780
- } catch (e) {
18781
- throw i(`Result.try catch handler threw`, e);
18782
- }
18783
- }
18784
- }, r = t?.retry?.times ?? 0, a = 1, o = n({ attempt: a });
18785
- for (let e = 0;e < r && o.status === `error`; e++)
18786
- a++, o = n({ attempt: a });
18787
- return o;
18788
- };
18789
- var E = async (e, t) => {
18790
- let n = async (t) => {
18791
- if (typeof e == `function`)
18792
- try {
18793
- return l(await e(t));
18794
- } catch (e) {
18795
- return d(new x({ cause: e }));
18796
- }
18797
- try {
18798
- return l(await e.try(t));
18799
- } catch (t) {
18800
- try {
18801
- return d(await e.catch(t));
18802
- } catch (e) {
18803
- throw i(`Result.tryPromise catch handler threw`, e);
18804
- }
18805
- }
18806
- }, r = t?.retry;
18807
- if (!r)
18808
- return n({ attempt: 1, signal: t?.signal });
18809
- let a = (e, t, n) => {
18810
- switch (t) {
18811
- case `constant`:
18812
- return e;
18813
- case `linear`:
18814
- return e * (n + 1);
18815
- case `exponential`:
18816
- return e * 2 ** n;
18817
- }
18818
- }, o = r.jitter ?? false;
18819
- if (typeof o == `number` && (!Number.isFinite(o) || o < 0 || o > 1))
18820
- throw i(`Result.tryPromise retry jitter must be a finite number between 0 and 1`);
18821
- let s = o === true ? 1 : o === false ? 0 : o, c = (e) => s === 0 ? e : e * (1 - s + Math.random() * s), u = (e, t) => new Promise((n) => {
18822
- if (t?.aborted) {
18823
- n(false);
18824
- return;
18825
- }
18826
- let r = () => {
18827
- clearTimeout(i), n(false);
18828
- }, i = setTimeout(() => {
18829
- t?.removeEventListener(`abort`, r), n(true);
18830
- }, e);
18831
- t?.addEventListener(`abort`, r, { once: true });
18832
- }), f = { attempt: 1, signal: t.signal }, p = await n(f), m = r.shouldRetry ?? (() => true);
18833
- for (let e = 0;e < r.times && !(p.status !== `error` || f.signal?.aborted); e++) {
18834
- let o = p.error;
18835
- if (!w(() => m(o, f), `shouldRetry predicate threw`))
18836
- break;
18837
- let s;
18838
- if (typeof r.delayMs == `function`) {
18839
- let e = r.delayMs;
18840
- s = w(() => e(o, f), `Result.tryPromise delayMs callback threw`);
18841
- } else {
18842
- if (r.backoff === undefined)
18843
- throw i(`Result.tryPromise static retry delay requires backoff`);
18844
- s = c(a(r.delayMs, r.backoff, e));
18845
- }
18846
- if (!await u(s, f.signal) || f.signal?.aborted)
18847
- break;
18848
- f = { attempt: f.attempt + 1, signal: t.signal }, p = await n(f);
18849
- }
18850
- return p;
18851
- };
18852
- var D = e(2, (e, t) => e.map(t));
18853
- var O = e(2, (e, t) => e.mapError(t));
18854
- var k = e(2, (e, t) => e.tryRecover(t));
18855
- var A = e(2, (e, t) => e.andThen(t));
18856
- var ee = e(2, (e, t) => e.tryRecoverAsync(t));
18857
- var te = e(2, (e, t) => e.andThenAsync(t));
18858
- var ne = e(2, (e, t) => e.match(t));
18859
- var j = e(2, (e, t) => e.tap(t));
18860
- var M = e(2, (e, t) => e.tapAsync(t));
18861
- var N = e(2, (e, t) => e.tapError(t));
18862
- var P = e(2, (e, t) => e.tapErrorAsync(t));
18863
- var F = e(2, (e, t) => e.tapBoth(t));
18864
- var I = e(2, (e, t) => e.tapBothAsync(t));
18865
- var L = (e, t) => e.unwrap(t);
18866
- function R(e) {
18867
- if (!(typeof e == `object` && e && (`status` in e) && (e.status === `ok` || e.status === `error`)))
18868
- return i(`Result.gen body must return Result.ok() or Result.err(), got: ` + (e === null ? `null` : typeof e == `object` ? JSON.stringify(e) : String(e)));
18869
- }
18870
- var z = e(2, (e, t) => e.unwrapOr(t));
18871
- var B = (e, t) => {
18872
- let n = e.call(t);
18873
- if (Symbol.asyncIterator in n)
18874
- return (async () => {
18875
- let e = n, t;
18876
- try {
18877
- t = await e.next();
18878
- } catch (e) {
18879
- throw i(`generator body threw`, e);
18880
- }
18881
- if (R(t.value), !t.done)
18882
- try {
18883
- await e.return?.(undefined);
18884
- } catch (e) {
18885
- throw i(`generator cleanup threw`, e);
18886
- }
18887
- return t.value;
18888
- })();
18889
- let r = n, a;
18890
- try {
18891
- a = r.next();
18892
- } catch (e) {
18893
- throw i(`generator body threw`, e);
18894
- }
18895
- if (R(a.value), !a.done)
18896
- try {
18897
- r.return?.(undefined);
18898
- } catch (e) {
18899
- throw i(`generator cleanup threw`, e);
18900
- }
18901
- return a.value;
18902
- };
18903
- async function* V(e) {
18904
- return yield* await e;
18905
- }
18906
- function H(e) {
18907
- return typeof e == `object` && !!e && `status` in e && (e.status === `ok` || e.status === `error`);
18908
- }
18909
- var U = (e) => typeof e == `object` && !!e && (`then` in e) && typeof e.then == `function`;
18910
- var W = (e, t) => w(e, t);
18911
- var G = (e, t, n) => U(e) ? Promise.resolve(e).catch((e) => {
18912
- throw i(t, e);
18913
- }).then(n) : n(e);
18914
- var K = (e, t) => (`issues` in e) && e.issues ? d(t(e.issues)) : l(e.value);
18915
- var q = (e, t) => G(W(() => e[`~standard`].validate(t), `Result.codec serialize schema threw`), `Result.codec serialize schema threw`, (e) => K(e, (e) => new C({ value: t, issues: e })));
18916
- var J = (e, t) => G(W(() => e[`~standard`].validate(t), `Result.codec deserialize schema threw`), `Result.codec deserialize schema threw`, (e) => K(e, (e) => new S({ value: t, issues: e })));
18917
- var Y = (e, t) => U(e) ? Promise.resolve(e).then((e) => e.unwrap(t)) : e.unwrap(t);
18918
- var X = (e) => {
18919
- let t = (e) => e.status === `ok` ? l(e.value) : S.is(e.error) ? e.unwrap(`Result.codec deserializeUnsafe failed`) : d(e.error);
18920
- return U(e) ? Promise.resolve(e).then(t) : t(e);
18921
- };
18922
- var re = (e) => {
18923
- let t = (e) => e.status === `error` ? d(e.error) : l({ status: `ok`, value: e.value }), n = (e) => e.status === `error` ? d(e.error) : l({ status: `error`, error: e.value });
18924
- function r(r) {
18925
- if (r.status === `ok`) {
18926
- let n = q(e.serialize.ok, r.value);
18927
- return U(n) ? Promise.resolve(n).then(t) : t(n);
18928
- }
18929
- let i = q(e.serialize.err, r.error);
18930
- return U(i) ? Promise.resolve(i).then(n) : n(i);
18931
- }
18932
- let i = (e) => e.status === `error` ? d(e.error) : l(e.value), a = (e) => e.status === `error` ? d(e.error) : d(e.value);
18933
- function o(t) {
18934
- if (!H(t))
18935
- return d(new S({ value: t }));
18936
- if (t.status === `ok`) {
18937
- let n = J(e.deserialize.ok, t.value);
18938
- return U(n) ? Promise.resolve(n).then(i) : i(n);
18939
- }
18940
- let n = J(e.deserialize.err, t.error);
18941
- return U(n) ? Promise.resolve(n).then(a) : a(n);
18942
- }
18943
- function s(e) {
18944
- return Y(r(e), `Result.codec serializeUnsafe failed`);
18945
- }
18946
- function c(e) {
18947
- return X(o(e));
18948
- }
18949
- return { serialize: r, serializeUnsafe: s, deserialize: o, deserializeUnsafe: c };
18950
- };
18951
- var Z = async (e, t) => {
18952
- try {
18953
- return await Promise.all(e);
18954
- } catch (e) {
18955
- return i(t, e);
18956
- }
18957
- };
18958
- var Q = (e) => {
18959
- let t = [];
18960
- for (let n of e) {
18961
- if (n.status === `error`)
18962
- return n;
18963
- t.push(n.value);
18964
- }
18965
- return l(t);
18966
- };
18967
- var ie = async (e) => Q(await Z(e, `Result.allAsync input promise rejected`));
18968
- var $ = (e) => {
18969
- let t = [], n = [];
18970
- for (let r of e)
18971
- r.status === `ok` ? t.push(r.value) : n.push(r.error);
18972
- return [t, n];
18973
- };
18974
- var ae = { ok: l, isOk: u, err: d, isError: f, try: T, tryPromise: E, map: D, mapError: O, tryRecover: k, andThen: A, tryRecoverAsync: ee, andThenAsync: te, match: ne, tap: j, tapAsync: M, tapError: N, tapErrorAsync: P, tapBoth: F, tapBothAsync: I, unwrap: L, unwrapOr: z, gen: B, await: V, codec: re, all: Q, allAsync: ie, partition: $, partitionAsync: async (e) => $(await Z(e, `Result.partitionAsync input promise rejected`)), flatten: (e) => e.status === `ok` ? e.value : e };
18975
-
18976
- // ../markup/dist/diagnostics.js
18977
- var diagnosticsMessage = (diagnostics) => diagnostics.map((diagnostic) => diagnostic.message).join(`
18978
- `);
18979
- var SmlParseError = class extends h("SmlParseError") {
18980
- constructor(args) {
18981
- super({
18982
- diagnostics: args.diagnostics,
18983
- message: diagnosticsMessage(args.diagnostics)
18984
- });
18985
- }
18986
- };
18987
- var SmlCompileError = class extends h("SmlCompileError") {
18988
- constructor(args) {
18989
- super({
18990
- diagnostics: args.diagnostics,
18991
- message: diagnosticsMessage(args.diagnostics)
18992
- });
18993
- }
18994
- };
18995
- var buildLineMap = (source) => {
18996
- const lineStarts = [0];
18997
- for (let index = 0;index < source.length; index++) {
18998
- const code = source.charCodeAt(index);
18999
- if (code === 10 || code === 13 && source.charCodeAt(index + 1) !== 10 || code === 8232 || code === 8233)
19000
- lineStarts.push(index + 1);
19001
- }
19002
- return lineStarts;
19003
- };
19004
- var lineColumn = (lineMap, offset) => {
19005
- let low = 0;
19006
- let high = lineMap.length - 1;
19007
- while (low < high) {
19008
- const middle = low + high + 1 >> 1;
19009
- if (lineMap[middle] <= offset)
19010
- low = middle;
19011
- else
19012
- high = middle - 1;
19013
- }
19014
- return {
19015
- line: low + 1,
19016
- column: offset - lineMap[low] + 1
19017
- };
19018
- };
19019
-
19020
18535
  // ../../node_modules/.bun/css-tree@3.2.1/node_modules/css-tree/lib/tokenizer/types.js
19021
18536
  var EOF = 0;
19022
18537
  var Ident = 1;
@@ -19315,9 +18830,9 @@ function adoptBuffer(buffer = null, size) {
19315
18830
  }
19316
18831
 
19317
18832
  // ../../node_modules/.bun/css-tree@3.2.1/node_modules/css-tree/lib/tokenizer/OffsetToLocation.js
19318
- var N2 = 10;
19319
- var F2 = 12;
19320
- var R2 = 13;
18833
+ var N = 10;
18834
+ var F = 12;
18835
+ var R = 13;
19321
18836
  function computeLinesAndColumns(host) {
19322
18837
  const source = host.source;
19323
18838
  const sourceLength = source.length;
@@ -19330,8 +18845,8 @@ function computeLinesAndColumns(host) {
19330
18845
  const code = source.charCodeAt(i);
19331
18846
  lines[i] = line;
19332
18847
  columns[i] = column++;
19333
- if (code === N2 || code === R2 || code === F2) {
19334
- if (code === R2 && i + 1 < sourceLength && source.charCodeAt(i + 1) === N2) {
18848
+ if (code === N || code === R || code === F) {
18849
+ if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N) {
19335
18850
  i++;
19336
18851
  lines[i] = line;
19337
18852
  columns[i] = column;
@@ -21730,7 +21245,7 @@ var cssWideKeywords = [
21730
21245
  // ../../node_modules/.bun/css-tree@3.2.1/node_modules/css-tree/lib/lexer/generic-an-plus-b.js
21731
21246
  var PLUSSIGN2 = 43;
21732
21247
  var HYPHENMINUS3 = 45;
21733
- var N3 = 110;
21248
+ var N2 = 110;
21734
21249
  var DISALLOW_SIGN = true;
21735
21250
  var ALLOW_SIGN = false;
21736
21251
  function isDelim(token, code) {
@@ -21795,7 +21310,7 @@ function anPlusB(token, getNextToken) {
21795
21310
  if (token.type === Number8) {
21796
21311
  return checkInteger(token, 0, ALLOW_SIGN, offset);
21797
21312
  } else if (token.type === Ident && token.value.charCodeAt(0) === HYPHENMINUS3) {
21798
- if (!cmpChar(token.value, 1, N3)) {
21313
+ if (!cmpChar(token.value, 1, N2)) {
21799
21314
  return 0;
21800
21315
  }
21801
21316
  switch (token.value.length) {
@@ -21818,7 +21333,7 @@ function anPlusB(token, getNextToken) {
21818
21333
  if (token.type !== Ident) {
21819
21334
  token = getNextToken(++offset);
21820
21335
  }
21821
- if (token === null || !cmpChar(token.value, 0, N3)) {
21336
+ if (token === null || !cmpChar(token.value, 0, N2)) {
21822
21337
  return 0;
21823
21338
  }
21824
21339
  switch (token.value.length) {
@@ -21849,7 +21364,7 @@ function anPlusB(token, getNextToken) {
21849
21364
  if (i === sign) {
21850
21365
  return 0;
21851
21366
  }
21852
- if (!cmpChar(token.value, i, N3)) {
21367
+ if (!cmpChar(token.value, i, N2)) {
21853
21368
  return 0;
21854
21369
  }
21855
21370
  if (i + 1 === token.value.length) {
@@ -21874,7 +21389,7 @@ function anPlusB(token, getNextToken) {
21874
21389
  var PLUSSIGN3 = 43;
21875
21390
  var HYPHENMINUS4 = 45;
21876
21391
  var QUESTIONMARK = 63;
21877
- var U2 = 117;
21392
+ var U = 117;
21878
21393
  function isDelim2(token, code) {
21879
21394
  return token !== null && token.type === Delim && token.value.charCodeAt(0) === code;
21880
21395
  }
@@ -21912,7 +21427,7 @@ function withQuestionMarkSequence(consumed, length, getNextToken) {
21912
21427
  }
21913
21428
  function urange(token, getNextToken) {
21914
21429
  let length = 0;
21915
- if (token === null || token.type !== Ident || !cmpChar(token.value, 0, U2)) {
21430
+ if (token === null || token.type !== Ident || !cmpChar(token.value, 0, U)) {
21916
21431
  return 0;
21917
21432
  }
21918
21433
  token = getNextToken(++length);
@@ -22507,9 +22022,9 @@ function SyntaxError3(message, input, offset) {
22507
22022
  }
22508
22023
  // ../../node_modules/.bun/css-tree@3.2.1/node_modules/css-tree/lib/definition-syntax/scanner.js
22509
22024
  var TAB = 9;
22510
- var N4 = 10;
22511
- var F3 = 12;
22512
- var R3 = 13;
22025
+ var N3 = 10;
22026
+ var F2 = 12;
22027
+ var R2 = 13;
22513
22028
  var SPACE = 32;
22514
22029
  var NAME_CHAR = new Uint8Array(128).map((_, idx) => /[a-zA-Z0-9\-]/.test(String.fromCharCode(idx)) ? 1 : 0);
22515
22030
 
@@ -22539,7 +22054,7 @@ class Scanner {
22539
22054
  findWsEnd(pos) {
22540
22055
  for (;pos < this.str.length; pos++) {
22541
22056
  const code = this.str.charCodeAt(pos);
22542
- if (code !== R3 && code !== N4 && code !== F3 && code !== SPACE && code !== TAB) {
22057
+ if (code !== R2 && code !== N3 && code !== F2 && code !== SPACE && code !== TAB) {
22543
22058
  break;
22544
22059
  }
22545
22060
  }
@@ -22601,9 +22116,9 @@ class Scanner {
22601
22116
 
22602
22117
  // ../../node_modules/.bun/css-tree@3.2.1/node_modules/css-tree/lib/definition-syntax/parse.js
22603
22118
  var TAB2 = 9;
22604
- var N5 = 10;
22605
- var F4 = 12;
22606
- var R4 = 13;
22119
+ var N4 = 10;
22120
+ var F3 = 12;
22121
+ var R3 = 13;
22607
22122
  var SPACE2 = 32;
22608
22123
  var EXCLAMATIONMARK2 = 33;
22609
22124
  var NUMBERSIGN2 = 35;
@@ -22976,9 +22491,9 @@ function peek(scanner) {
22976
22491
  });
22977
22492
  case SPACE2:
22978
22493
  case TAB2:
22979
- case N5:
22980
- case R4:
22981
- case F4:
22494
+ case N4:
22495
+ case R3:
22496
+ case F3:
22982
22497
  return {
22983
22498
  type: "Spaces",
22984
22499
  value: scanner.scanSpaces()
@@ -39216,7 +38731,7 @@ __export(exports_AnPlusB, {
39216
38731
  });
39217
38732
  var PLUSSIGN5 = 43;
39218
38733
  var HYPHENMINUS5 = 45;
39219
- var N6 = 110;
38734
+ var N5 = 110;
39220
38735
  var DISALLOW_SIGN2 = true;
39221
38736
  var ALLOW_SIGN2 = false;
39222
38737
  function checkInteger2(offset, disallowSign) {
@@ -39241,7 +38756,7 @@ function expectCharCode(offset, code) {
39241
38756
  if (!this.cmpChar(this.tokenStart + offset, code)) {
39242
38757
  let msg = "";
39243
38758
  switch (code) {
39244
- case N6:
38759
+ case N5:
39245
38760
  msg = "N is expected";
39246
38761
  break;
39247
38762
  case HYPHENMINUS5:
@@ -39298,7 +38813,7 @@ function parse2() {
39298
38813
  b = this.consume(Number8);
39299
38814
  } else if (this.tokenType === Ident && this.cmpChar(this.tokenStart, HYPHENMINUS5)) {
39300
38815
  a = "-1";
39301
- expectCharCode.call(this, 1, N6);
38816
+ expectCharCode.call(this, 1, N5);
39302
38817
  switch (this.tokenEnd - this.tokenStart) {
39303
38818
  case 2:
39304
38819
  this.next();
@@ -39324,7 +38839,7 @@ function parse2() {
39324
38839
  sign = 1;
39325
38840
  this.next();
39326
38841
  }
39327
- expectCharCode.call(this, 0, N6);
38842
+ expectCharCode.call(this, 0, N5);
39328
38843
  switch (this.tokenEnd - this.tokenStart) {
39329
38844
  case 1:
39330
38845
  this.next();
@@ -39355,7 +38870,7 @@ function parse2() {
39355
38870
  if (i === this.tokenStart + sign) {
39356
38871
  this.error("Integer is expected", this.tokenStart + sign);
39357
38872
  }
39358
- expectCharCode.call(this, i - this.tokenStart, N6);
38873
+ expectCharCode.call(this, i - this.tokenStart, N5);
39359
38874
  a = this.substring(start, i);
39360
38875
  if (i + 1 === this.tokenEnd) {
39361
38876
  this.next();
@@ -41802,7 +41317,7 @@ var ASTERISK6 = 42;
41802
41317
  var PLUSSIGN9 = 43;
41803
41318
  var HYPHENMINUS7 = 45;
41804
41319
  var SOLIDUS7 = 47;
41805
- var U3 = 117;
41320
+ var U2 = 117;
41806
41321
  function defaultRecognizer(context) {
41807
41322
  switch (this.tokenType) {
41808
41323
  case Hash:
@@ -41826,7 +41341,7 @@ function defaultRecognizer(context) {
41826
41341
  case Url:
41827
41342
  return this.Url();
41828
41343
  case Ident:
41829
- if (this.cmpChar(this.tokenStart, U3) && this.cmpChar(this.tokenStart + 1, PLUSSIGN9)) {
41344
+ if (this.cmpChar(this.tokenStart, U2) && this.cmpChar(this.tokenStart + 1, PLUSSIGN9)) {
41830
41345
  return this.UnicodeRange();
41831
41346
  } else {
41832
41347
  return this.Identifier();
@@ -42350,7 +41865,446 @@ var {
42350
41865
  fork
42351
41866
  } = syntax_default;
42352
41867
 
42353
- // ../markup/dist/theme-css-hFqcPSar.js
41868
+ // ../../node_modules/.bun/better-result@3.0.1/node_modules/better-result/dist/index.mjs
41869
+ function e(e, t) {
41870
+ return e === 2 ? (...e) => e.length >= 2 ? t(e[0], e[1]) : (n) => t(n, e[0]) : e === 3 ? (...e) => e.length >= 3 ? t(e[0], e[1], e[2]) : (n) => t(n, e[0], e[1]) : e === 4 ? (...e) => e.length >= 4 ? t(e[0], e[1], e[2], e[3]) : (n) => t(n, e[0], e[1], e[2]) : (...n) => n.length >= e ? t(...n) : (e) => t(e, ...n);
41871
+ }
41872
+ var t = (e) => e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
41873
+ var n = class e extends Error {
41874
+ _tag = `Panic`;
41875
+ static is(t) {
41876
+ return t instanceof e;
41877
+ }
41878
+ constructor(e) {
41879
+ if (super(e.message, e.cause === undefined ? undefined : { cause: e.cause }), Object.assign(this, e), Object.setPrototypeOf(this, new.target.prototype), this.name = `Panic`, e.cause instanceof Error && e.cause.stack) {
41880
+ let t = e.cause.stack.replace(/\n/g, `
41881
+ `);
41882
+ this.stack = `${this.stack}
41883
+ Caused by: ${t}`;
41884
+ }
41885
+ }
41886
+ toJSON() {
41887
+ return { ...this, _tag: this._tag, name: this.name, message: this.message, cause: t(this.cause), stack: this.stack };
41888
+ }
41889
+ *[Symbol.iterator]() {
41890
+ return yield* d(this), i(`Unreachable: Err yielded in Panic but generator continued`, this);
41891
+ }
41892
+ };
41893
+ var i = (e, t) => {
41894
+ throw new n({ message: e, cause: t });
41895
+ };
41896
+ var a = (e, t) => {
41897
+ try {
41898
+ return e();
41899
+ } catch (e) {
41900
+ throw i(t, e);
41901
+ }
41902
+ };
41903
+ var o = async (e, t) => {
41904
+ try {
41905
+ return await e();
41906
+ } catch (e) {
41907
+ throw i(t, e);
41908
+ }
41909
+ };
41910
+ var s = class e {
41911
+ status = `ok`;
41912
+ constructor(e) {
41913
+ this.value = e;
41914
+ }
41915
+ isOk() {
41916
+ return true;
41917
+ }
41918
+ isErr() {
41919
+ return false;
41920
+ }
41921
+ map(t) {
41922
+ return a(() => new e(t(this.value)), `map callback threw`);
41923
+ }
41924
+ mapError(e) {
41925
+ return this;
41926
+ }
41927
+ tryRecover(e) {
41928
+ return this;
41929
+ }
41930
+ tryRecoverAsync(e) {
41931
+ return Promise.resolve(this);
41932
+ }
41933
+ andThen(e) {
41934
+ return a(() => e(this.value), `andThen callback threw`);
41935
+ }
41936
+ andThenAsync(e) {
41937
+ return o(() => e(this.value), `andThenAsync callback threw`);
41938
+ }
41939
+ match(e) {
41940
+ return a(() => e.ok(this.value), `match ok handler threw`);
41941
+ }
41942
+ unwrap(e) {
41943
+ return this.value;
41944
+ }
41945
+ unwrapOr(e) {
41946
+ return this.value;
41947
+ }
41948
+ tap(e) {
41949
+ return a(() => (e(this.value), this), `tap callback threw`);
41950
+ }
41951
+ tapAsync(e) {
41952
+ return o(async () => (await e(this.value), this), `tapAsync callback threw`);
41953
+ }
41954
+ tapError(e) {
41955
+ return this;
41956
+ }
41957
+ tapErrorAsync(e) {
41958
+ return Promise.resolve(this);
41959
+ }
41960
+ tapBoth(e) {
41961
+ return a(() => (e.ok(this.value), this), `tapBoth ok callback threw`);
41962
+ }
41963
+ tapBothAsync(e) {
41964
+ return o(async () => (await e.ok(this.value), this), `tapBothAsync ok callback threw`);
41965
+ }
41966
+ *[Symbol.iterator]() {
41967
+ return this.value;
41968
+ }
41969
+ };
41970
+ var c = class e {
41971
+ status = `error`;
41972
+ constructor(e) {
41973
+ this.error = e;
41974
+ }
41975
+ isOk() {
41976
+ return false;
41977
+ }
41978
+ isErr() {
41979
+ return true;
41980
+ }
41981
+ map(e) {
41982
+ return this;
41983
+ }
41984
+ mapError(t) {
41985
+ return a(() => new e(t(this.error)), `mapError callback threw`);
41986
+ }
41987
+ tryRecover(e) {
41988
+ return a(() => e(this.error), `tryRecover callback threw`);
41989
+ }
41990
+ tryRecoverAsync(e) {
41991
+ return o(() => e(this.error), `tryRecoverAsync callback threw`);
41992
+ }
41993
+ andThen(e) {
41994
+ return this;
41995
+ }
41996
+ andThenAsync(e) {
41997
+ return Promise.resolve(this);
41998
+ }
41999
+ match(e) {
42000
+ return a(() => e.err(this.error), `match err handler threw`);
42001
+ }
42002
+ unwrap(e) {
42003
+ return i(e ?? `Unwrap called on Err: ${String(this.error)}`, this.error);
42004
+ }
42005
+ unwrapOr(e) {
42006
+ return e;
42007
+ }
42008
+ tap(e) {
42009
+ return this;
42010
+ }
42011
+ tapError(e) {
42012
+ return a(() => (e(this.error), this), `tapError callback threw`);
42013
+ }
42014
+ tapAsync(e) {
42015
+ return Promise.resolve(this);
42016
+ }
42017
+ tapErrorAsync(e) {
42018
+ return o(async () => (await e(this.error), this), `tapErrorAsync callback threw`);
42019
+ }
42020
+ tapBoth(e) {
42021
+ return a(() => (e.err(this.error), this), `tapBoth err callback threw`);
42022
+ }
42023
+ tapBothAsync(e) {
42024
+ return o(async () => (await e.err(this.error), this), `tapBothAsync err callback threw`);
42025
+ }
42026
+ *[Symbol.iterator]() {
42027
+ return yield this, i(`Unreachable: Err yielded in Result.gen but generator continued`, this.error);
42028
+ }
42029
+ };
42030
+ function l(e) {
42031
+ return new s(e);
42032
+ }
42033
+ var u = (e) => e.status === `ok`;
42034
+ var d = (e) => new c(e);
42035
+ var f = (e) => e.status === `error`;
42036
+ var p = (e) => e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
42037
+ var m = (e) => e instanceof Error && (`_tag` in e) && typeof e._tag == `string` && (`toJSON` in e) && typeof e.toJSON == `function`;
42038
+ var h = (e) => {
42039
+
42040
+ class t extends Error {
42041
+ _tag = e;
42042
+ constructor(t) {
42043
+ let n = t && `message` in t && typeof t.message == `string` ? t.message : undefined, r = t && `cause` in t ? t.cause : undefined;
42044
+ if (super(n, r === undefined ? undefined : { cause: r }), t && Object.assign(this, t), Object.setPrototypeOf(this, new.target.prototype), this.name = e, r instanceof Error && r.stack) {
42045
+ let e2 = r.stack.replace(/\n/g, `
42046
+ `);
42047
+ this.stack = `${this.stack}
42048
+ Caused by: ${e2}`;
42049
+ }
42050
+ }
42051
+ toJSON() {
42052
+ return { ...this, _tag: this._tag, name: this.name, message: this.message, cause: p(this.cause), stack: this.stack };
42053
+ }
42054
+ match(e2) {
42055
+ return g(this, e2);
42056
+ }
42057
+ *[Symbol.iterator]() {
42058
+ return yield* d(this), i(`Unreachable: Err yielded in TaggedError but generator continued`, this);
42059
+ }
42060
+ static is(e2) {
42061
+ return e2 instanceof this;
42062
+ }
42063
+ }
42064
+ return t;
42065
+ };
42066
+ h.is = m;
42067
+ var g = e(2, (e, t) => {
42068
+ let n = t[e._tag];
42069
+ try {
42070
+ return n(e);
42071
+ } catch (e) {
42072
+ return i(`matchError handler threw`, e);
42073
+ }
42074
+ });
42075
+ var x = class extends h(`UnhandledException`) {
42076
+ constructor(e) {
42077
+ let t = e.cause instanceof Error ? `Unhandled exception: ${e.cause.message}` : `Unhandled exception: ${String(e.cause)}`;
42078
+ super({ message: t, cause: e.cause });
42079
+ }
42080
+ };
42081
+ var S = class extends h(`ResultDeserializationError`) {
42082
+ constructor(e) {
42083
+ super({ message: e.issues ? `Failed to deserialize Result payload` : `Failed to deserialize value as Result: expected { status: "ok", value } or { status: "error", error }`, value: e.value, issues: e.issues });
42084
+ }
42085
+ };
42086
+ var C = class extends h(`ResultSerializationError`) {
42087
+ constructor(e) {
42088
+ super({ message: `Failed to serialize Result payload`, value: e.value, issues: e.issues });
42089
+ }
42090
+ };
42091
+ var w = (e, t) => {
42092
+ try {
42093
+ return e();
42094
+ } catch (e) {
42095
+ throw i(t, e);
42096
+ }
42097
+ };
42098
+ var T = (e, t) => {
42099
+ let n = (t) => {
42100
+ if (typeof e == `function`)
42101
+ try {
42102
+ return l(e(t));
42103
+ } catch (e) {
42104
+ return d(new x({ cause: e }));
42105
+ }
42106
+ try {
42107
+ return l(e.try(t));
42108
+ } catch (t) {
42109
+ try {
42110
+ return d(e.catch(t));
42111
+ } catch (e) {
42112
+ throw i(`Result.try catch handler threw`, e);
42113
+ }
42114
+ }
42115
+ }, r = t?.retry?.times ?? 0, a = 1, o = n({ attempt: a });
42116
+ for (let e = 0;e < r && o.status === `error`; e++)
42117
+ a++, o = n({ attempt: a });
42118
+ return o;
42119
+ };
42120
+ var E = async (e, t) => {
42121
+ let n = async (t) => {
42122
+ if (typeof e == `function`)
42123
+ try {
42124
+ return l(await e(t));
42125
+ } catch (e) {
42126
+ return d(new x({ cause: e }));
42127
+ }
42128
+ try {
42129
+ return l(await e.try(t));
42130
+ } catch (t) {
42131
+ try {
42132
+ return d(await e.catch(t));
42133
+ } catch (e) {
42134
+ throw i(`Result.tryPromise catch handler threw`, e);
42135
+ }
42136
+ }
42137
+ }, r = t?.retry;
42138
+ if (!r)
42139
+ return n({ attempt: 1, signal: t?.signal });
42140
+ let a = (e, t, n) => {
42141
+ switch (t) {
42142
+ case `constant`:
42143
+ return e;
42144
+ case `linear`:
42145
+ return e * (n + 1);
42146
+ case `exponential`:
42147
+ return e * 2 ** n;
42148
+ }
42149
+ }, o = r.jitter ?? false;
42150
+ if (typeof o == `number` && (!Number.isFinite(o) || o < 0 || o > 1))
42151
+ throw i(`Result.tryPromise retry jitter must be a finite number between 0 and 1`);
42152
+ let s = o === true ? 1 : o === false ? 0 : o, c = (e) => s === 0 ? e : e * (1 - s + Math.random() * s), u = (e, t) => new Promise((n) => {
42153
+ if (t?.aborted) {
42154
+ n(false);
42155
+ return;
42156
+ }
42157
+ let r = () => {
42158
+ clearTimeout(i), n(false);
42159
+ }, i = setTimeout(() => {
42160
+ t?.removeEventListener(`abort`, r), n(true);
42161
+ }, e);
42162
+ t?.addEventListener(`abort`, r, { once: true });
42163
+ }), f = { attempt: 1, signal: t.signal }, p = await n(f), m = r.shouldRetry ?? (() => true);
42164
+ for (let e = 0;e < r.times && !(p.status !== `error` || f.signal?.aborted); e++) {
42165
+ let o = p.error;
42166
+ if (!w(() => m(o, f), `shouldRetry predicate threw`))
42167
+ break;
42168
+ let s;
42169
+ if (typeof r.delayMs == `function`) {
42170
+ let e = r.delayMs;
42171
+ s = w(() => e(o, f), `Result.tryPromise delayMs callback threw`);
42172
+ } else {
42173
+ if (r.backoff === undefined)
42174
+ throw i(`Result.tryPromise static retry delay requires backoff`);
42175
+ s = c(a(r.delayMs, r.backoff, e));
42176
+ }
42177
+ if (!await u(s, f.signal) || f.signal?.aborted)
42178
+ break;
42179
+ f = { attempt: f.attempt + 1, signal: t.signal }, p = await n(f);
42180
+ }
42181
+ return p;
42182
+ };
42183
+ var D = e(2, (e, t) => e.map(t));
42184
+ var O = e(2, (e, t) => e.mapError(t));
42185
+ var k = e(2, (e, t) => e.tryRecover(t));
42186
+ var A = e(2, (e, t) => e.andThen(t));
42187
+ var ee = e(2, (e, t) => e.tryRecoverAsync(t));
42188
+ var te = e(2, (e, t) => e.andThenAsync(t));
42189
+ var ne = e(2, (e, t) => e.match(t));
42190
+ var j = e(2, (e, t) => e.tap(t));
42191
+ var M = e(2, (e, t) => e.tapAsync(t));
42192
+ var N6 = e(2, (e, t) => e.tapError(t));
42193
+ var P = e(2, (e, t) => e.tapErrorAsync(t));
42194
+ var F4 = e(2, (e, t) => e.tapBoth(t));
42195
+ var I = e(2, (e, t) => e.tapBothAsync(t));
42196
+ var L = (e, t) => e.unwrap(t);
42197
+ function R4(e) {
42198
+ if (!(typeof e == `object` && e && (`status` in e) && (e.status === `ok` || e.status === `error`)))
42199
+ return i(`Result.gen body must return Result.ok() or Result.err(), got: ` + (e === null ? `null` : typeof e == `object` ? JSON.stringify(e) : String(e)));
42200
+ }
42201
+ var z = e(2, (e, t) => e.unwrapOr(t));
42202
+ var B = (e, t) => {
42203
+ let n = e.call(t);
42204
+ if (Symbol.asyncIterator in n)
42205
+ return (async () => {
42206
+ let e = n, t;
42207
+ try {
42208
+ t = await e.next();
42209
+ } catch (e) {
42210
+ throw i(`generator body threw`, e);
42211
+ }
42212
+ if (R4(t.value), !t.done)
42213
+ try {
42214
+ await e.return?.(undefined);
42215
+ } catch (e) {
42216
+ throw i(`generator cleanup threw`, e);
42217
+ }
42218
+ return t.value;
42219
+ })();
42220
+ let r = n, a;
42221
+ try {
42222
+ a = r.next();
42223
+ } catch (e) {
42224
+ throw i(`generator body threw`, e);
42225
+ }
42226
+ if (R4(a.value), !a.done)
42227
+ try {
42228
+ r.return?.(undefined);
42229
+ } catch (e) {
42230
+ throw i(`generator cleanup threw`, e);
42231
+ }
42232
+ return a.value;
42233
+ };
42234
+ async function* V(e) {
42235
+ return yield* await e;
42236
+ }
42237
+ function H(e) {
42238
+ return typeof e == `object` && !!e && `status` in e && (e.status === `ok` || e.status === `error`);
42239
+ }
42240
+ var U3 = (e) => typeof e == `object` && !!e && (`then` in e) && typeof e.then == `function`;
42241
+ var W = (e, t) => w(e, t);
42242
+ var G = (e, t, n) => U3(e) ? Promise.resolve(e).catch((e) => {
42243
+ throw i(t, e);
42244
+ }).then(n) : n(e);
42245
+ var K = (e, t) => (`issues` in e) && e.issues ? d(t(e.issues)) : l(e.value);
42246
+ var q = (e, t) => G(W(() => e[`~standard`].validate(t), `Result.codec serialize schema threw`), `Result.codec serialize schema threw`, (e) => K(e, (e) => new C({ value: t, issues: e })));
42247
+ var J = (e, t) => G(W(() => e[`~standard`].validate(t), `Result.codec deserialize schema threw`), `Result.codec deserialize schema threw`, (e) => K(e, (e) => new S({ value: t, issues: e })));
42248
+ var Y = (e, t) => U3(e) ? Promise.resolve(e).then((e) => e.unwrap(t)) : e.unwrap(t);
42249
+ var X = (e) => {
42250
+ let t = (e) => e.status === `ok` ? l(e.value) : S.is(e.error) ? e.unwrap(`Result.codec deserializeUnsafe failed`) : d(e.error);
42251
+ return U3(e) ? Promise.resolve(e).then(t) : t(e);
42252
+ };
42253
+ var re = (e) => {
42254
+ let t = (e) => e.status === `error` ? d(e.error) : l({ status: `ok`, value: e.value }), n = (e) => e.status === `error` ? d(e.error) : l({ status: `error`, error: e.value });
42255
+ function r(r) {
42256
+ if (r.status === `ok`) {
42257
+ let n = q(e.serialize.ok, r.value);
42258
+ return U3(n) ? Promise.resolve(n).then(t) : t(n);
42259
+ }
42260
+ let i = q(e.serialize.err, r.error);
42261
+ return U3(i) ? Promise.resolve(i).then(n) : n(i);
42262
+ }
42263
+ let i = (e) => e.status === `error` ? d(e.error) : l(e.value), a = (e) => e.status === `error` ? d(e.error) : d(e.value);
42264
+ function o(t) {
42265
+ if (!H(t))
42266
+ return d(new S({ value: t }));
42267
+ if (t.status === `ok`) {
42268
+ let n = J(e.deserialize.ok, t.value);
42269
+ return U3(n) ? Promise.resolve(n).then(i) : i(n);
42270
+ }
42271
+ let n = J(e.deserialize.err, t.error);
42272
+ return U3(n) ? Promise.resolve(n).then(a) : a(n);
42273
+ }
42274
+ function s(e) {
42275
+ return Y(r(e), `Result.codec serializeUnsafe failed`);
42276
+ }
42277
+ function c(e) {
42278
+ return X(o(e));
42279
+ }
42280
+ return { serialize: r, serializeUnsafe: s, deserialize: o, deserializeUnsafe: c };
42281
+ };
42282
+ var Z = async (e, t) => {
42283
+ try {
42284
+ return await Promise.all(e);
42285
+ } catch (e) {
42286
+ return i(t, e);
42287
+ }
42288
+ };
42289
+ var Q = (e) => {
42290
+ let t = [];
42291
+ for (let n of e) {
42292
+ if (n.status === `error`)
42293
+ return n;
42294
+ t.push(n.value);
42295
+ }
42296
+ return l(t);
42297
+ };
42298
+ var ie = async (e) => Q(await Z(e, `Result.allAsync input promise rejected`));
42299
+ var $ = (e) => {
42300
+ let t = [], n = [];
42301
+ for (let r of e)
42302
+ r.status === `ok` ? t.push(r.value) : n.push(r.error);
42303
+ return [t, n];
42304
+ };
42305
+ var ae = { ok: l, isOk: u, err: d, isError: f, try: T, tryPromise: E, map: D, mapError: O, tryRecover: k, andThen: A, tryRecoverAsync: ee, andThenAsync: te, match: ne, tap: j, tapAsync: M, tapError: N6, tapErrorAsync: P, tapBoth: F4, tapBothAsync: I, unwrap: L, unwrapOr: z, gen: B, await: V, codec: re, all: Q, allAsync: ie, partition: $, partitionAsync: async (e) => $(await Z(e, `Result.partitionAsync input promise rejected`)), flatten: (e) => e.status === `ok` ? e.value : e };
42306
+
42307
+ // ../markup/dist/theme-css-JtRCm1fb.js
42354
42308
  var BRAND_NAMESPACES = [
42355
42309
  "--color-",
42356
42310
  "--font-",
@@ -42543,6 +42497,429 @@ var parseBrandCss = (css) => {
42543
42497
  fontFaces
42544
42498
  });
42545
42499
  };
42500
+ // ../markup/dist/diagnostic-model-DJtqbETd.js
42501
+ var buildLineMap = (source) => {
42502
+ const lineStarts = [0];
42503
+ for (let index = 0;index < source.length; index++) {
42504
+ const code = source.charCodeAt(index);
42505
+ if (code === 10 || code === 13 && source.charCodeAt(index + 1) !== 10 || code === 8232 || code === 8233)
42506
+ lineStarts.push(index + 1);
42507
+ }
42508
+ return lineStarts;
42509
+ };
42510
+ var lineColumn = (lineMap, offset) => {
42511
+ let low = 0;
42512
+ let high = lineMap.length - 1;
42513
+ while (low < high) {
42514
+ const middle = low + high + 1 >> 1;
42515
+ if (lineMap[middle] <= offset)
42516
+ low = middle;
42517
+ else
42518
+ high = middle - 1;
42519
+ }
42520
+ return {
42521
+ line: low + 1,
42522
+ column: offset - lineMap[low] + 1
42523
+ };
42524
+ };
42525
+
42526
+ // ../markup/dist/diagnostics.js
42527
+ var codes = (table) => table;
42528
+ var DIAGNOSTIC_CODES = codes({
42529
+ "no-template": {
42530
+ summary: "The entry does not default-export a template.",
42531
+ fix: "Default-export defineTemplate({ ... }) imported from @samva/markup."
42532
+ },
42533
+ "legacy-definition": {
42534
+ summary: "The entry default-exports something other than defineTemplate.",
42535
+ fix: 'Import { defineTemplate } from "@samva/markup" and default-export defineTemplate({ ... }).',
42536
+ upgrade: [
42537
+ 'Read the entry and its imports without executing them. For a default-exported defineEmail definition, import defineTemplate from "@samva/markup" and replace the definition call.',
42538
+ "Preserve the entry path, template id, schema, named fixtures, content, design, bindings, conditions, project partials, assets, theme and brand imports. Replace render(input) returning { subject, preheader?, body } with email: { subject: (input) => ..., preheader: (input) => ..., body: (input) => ... }, retaining its parameter bindings and each returned expression; omit preheader when absent.",
42539
+ "Inline module constants only when they are literal strings, numbers or booleans and their bindings are unambiguous; never substitute a fixture value for an input binding. Keep each channel function a single static-profile expression, and keep subject and preheader off <Email>.",
42540
+ "Helper calls, `Math.*`, general arithmetic, render statements, spreads, computed properties and runtime clock or seed have no direct conversion. Rewrite with static-profile bindings, conditions, .map, .filter, project partials or `fmt.*` where equivalent; arithmetic is allowed only in formatter arguments and conditions. Otherwise compute the value in the sender, declare a payload field in the schema and every fixture, and explain the required sender change. Never guess time, randomness or computed data.",
42541
+ "Explicit text has no email-channel field: plain text is derived from the body. If deriving it changes intended content, or another construct cannot be preserved, explain the tradeoff and ask rather than silently discard it. Do not drop fixtures, weaken validation or hide diagnostics.",
42542
+ "Convert every affected entry in the project at its existing path, including emails/ entries. Compile each entry, render every declared fixture and inspect the affected output. Resolve errors before requesting one saved version for the whole project, approved by the user; do not publish."
42543
+ ].join(`
42544
+
42545
+ `)
42546
+ },
42547
+ "dynamic-definition": {
42548
+ summary: "A definition field is spread or computed instead of written out.",
42549
+ fix: "Write each field as name: value."
42550
+ },
42551
+ "invalid-template-id": {
42552
+ summary: "The template id is not a lowercase kebab-case string literal.",
42553
+ fix: 'Write id: "order-shipped".'
42554
+ },
42555
+ "missing-schema": {
42556
+ summary: "The template declares no input schema.",
42557
+ fix: "Add schema: jsonSchema<Input>({ ... })."
42558
+ },
42559
+ "schema-not-static": {
42560
+ summary: "The schema cannot be read without running code.",
42561
+ fix: "Write the schema as a literal jsonSchema<Input>({ type: 'object', ... })."
42562
+ },
42563
+ "invalid-schema": {
42564
+ summary: "The schema uses JSON Schema keywords the compiler cannot validate against.",
42565
+ fix: "Use only the JSON Schema keywords the package README lists."
42566
+ },
42567
+ "missing-fixtures": {
42568
+ summary: "The template declares no fixtures.",
42569
+ fix: "Add fixtures: { default: { ... } } with at least one valid payload."
42570
+ },
42571
+ "fixtures-not-static": {
42572
+ summary: "A fixture is computed instead of written as data.",
42573
+ fix: "Write each fixture as a literal object; an imported asset is allowed."
42574
+ },
42575
+ "invalid-fixture-name": {
42576
+ summary: "A fixture key is not a single path segment.",
42577
+ fix: "Use letters, digits, '.', '_' and '-', starting with a letter or digit."
42578
+ },
42579
+ "fixture-invalid": {
42580
+ summary: "A fixture does not match the schema.",
42581
+ fix: "Change the fixture, or the schema, so every fixture is a payload a send could carry."
42582
+ },
42583
+ "invalid-locale": {
42584
+ summary: "The template's default locale is not a string literal.",
42585
+ fix: 'Write locale: "en-US".'
42586
+ },
42587
+ "no-channel": {
42588
+ summary: "The template declares no channel body.",
42589
+ fix: "Add an email body."
42590
+ },
42591
+ "invalid-channel": {
42592
+ summary: "A channel field is not shaped as the channel requires.",
42593
+ fix: "Write email: { subject, preheader?, body } with each a function of the input."
42594
+ },
42595
+ "not-a-function": {
42596
+ summary: "A channel field is not a function of the input.",
42597
+ fix: "Write (input) => ... in place or declare the function in the project."
42598
+ },
42599
+ "missing-subject": {
42600
+ summary: "The email channel has no subject.",
42601
+ fix: "Add subject: (input) => ...."
42602
+ },
42603
+ "missing-body": {
42604
+ summary: "The email channel has no body.",
42605
+ fix: "Add body: (input) => (<Email>...</Email>)."
42606
+ },
42607
+ "multiple-roots": {
42608
+ summary: "The body renders nothing or more than one root.",
42609
+ fix: "Wrap the body in a single element such as <Email>."
42610
+ },
42611
+ "preheader-without-shell": {
42612
+ summary: "A preheader is set but the body has no <Email> shell to hold it.",
42613
+ fix: "Wrap the body in <Email>."
42614
+ },
42615
+ "wrong-channel": {
42616
+ summary: "A channel body does not return its own channel component.",
42617
+ fix: "Return one element imported from the channel package.",
42618
+ channelOnly: true
42619
+ },
42620
+ "syntax-error": {
42621
+ summary: "A project file does not parse as TSX.",
42622
+ fix: "Fix the syntax at the reported location."
42623
+ },
42624
+ "non-project-import": {
42625
+ summary: "The file imports something other than @samva/markup or a project file.",
42626
+ fix: "Remove the import, or copy the code you need into a project file."
42627
+ },
42628
+ "moved-import": {
42629
+ summary: "The file imports an @samva/markup entry that moved.",
42630
+ fix: 'Import email components from "@samva/markup/email".',
42631
+ upgrade: ['Replace every import from "@samva/markup/email/components" with "@samva/markup/email" in every project file, templates and partials alike. The imported names are unchanged; change only the specifier.', "Compile each entry and render every declared fixture to confirm the output is unchanged. Resolve errors before requesting one saved version for the whole project, approved by the user; do not publish."].join(`
42632
+
42633
+ `)
42634
+ },
42635
+ "unresolved-import": {
42636
+ summary: "An import names no file in the project.",
42637
+ fix: "Check the path and the file extension."
42638
+ },
42639
+ "recursive-partial": {
42640
+ summary: "A partial renders itself; partials are inlined at compile time.",
42641
+ fix: "Flatten the recursion, or repeat the structure with .map."
42642
+ },
42643
+ "nesting-limit": {
42644
+ summary: "The template nests deeper than the compiler reads.",
42645
+ fix: "Flatten the structure."
42646
+ },
42647
+ "dynamic-expression": {
42648
+ summary: "An expression outside the static profile: a call other than fmt.* and .map, a computed value, or a spread.",
42649
+ fix: "Compute the value where the message is sent and bind it from the payload."
42650
+ },
42651
+ "statement-in-body": {
42652
+ summary: "A body contains a statement (const, if, a loop); a body is one expression.",
42653
+ fix: "Use cond && <X />, cond ? <A /> : <B /> and .map, or send the computed value in the payload."
42654
+ },
42655
+ "unsupported-pattern": {
42656
+ summary: "A parameter pattern or default value the profile cannot bind.",
42657
+ fix: "Use plain names or destructuring without defaults; declare the field required or guard it."
42658
+ },
42659
+ "hook-call": {
42660
+ summary: "A hook was called; templates have no state, effects or context.",
42661
+ fix: "Read the input through the function's parameter and send anything else in the payload."
42662
+ },
42663
+ "unknown-formatter": {
42664
+ summary: "fmt.<name> is not a formatter.",
42665
+ fix: "Use fmt.money, number, date, time, plural or list."
42666
+ },
42667
+ "formatter-arguments": {
42668
+ summary: "A formatter got the wrong number of arguments.",
42669
+ fix: "Match the formatter's signature in the contract."
42670
+ },
42671
+ "reserved-character": {
42672
+ summary: "Text contains a private-use character the compiler reserves.",
42673
+ fix: "Remove the characters U+E000 to U+E003."
42674
+ },
42675
+ "reserved-url": {
42676
+ summary: "A URL is the unsubscribe placeholder only BrandFooter can write.",
42677
+ fix: "Render <BrandFooter /> instead."
42678
+ },
42679
+ "reserved-attribute": {
42680
+ summary: "An attribute is written only by a brand component.",
42681
+ fix: "Render BrandFooter from samva:brand instead of marking an element as the footer."
42682
+ },
42683
+ "dynamic-class": {
42684
+ summary: "A class name is built at run time, and Tailwind cannot see it.",
42685
+ fix: 'Write classes literally, or choose between literal lists: input.vip ? "bg-amber-100" : "bg-white".'
42686
+ },
42687
+ "too-many-class-variants": {
42688
+ summary: "A class list chooses between more literal lists than the compiler resolves.",
42689
+ fix: "Split the choice into fewer conditions, or move part of it to a partial."
42690
+ },
42691
+ "invalid-style": {
42692
+ summary: "A style prop is not a static property object.",
42693
+ fix: 'Write style={{ backgroundColor: "#fff" }} with literal values, or use classes.'
42694
+ },
42695
+ "unknown-field": {
42696
+ summary: "A binding names a field the schema does not declare.",
42697
+ fix: "Add the field to the schema, or bind a field it declares (the message suggests the nearest)."
42698
+ },
42699
+ "unguarded-optional": {
42700
+ summary: "An optional field is read outside a guard, so a send without it would render a blank.",
42701
+ fix: "Guard it with {input.field && ...}, or make the field required."
42702
+ },
42703
+ "invalid-binding-type": {
42704
+ summary: "A binding has the wrong type for where it is used.",
42705
+ fix: "Bind a field of the type the position needs, or send it in that type."
42706
+ },
42707
+ "unknown-component": {
42708
+ summary: "A component the profile cannot read.",
42709
+ fix: "Import components from @samva/markup/email, samva:brand, or the project."
42710
+ },
42711
+ "dynamic-numeric-prop": {
42712
+ summary: "A prop that sizes layout at compile time is not a number literal.",
42713
+ fix: "Write the number literally, for example height={44}."
42714
+ },
42715
+ "button-dynamic-label": {
42716
+ summary: "A Button label is read at render time, so classic Outlook cannot size it.",
42717
+ fix: "Give the button a width: <Button width={200}>."
42718
+ },
42719
+ "invalid-columns-each": {
42720
+ summary: "<Columns each> is not a list from the input.",
42721
+ fix: "Write each={input.items} with a callback returning <Column>."
42722
+ },
42723
+ "invalid-columns-per": {
42724
+ summary: "<Columns per> is not a positive integer literal.",
42725
+ fix: "Write per={2}."
42726
+ },
42727
+ "invalid-button-number": {
42728
+ summary: "A Button size prop is not a finite number.",
42729
+ fix: "Pass a finite number."
42730
+ },
42731
+ "unsupported-element": {
42732
+ summary: "An element outside the supported email vocabulary.",
42733
+ fix: "Use an element from the contract's element table."
42734
+ },
42735
+ "unsupported-attribute": {
42736
+ summary: "An attribute the element does not support.",
42737
+ fix: "Use a supported attribute, or data-* and aria-*."
42738
+ },
42739
+ "missing-attribute": {
42740
+ summary: "An element is missing a required attribute.",
42741
+ fix: "Add the attribute, for example alt on img."
42742
+ },
42743
+ "invalid-attribute-value": {
42744
+ summary: "An attribute value is not a string or number, or contains control characters.",
42745
+ fix: "Pass plain text."
42746
+ },
42747
+ "duplicate-attribute": {
42748
+ summary: "An attribute is written twice.",
42749
+ fix: "Keep one."
42750
+ },
42751
+ "invalid-content": {
42752
+ summary: "An element holds content its content model does not allow.",
42753
+ fix: "Move the child to a parent that accepts it."
42754
+ },
42755
+ "void-element-children": {
42756
+ summary: "A void element has children.",
42757
+ fix: "Remove the children."
42758
+ },
42759
+ "event-handler": {
42760
+ summary: "An event handler; email clients strip scripting.",
42761
+ fix: "Remove the handler; use a link for interaction."
42762
+ },
42763
+ "dangerous-html": {
42764
+ summary: "dangerouslySetInnerHTML; there is no raw-HTML escape hatch.",
42765
+ fix: "Write the markup as JSX."
42766
+ },
42767
+ "unsafe-url": {
42768
+ summary: "A URL uses a scheme email cannot send safely.",
42769
+ fix: "Use an https URL, a mailto: or tel: link, or a bound URL."
42770
+ },
42771
+ "unsafe-raw-text": {
42772
+ summary: "Raw text content contains markup that could end its element.",
42773
+ fix: "Remove the offending sequence."
42774
+ },
42775
+ "unsupported-style-property": {
42776
+ summary: "A style property name is not a CSS property.",
42777
+ fix: "Write camelCase (backgroundColor) or a custom property (--brand)."
42778
+ },
42779
+ "invalid-style-value": {
42780
+ summary: "A style value is not a string or number.",
42781
+ fix: "Pass a string or number."
42782
+ },
42783
+ "unsafe-style-value": {
42784
+ summary: "A style value contains CSS that could break out of its declaration.",
42785
+ fix: "Remove the offending characters."
42786
+ },
42787
+ "missing-head": {
42788
+ summary: "Styles that cannot be inlined need a <head> to live in.",
42789
+ fix: "Wrap the message in <Email>, or write those declarations inline."
42790
+ },
42791
+ "invalid-subject": {
42792
+ summary: "The subject is not one line of text.",
42793
+ fix: "Return a single-line string."
42794
+ },
42795
+ "invalid-preheader": {
42796
+ summary: "The preheader is not a string.",
42797
+ fix: "Return a string."
42798
+ },
42799
+ "invalid-text": {
42800
+ summary: "The plain-text body is not a string.",
42801
+ fix: "Return a string."
42802
+ },
42803
+ "button-outlook-fallback": {
42804
+ summary: "Classic Outlook needs a height and a plain string label to draw the button.",
42805
+ fix: "Give <Button> a height and a string label."
42806
+ },
42807
+ "unmatched-class": {
42808
+ summary: "A class produced no styles.",
42809
+ fix: "Use a class the theme or Tailwind defines, or write the style inline."
42810
+ },
42811
+ "tailwind-dynamic-class": {
42812
+ summary: "A class list is assembled at run time.",
42813
+ fix: "Write the classes literally."
42814
+ },
42815
+ "css-parse-error": {
42816
+ summary: "A stylesheet does not parse.",
42817
+ fix: "Fix the CSS at the reported location."
42818
+ },
42819
+ "css-import-unresolved": {
42820
+ summary: "A stylesheet @import cannot be resolved.",
42821
+ fix: "Import the stylesheet from the template module, or use the theme.css layers."
42822
+ },
42823
+ "css-unsupported-at-rule": {
42824
+ summary: "An at-rule is not applied to email output.",
42825
+ fix: "Remove it or move the declarations into a class rule."
42826
+ },
42827
+ "css-conditional-variable": {
42828
+ summary: "A custom property is redefined inside a conditional at-rule.",
42829
+ fix: "Keep the override on a class rule."
42830
+ },
42831
+ "email-font-fallback": {
42832
+ summary: "A font stack names a project font without a generic fallback.",
42833
+ fix: "End the stack with sans-serif, serif or monospace."
42834
+ },
42835
+ "email-font-family": {
42836
+ summary: "@font-face declares no font-family.",
42837
+ fix: "Add font-family."
42838
+ },
42839
+ "email-font-src": {
42840
+ summary: "@font-face declares no usable url() src.",
42841
+ fix: "Add a url() pointing at a .woff2 file."
42842
+ },
42843
+ "email-font-format": {
42844
+ summary: "@font-face uses a format other than WOFF2.",
42845
+ fix: "Convert the file to .woff2."
42846
+ },
42847
+ "email-font-missing": {
42848
+ summary: "@font-face names a file the project does not hold.",
42849
+ fix: "Add the file; paths resolve from the stylesheet's directory."
42850
+ },
42851
+ "invalid-asset-base": {
42852
+ summary: "The asset base is not an https URL or a path.",
42853
+ fix: "Use an https URL, an absolute path, or a relative path."
42854
+ },
42855
+ "brand-unavailable": {
42856
+ summary: "The build has no brand to resolve a samva:brand import.",
42857
+ fix: "Create or select the brand the import names."
42858
+ },
42859
+ "brand-import-conflict": {
42860
+ summary: "The project imports two different brands.",
42861
+ fix: "Import one brand specifier everywhere."
42862
+ },
42863
+ "caniemail/unknown-coverage": {
42864
+ summary: "A feature has no client-support data.",
42865
+ fix: "Verify it in the target clients."
42866
+ },
42867
+ "invalid-attribute": {
42868
+ summary: "A channel component attribute has a value the channel does not accept.",
42869
+ fix: "Use one of the listed values.",
42870
+ channelOnly: true
42871
+ },
42872
+ "unknown-attribute": {
42873
+ summary: "A channel component attribute the component does not have.",
42874
+ fix: "Use one of the listed attributes.",
42875
+ channelOnly: true
42876
+ },
42877
+ "sms-markup": {
42878
+ summary: "An SMS body contains an element; SMS is plain text.",
42879
+ fix: "Write text and bindings, with a newline for a line break.",
42880
+ channelOnly: true
42881
+ },
42882
+ "whatsapp-structure": {
42883
+ summary: "WhatsApp content sits outside Header, Body, Footer or Buttons.",
42884
+ fix: "Move it into <WhatsApp.Body>.",
42885
+ channelOnly: true
42886
+ },
42887
+ "whatsapp-body-required": {
42888
+ summary: "A WhatsApp template has no body.",
42889
+ fix: "Add <WhatsApp.Body>...</WhatsApp.Body>.",
42890
+ channelOnly: true
42891
+ },
42892
+ "whatsapp-conditional": {
42893
+ summary: "A WhatsApp part branches or contains elements; Meta registers its text once.",
42894
+ fix: "Choose the wording in the payload, or write separate templates.",
42895
+ channelOnly: true
42896
+ },
42897
+ "whatsapp-header-media": {
42898
+ summary: "A WhatsApp media header is not exactly one URL.",
42899
+ fix: "Write the URL as the only child: a literal or one binding.",
42900
+ channelOnly: true
42901
+ },
42902
+ "whatsapp-header-variables": {
42903
+ summary: "A WhatsApp header text takes more than one variable.",
42904
+ fix: "Keep one binding in the header and move the rest to the body.",
42905
+ channelOnly: true
42906
+ },
42907
+ "whatsapp-length": {
42908
+ summary: "A WhatsApp part exceeds Meta's length limit.",
42909
+ fix: "Shorten the text.",
42910
+ channelOnly: true
42911
+ },
42912
+ "whatsapp-button-text": {
42913
+ summary: "A WhatsApp button has no label or value between its tags.",
42914
+ fix: "Write the label or value as text between the tags.",
42915
+ channelOnly: true
42916
+ },
42917
+ "whatsapp-button-limit": {
42918
+ summary: "The conditions can produce more buttons of a kind than Meta allows.",
42919
+ fix: "Remove buttons, or split the template.",
42920
+ channelOnly: true
42921
+ }
42922
+ });
42546
42923
 
42547
42924
  // ../sdk/dist/normalize-B79uJIeb.js
42548
42925
  function toRecipientArray(recipient) {
@@ -42613,8 +42990,8 @@ function buildMessagesSendPayload(input) {
42613
42990
  };
42614
42991
  }
42615
42992
 
42616
- // ../sdk/dist/client-attribution-27MNycCV.js
42617
- var SDK_VERSION = "0.7.0";
42993
+ // ../sdk/dist/client-attribution-vK1yjEdG.js
42994
+ var SDK_VERSION = "0.9.0";
42618
42995
  var CLIENT_ATTRIBUTION_HEADER = "x-samva-client";
42619
42996
  var clientAttribution = (surface) => `${surface}/${SDK_VERSION}`;
42620
42997
  // ../../node_modules/.bun/effect@4.0.0-rc.117/node_modules/effect/dist/ChannelSchema.js
@@ -44938,7 +45315,7 @@ var fetch2 = /* @__PURE__ */ make32((request, url, signal, fiber) => {
44938
45315
  });
44939
45316
  var layer15 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch2));
44940
45317
 
44941
- // ../sdk/dist/client-5O8KsY5Z.js
45318
+ // ../sdk/dist/client-DB7zbTti.js
44942
45319
  var Sensitive = (schema) => RedactedFromValue(schema);
44943
45320
  var SensitiveString = Sensitive(String4);
44944
45321
  var ABSOLUTE_ISO_INSTANT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|([+-])(\d{2}):(\d{2}))$/;
@@ -45083,6 +45460,14 @@ var TemplateId = String4.pipe(brand2("TemplateId")).check(isPattern2(/* @__PURE_
45083
45460
  identifier: "TemplateId"
45084
45461
  }));
45085
45462
  var JsonObject = Record(String4, JsonValue).annotate({ identifier: "JsonObject" });
45463
+ var RenderLocale = String4.check(isMaxLength(64).annotate({
45464
+ expected: "a value with a length of at most 64",
45465
+ identifier: "RenderLocale"
45466
+ }));
45467
+ var RenderTimeZone = String4.check(isMaxLength(64).annotate({
45468
+ expected: "a value with a length of at most 64",
45469
+ identifier: "RenderTimeZone"
45470
+ }));
45086
45471
  var ReplyToAddresses = Union2([Union2([ArraySchema(String4), Null2]), Null2]).annotate({ identifier: "ReplyToAddresses" });
45087
45472
  var UnsubscribeId = String4.pipe(brand2("UnsubscribeId")).check(isPattern2(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$")).annotate({
45088
45473
  expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
@@ -45477,6 +45862,29 @@ var OperationResource = Struct({
45477
45862
  type: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(80).annotate({ expected: "a value with a length of at most 80" })),
45478
45863
  id: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(255).annotate({ expected: "a value with a length of at most 255" }))
45479
45864
  }).annotate({ identifier: "OperationResource" });
45865
+ var Organization = Struct({
45866
+ id: String4,
45867
+ billingAccountId: String4,
45868
+ name: String4,
45869
+ slug: String4,
45870
+ countryCode: String4,
45871
+ timezone: String4,
45872
+ plan: String4,
45873
+ isActive: Boolean3,
45874
+ createdAt: String4,
45875
+ updatedAt: String4,
45876
+ metadata: Union2([Record(String4, JsonValue), Null2]),
45877
+ replyToDefault: Union2([ArraySchema(String4), Null2]),
45878
+ emailFooterEnabledDefault: Union2([Boolean3, Null2]),
45879
+ messagesUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45880
+ messagesUsedThisMonth: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45881
+ emailUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45882
+ emailUsedThisMonth: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45883
+ contactsUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45884
+ conversationsUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45885
+ teamMembersUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45886
+ messagesResetAt: Union2([String4, Null2])
45887
+ }).annotate({ identifier: "Organization" });
45480
45888
  var TemplateProjectId = String4.pipe(brand2("TemplateProjectId")).check(isPattern2(/* @__PURE__ */ new RegExp("^tproj_[0-9a-hjkmnp-tv-z]{16,24}$")).annotate({
45481
45889
  expected: "a string matching the RegExp ^tproj_[0-9a-hjkmnp-tv-z]{16,24}$",
45482
45890
  identifier: "TemplateProjectId"
@@ -45494,6 +45902,10 @@ var TemplatePublicationBrand = Struct({
45494
45902
  digest: String4.annotate({ description: "The brand's digest when the publication was built." }),
45495
45903
  stale: Boolean3.annotate({ description: "Whether the brand has changed since this publication was built. Publishing the same commit again picks up the change." })
45496
45904
  }).annotate({ identifier: "TemplatePublicationBrand" });
45905
+ var BrandFooterBlock = Struct({
45906
+ html: String4,
45907
+ text: String4
45908
+ }).annotate({ identifier: "BrandFooterBlock" });
45497
45909
  var WebhookDeliveryCounts = Struct({
45498
45910
  total: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
45499
45911
  pending: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
@@ -45521,7 +45933,7 @@ var WebhookDailyDeliveries = Struct({
45521
45933
  cancelled: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" }))
45522
45934
  }).annotate({ identifier: "WebhookDailyDeliveries" });
45523
45935
  Struct({
45524
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
45936
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
45525
45937
  name: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(200).annotate({ expected: "a value with a length of at most 200" })),
45526
45938
  slug: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })),
45527
45939
  description: optionalKey2(Union2([Union2([String4, Null2]), Null2])),
@@ -45586,9 +45998,13 @@ var CreateWebhookPayload = Struct({
45586
45998
  "message.bounced",
45587
45999
  "message.complained",
45588
46000
  "message.received",
46001
+ "message.opened",
46002
+ "message.clicked",
45589
46003
  "contact.created",
45590
46004
  "contact.updated",
45591
46005
  "contact.deleted",
46006
+ "contact.unsubscribed",
46007
+ "contact.resubscribed",
45592
46008
  "conversation.created",
45593
46009
  "conversation.updated",
45594
46010
  "conversation.archived",
@@ -45623,9 +46039,13 @@ var UpdateWebhookPayload = Struct({
45623
46039
  "message.bounced",
45624
46040
  "message.complained",
45625
46041
  "message.received",
46042
+ "message.opened",
46043
+ "message.clicked",
45626
46044
  "contact.created",
45627
46045
  "contact.updated",
45628
46046
  "contact.deleted",
46047
+ "contact.unsubscribed",
46048
+ "contact.resubscribed",
45629
46049
  "conversation.created",
45630
46050
  "conversation.updated",
45631
46051
  "conversation.archived",
@@ -45704,30 +46124,6 @@ var CampaignPolicy = Struct({
45704
46124
  unsubscribeGroupId: optionalKey2(Union2([UnsubscribeId, Null2])),
45705
46125
  pageSize: optionalKey2(Union2([Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(100).annotate({ expected: "a value greater than or equal to 100" })).check(isLessThanOrEqualTo3(1000).annotate({ expected: "a value less than or equal to 1000" })), Null2]))
45706
46126
  }).annotate({ identifier: "CampaignPolicy" });
45707
- var Organization = Struct({
45708
- id: String4,
45709
- billingAccountId: String4,
45710
- name: String4,
45711
- slug: String4,
45712
- countryCode: String4,
45713
- timezone: String4,
45714
- plan: String4,
45715
- isActive: Boolean3,
45716
- createdAt: String4,
45717
- updatedAt: String4,
45718
- metadata: Union2([Record(String4, JsonValue), Null2]),
45719
- replyToDefault: Union2([ArraySchema(String4), Null2]),
45720
- defaultUnsubscribeGroupId: Union2([UnsubscribeId, Null2]),
45721
- emailFooterEnabledDefault: Union2([Boolean3, Null2]),
45722
- messagesUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45723
- messagesUsedThisMonth: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45724
- emailUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45725
- emailUsedThisMonth: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45726
- contactsUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45727
- conversationsUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45728
- teamMembersUsed: Finite.check(isFinite4().annotate({ expected: "a finite number" })),
45729
- messagesResetAt: Union2([String4, Null2])
45730
- }).annotate({ identifier: "Organization" });
45731
46127
  var MessageContent = Struct({
45732
46128
  text: optionalKey2(Union2([String4, Null2])),
45733
46129
  html: optionalKey2(Union2([String4, Null2])),
@@ -45888,7 +46284,7 @@ var ActorTracking = Struct({
45888
46284
  actorType: Literals([
45889
46285
  "contact",
45890
46286
  "system",
45891
- "sender_identity",
46287
+ "sender",
45892
46288
  "agent",
45893
46289
  "user"
45894
46290
  ]),
@@ -45910,7 +46306,7 @@ var ConversationParticipant = Struct({
45910
46306
  actorType: Literals([
45911
46307
  "contact",
45912
46308
  "system",
45913
- "sender_identity",
46309
+ "sender",
45914
46310
  "agent",
45915
46311
  "user"
45916
46312
  ]),
@@ -45928,9 +46324,13 @@ var WebhookEndpoint = Struct({
45928
46324
  "message.bounced",
45929
46325
  "message.complained",
45930
46326
  "message.received",
46327
+ "message.opened",
46328
+ "message.clicked",
45931
46329
  "contact.created",
45932
46330
  "contact.updated",
45933
46331
  "contact.deleted",
46332
+ "contact.unsubscribed",
46333
+ "contact.resubscribed",
45934
46334
  "conversation.created",
45935
46335
  "conversation.updated",
45936
46336
  "conversation.archived",
@@ -46259,7 +46659,7 @@ var TemplateFamily = Struct({
46259
46659
  var UpdateTemplatePayload = Struct({ data: Struct({
46260
46660
  name: optionalKey2(Union2([String4, Null2])),
46261
46661
  slug: optionalKey2(Union2([String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })), Null2])),
46262
- entryPath: optionalKey2(Union2([String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })), Null2])),
46662
+ entryPath: optionalKey2(Union2([String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })), Null2])),
46263
46663
  description: optionalKey2(Union2([Union2([String4, Null2]), Null2])),
46264
46664
  category: optionalKey2(Union2([Union2([Literals([
46265
46665
  "transactional",
@@ -46278,7 +46678,7 @@ var Template = Struct({
46278
46678
  id: TemplateId,
46279
46679
  organizationId: OrganizationId,
46280
46680
  projectId: TemplateProjectId,
46281
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
46681
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
46282
46682
  name: String4,
46283
46683
  slug: String4,
46284
46684
  familyId: Union2([TemplateFamilyId, Null2]),
@@ -46310,6 +46710,10 @@ var Template = Struct({
46310
46710
  createdAt: String4,
46311
46711
  updatedAt: String4
46312
46712
  }).annotate({ identifier: "Template" });
46713
+ var BrandRenderedFooter = Struct({
46714
+ withUnsubscribe: BrandFooterBlock,
46715
+ withoutUnsubscribe: BrandFooterBlock
46716
+ }).annotate({ identifier: "BrandRenderedFooter" });
46313
46717
  var WebhookEndpointListItem = Struct({
46314
46718
  id: WebhookEndpointId,
46315
46719
  name: String4,
@@ -46322,9 +46726,13 @@ var WebhookEndpointListItem = Struct({
46322
46726
  "message.bounced",
46323
46727
  "message.complained",
46324
46728
  "message.received",
46729
+ "message.opened",
46730
+ "message.clicked",
46325
46731
  "contact.created",
46326
46732
  "contact.updated",
46327
46733
  "contact.deleted",
46734
+ "contact.unsubscribed",
46735
+ "contact.resubscribed",
46328
46736
  "conversation.created",
46329
46737
  "conversation.updated",
46330
46738
  "conversation.archived",
@@ -47014,6 +47422,8 @@ var EmailContent = Struct({
47014
47422
  templateId: optionalKey2(Union2([TemplateId, Null2])),
47015
47423
  templateSlug: optionalKey2(Union2([String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })), Null2])),
47016
47424
  templateData: optionalKey2(TemplateData),
47425
+ locale: optionalKey2(RenderLocale),
47426
+ timeZone: optionalKey2(RenderTimeZone),
47017
47427
  inReplyToMessageId: optionalKey2(Union2([MessageId, Null2])),
47018
47428
  replyTo: optionalKey2(ReplyToAddresses),
47019
47429
  unsubscribeGroupId: optionalKey2(Union2([UnsubscribeId, Null2])),
@@ -47030,6 +47440,8 @@ var EmailDispatchContent = Struct({
47030
47440
  templateId: optionalKey2(Union2([TemplateId, Null2])),
47031
47441
  templateSlug: optionalKey2(Union2([String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })), Null2])),
47032
47442
  templateData: optionalKey2(TemplateData),
47443
+ locale: optionalKey2(RenderLocale),
47444
+ timeZone: optionalKey2(RenderTimeZone),
47033
47445
  inReplyToMessageId: optionalKey2(Union2([MessageId, Null2])),
47034
47446
  replyTo: optionalKey2(ReplyToAddresses),
47035
47447
  unsubscribeGroupId: optionalKey2(Union2([UnsubscribeId, Null2])),
@@ -49940,7 +50352,6 @@ var OrganizationsUpdateRequestJson = Struct({
49940
50352
  isActive: optionalKey2(Union2([Boolean3, Null2])),
49941
50353
  metadata: optionalKey2(Union2([Record(String4, JsonValue), Null2])),
49942
50354
  replyToDefault: optionalKey2(Union2([Union2([ArraySchema(String4), Null2]), Null2])),
49943
- defaultUnsubscribeGroupId: optionalKey2(Union2([Union2([UnsubscribeId, Null2]), Null2])),
49944
50355
  emailFooterEnabledDefault: optionalKey2(Union2([Union2([Boolean3, Null2]), Null2]))
49945
50356
  });
49946
50357
  var OrganizationsUpdate200 = Organization;
@@ -49950,6 +50361,15 @@ var OrganizationsUpdate404 = ResourceNotFoundError;
49950
50361
  var OrganizationsUpdate422 = ValidationError;
49951
50362
  var OrganizationsUpdate500 = InternalError;
49952
50363
  var OrganizationsUpdate504 = GatewayTimeoutError;
50364
+ var OrganizationsGetProfile200 = Struct({
50365
+ id: String4.annotate({ description: "Opaque identity for your organization membership" }),
50366
+ name: String4.annotate({ description: "Your display name" }),
50367
+ nickname: String4.annotate({ description: "Your display name and organization name" })
50368
+ });
50369
+ var OrganizationsGetProfile401 = UnauthorizedError;
50370
+ var OrganizationsGetProfile403 = ForbiddenError;
50371
+ var OrganizationsGetProfile500 = InternalError;
50372
+ var OrganizationsGetProfile504 = GatewayTimeoutError;
49953
50373
  var OrganizationsDeleteHeaders = Struct({ "idempotency-key": String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(255).annotate({ expected: "a value with a length of at most 255" })) });
49954
50374
  var OrganizationsDeleteRequestJson = Struct({ confirmationName: String4 });
49955
50375
  var OrganizationsDelete202 = OperationAccepted;
@@ -50069,7 +50489,7 @@ var TemplatesUpdatePathParams = Struct({ id: TemplateId });
50069
50489
  var TemplatesUpdateRequestJson = Struct({ data: Struct({
50070
50490
  name: optionalKey2(Union2([String4, Null2])),
50071
50491
  slug: optionalKey2(Union2([String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })), Null2])),
50072
- entryPath: optionalKey2(Union2([String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })), Null2])),
50492
+ entryPath: optionalKey2(Union2([String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })), Null2])),
50073
50493
  description: optionalKey2(Union2([Union2([String4, Null2]), Null2])),
50074
50494
  category: optionalKey2(Union2([Union2([Literals([
50075
50495
  "transactional",
@@ -50129,7 +50549,7 @@ var TemplatesPublishPathParams = Struct({ id: TemplateId });
50129
50549
  var TemplatesPublishRequestJson = Struct({
50130
50550
  projectId: TemplateProjectId,
50131
50551
  commitSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50132
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
50552
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50133
50553
  expectedWorkspaceRevision: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50134
50554
  ifCurrentPublicationId: optionalKey2(Union2([TemplatePublicationId, Null2]))
50135
50555
  });
@@ -50141,30 +50561,20 @@ var TemplatesPublish201 = Struct({
50141
50561
  inputContractId: TemplateInputContractId,
50142
50562
  commitSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50143
50563
  treeSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50144
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
50564
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50145
50565
  buildIdentity: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50146
50566
  manifest: Struct({
50147
50567
  templateKey: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50148
- executable: Struct({
50149
- codeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50568
+ ir: Struct({
50569
+ version: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
50570
+ digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50150
50571
  bytes: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" }))
50151
50572
  }),
50573
+ compiler: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50152
50574
  input: Struct({
50153
50575
  schemaDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50154
50576
  contractDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50155
50577
  }),
50156
- environment: Struct({
50157
- locale: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50158
- timeZone: Literal2("UTC"),
50159
- now: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" }))),
50160
- randomSeed: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })).check(isLessThanOrEqualTo3(4294967295).annotate({ expected: "a value less than or equal to 4294967295" }))),
50161
- compiler: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50162
- runtime: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50163
- checker: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50164
- lockKind: Literals(["bun", "npm"]),
50165
- lockDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50166
- digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50167
- }),
50168
50578
  assets: Struct({
50169
50579
  base: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^https?:\\/\\/")).annotate({ expected: "a string matching the RegExp ^https?:\\/\\/" })),
50170
50580
  entries: ArraySchema(Struct({
@@ -50179,7 +50589,7 @@ var TemplatesPublish201 = Struct({
50179
50589
  source: Struct({
50180
50590
  commitSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50181
50591
  treeSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50182
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
50592
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50183
50593
  treeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50184
50594
  }),
50185
50595
  brand: optionalKey2(Struct({
@@ -50187,6 +50597,7 @@ var TemplatesPublish201 = Struct({
50187
50597
  css: String4,
50188
50598
  assets: BrandAssets,
50189
50599
  footer: BrandFooter,
50600
+ renderedFooter: BrandRenderedFooter,
50190
50601
  digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50191
50602
  rendersFooter: Literals([
50192
50603
  "every",
@@ -50195,7 +50606,7 @@ var TemplatesPublish201 = Struct({
50195
50606
  ])
50196
50607
  }))
50197
50608
  }),
50198
- executable: Struct({
50609
+ ir: Struct({
50199
50610
  key: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50200
50611
  digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50201
50612
  }),
@@ -50295,30 +50706,20 @@ var TemplatesGetPublication200 = Struct({
50295
50706
  inputContractId: TemplateInputContractId,
50296
50707
  commitSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50297
50708
  treeSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50298
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
50709
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50299
50710
  buildIdentity: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50300
50711
  manifest: Struct({
50301
50712
  templateKey: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50302
- executable: Struct({
50303
- codeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50713
+ ir: Struct({
50714
+ version: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
50715
+ digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50304
50716
  bytes: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" }))
50305
50717
  }),
50718
+ compiler: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50306
50719
  input: Struct({
50307
50720
  schemaDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50308
50721
  contractDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50309
50722
  }),
50310
- environment: Struct({
50311
- locale: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50312
- timeZone: Literal2("UTC"),
50313
- now: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" }))),
50314
- randomSeed: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })).check(isLessThanOrEqualTo3(4294967295).annotate({ expected: "a value less than or equal to 4294967295" }))),
50315
- compiler: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50316
- runtime: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50317
- checker: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50318
- lockKind: Literals(["bun", "npm"]),
50319
- lockDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50320
- digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50321
- }),
50322
50723
  assets: Struct({
50323
50724
  base: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^https?:\\/\\/")).annotate({ expected: "a string matching the RegExp ^https?:\\/\\/" })),
50324
50725
  entries: ArraySchema(Struct({
@@ -50333,7 +50734,7 @@ var TemplatesGetPublication200 = Struct({
50333
50734
  source: Struct({
50334
50735
  commitSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50335
50736
  treeSha: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
50336
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
50737
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50337
50738
  treeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50338
50739
  }),
50339
50740
  brand: optionalKey2(Struct({
@@ -50341,6 +50742,7 @@ var TemplatesGetPublication200 = Struct({
50341
50742
  css: String4,
50342
50743
  assets: BrandAssets,
50343
50744
  footer: BrandFooter,
50745
+ renderedFooter: BrandRenderedFooter,
50344
50746
  digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50345
50747
  rendersFooter: Literals([
50346
50748
  "every",
@@ -50349,7 +50751,7 @@ var TemplatesGetPublication200 = Struct({
50349
50751
  ])
50350
50752
  }))
50351
50753
  }),
50352
- executable: Struct({
50754
+ ir: Struct({
50353
50755
  key: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })),
50354
50756
  digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50355
50757
  }),
@@ -50778,7 +51180,7 @@ var TemplatesCheckWorkspaceRequestJson = Struct({ expectedRevision: String4 });
50778
51180
  var TemplatesCheckWorkspace200 = Struct({
50779
51181
  projectId: TemplateProjectId,
50780
51182
  revision: String4,
50781
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
51183
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
50782
51184
  declaration: Union2([Struct({
50783
51185
  codeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50784
51186
  templateId: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })),
@@ -50787,10 +51189,6 @@ var TemplatesCheckWorkspace200 = Struct({
50787
51189
  schemaDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
50788
51190
  contractDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
50789
51191
  }),
50790
- runtime: Struct({
50791
- now: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" }))),
50792
- randomSeed: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })).check(isLessThanOrEqualTo3(4294967295).annotate({ expected: "a value less than or equal to 4294967295" })))
50793
- }),
50794
51192
  fixtures: ArraySchema(String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })))
50795
51193
  }), Null2]),
50796
51194
  diagnostics: ArraySchema(Struct({
@@ -51012,7 +51410,7 @@ var TemplatesRenderWorkspaceFixtureRequestJson = Struct({
51012
51410
  var TemplatesRenderWorkspaceFixture200 = Struct({
51013
51411
  projectId: TemplateProjectId,
51014
51412
  revision: String4,
51015
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
51413
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
51016
51414
  declaration: Union2([Struct({
51017
51415
  codeDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51018
51416
  templateId: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })),
@@ -51021,10 +51419,6 @@ var TemplatesRenderWorkspaceFixture200 = Struct({
51021
51419
  schemaDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51022
51420
  contractDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" }))
51023
51421
  }),
51024
- runtime: Struct({
51025
- now: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" }))),
51026
- randomSeed: optionalKey2(Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })).check(isLessThanOrEqualTo3(4294967295).annotate({ expected: "a value less than or equal to 4294967295" })))
51027
- }),
51028
51422
  fixtures: ArraySchema(String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })))
51029
51423
  }), Null2]),
51030
51424
  diagnostics: ArraySchema(Struct({
@@ -51143,111 +51537,6 @@ var TemplatesWorkspaceHistory404 = ResourceNotFoundError;
51143
51537
  var TemplatesWorkspaceHistory409 = ConflictError;
51144
51538
  var TemplatesWorkspaceHistory500 = InternalError;
51145
51539
  var TemplatesWorkspaceHistory504 = GatewayTimeoutError;
51146
- var TemplatesReconcileWorkspacePathParams = Struct({ id: TemplateId });
51147
- var TemplatesReconcileWorkspaceRequestJson = Struct({
51148
- expectedRevision: String4,
51149
- assetResolution: optionalKey2(Literals(["draft", "remote"])),
51150
- expectedRemoteHead: optionalKey2(String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" }))),
51151
- idempotencyKey: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(255).annotate({ expected: "a value with a length of at most 255" }))
51152
- });
51153
- var TemplatesReconcileWorkspace200 = Struct({
51154
- workspace: Struct({
51155
- projectId: TemplateProjectId,
51156
- organizationId: Union2([OrganizationId, Null2]),
51157
- ownerEpoch: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
51158
- repositoryName: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$")).annotate({ expected: "a string matching the RegExp ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" })),
51159
- defaultBranch: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(255).annotate({ expected: "a value with a length of at most 255" })),
51160
- baseCommit: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
51161
- remoteHead: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })),
51162
- pendingRemoteHead: Union2([String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{40}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{40}$" })), Null2]),
51163
- revision: String4,
51164
- overlay: Record(String4, Union2([String4, Null2])),
51165
- assetChanges: ArraySchema(Struct({
51166
- path: String4,
51167
- status: Literals([
51168
- "added",
51169
- "modified",
51170
- "deleted"
51171
- ])
51172
- })),
51173
- conflicts: ArraySchema(Struct({
51174
- path: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$)).{1,1024}$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$)).{1,1024}$" })),
51175
- base: Union2([String4, Null2]),
51176
- draft: Union2([String4, Null2]),
51177
- main: Union2([String4, Null2])
51178
- })),
51179
- provenance: Struct({ references: ArraySchema(Struct({
51180
- kind: String4,
51181
- digest: String4,
51182
- locator: optionalKey2(String4)
51183
- })) }),
51184
- mounts: ArraySchema(Union2([
51185
- Struct({
51186
- kind: Literal2("project"),
51187
- root: Literal2("/project"),
51188
- access: Literal2("read-write")
51189
- }),
51190
- Struct({
51191
- root: String4.check(isMaxLength(2048).annotate({ expected: "a value with a length of at most 2048" })).check(isPattern2(/* @__PURE__ */ new RegExp("^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$")).annotate({ expected: "a string matching the RegExp ^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$" })),
51192
- digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51193
- fileCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51194
- byteSize: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51195
- kind: Literal2("started-from"),
51196
- access: Literal2("read-only"),
51197
- templateId: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })),
51198
- slug: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^[a-z0-9]+(?:-[a-z0-9]+)*$" })),
51199
- name: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(256).annotate({ expected: "a value with a length of at most 256" }))
51200
- }),
51201
- Struct({
51202
- root: String4.check(isMaxLength(2048).annotate({ expected: "a value with a length of at most 2048" })).check(isPattern2(/* @__PURE__ */ new RegExp("^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$")).annotate({ expected: "a string matching the RegExp ^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$" })),
51203
- digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51204
- fileCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51205
- byteSize: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51206
- kind: Literal2("resource"),
51207
- access: Literal2("read-only"),
51208
- resourceId: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[A-Za-z0-9._-]{1,128}$")).annotate({ expected: "a string matching the RegExp ^[A-Za-z0-9._-]{1,128}$" })),
51209
- name: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(256).annotate({ expected: "a value with a length of at most 256" }))
51210
- }),
51211
- Struct({
51212
- root: String4.check(isMaxLength(2048).annotate({ expected: "a value with a length of at most 2048" })).check(isPattern2(/* @__PURE__ */ new RegExp("^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$")).annotate({ expected: "a string matching the RegExp ^\\/(?:project|references\\/started-from\\/[a-f0-9]{64}|resources\\/[A-Za-z0-9._-]+\\/[a-f0-9]{64}|library\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*\\/[a-f0-9]{64})(?:\\/(?!\\.{1,2}(?:\\/|$)|\\.git(?:\\/|$))[^\\\\/]+)*$" })),
51213
- digest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51214
- fileCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51215
- byteSize: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(1).annotate({ expected: "a value greater than or equal to 1" })),
51216
- kind: Literal2("library-template"),
51217
- access: Literal2("read-only"),
51218
- templateId: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(128).annotate({ expected: "a value with a length of at most 128" })),
51219
- slug: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^[a-z0-9]+(?:-[a-z0-9]+)*$" })),
51220
- name: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(256).annotate({ expected: "a value with a length of at most 256" }))
51221
- })
51222
- ])),
51223
- libraryManifestDigest: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^[a-f0-9]{64}$")).annotate({ expected: "a string matching the RegExp ^[a-f0-9]{64}$" })),
51224
- createdAt: String4,
51225
- updatedAt: String4,
51226
- createdBy: Struct({
51227
- userId: UserId,
51228
- via: Literals([
51229
- "api",
51230
- "mcp",
51231
- "agent"
51232
- ])
51233
- }),
51234
- updatedBy: Struct({
51235
- userId: UserId,
51236
- via: Literals([
51237
- "api",
51238
- "mcp",
51239
- "agent"
51240
- ])
51241
- })
51242
- }),
51243
- files: Record(String4, String4)
51244
- });
51245
- var TemplatesReconcileWorkspace401 = UnauthorizedError;
51246
- var TemplatesReconcileWorkspace403 = ForbiddenError;
51247
- var TemplatesReconcileWorkspace404 = ResourceNotFoundError;
51248
- var TemplatesReconcileWorkspace409 = ConflictError;
51249
- var TemplatesReconcileWorkspace500 = InternalError;
51250
- var TemplatesReconcileWorkspace504 = GatewayTimeoutError;
51251
51540
  var TemplatesAttachWorkspaceResourcePathParams = Struct({ id: TemplateId });
51252
51541
  var TemplatesAttachWorkspaceResourceRequestJson = Struct({
51253
51542
  expectedRevision: String4,
@@ -51733,7 +52022,7 @@ var TemplatesCreateFamilyFromTemplate500 = InternalError;
51733
52022
  var TemplatesCreateFamilyFromTemplate504 = GatewayTimeoutError;
51734
52023
  var TemplatesAddEntryPathParams = Struct({ projectId: TemplateProjectId });
51735
52024
  var TemplatesAddEntryRequestJson = Struct({
51736
- entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))emails\\/.+\\.tsx$" })),
52025
+ entryPath: String4.check(isMaxLength(1024).annotate({ expected: "a value with a length of at most 1024" })).check(isPattern2(/* @__PURE__ */ new RegExp("^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$")).annotate({ expected: "a string matching the RegExp ^(?!\\/)(?!.*\\\\)(?!.*(?:^|\\/)\\.{1,2}(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))(?:templates|emails)\\/.+\\.tsx$" })),
51737
52026
  name: String4.check(isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(isMaxLength(200).annotate({ expected: "a value with a length of at most 200" })),
51738
52027
  slug: String4.check(isPattern2(/* @__PURE__ */ new RegExp("^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$")).annotate({ expected: "a string matching the RegExp ^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$" })),
51739
52028
  description: optionalKey2(Union2([Union2([String4, Null2]), Null2])),
@@ -51765,6 +52054,7 @@ var UnsubscribeList200 = Struct({
51765
52054
  organizationId: String4,
51766
52055
  name: String4,
51767
52056
  description: Union2([String4, Null2]),
52057
+ isDefault: Boolean3,
51768
52058
  memberCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
51769
52059
  createdAt: String4,
51770
52060
  updatedAt: String4
@@ -51784,6 +52074,7 @@ var UnsubscribeCreate201 = Struct({
51784
52074
  organizationId: String4,
51785
52075
  name: String4,
51786
52076
  description: Union2([String4, Null2]),
52077
+ isDefault: Boolean3,
51787
52078
  memberCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
51788
52079
  createdAt: String4,
51789
52080
  updatedAt: String4
@@ -51850,6 +52141,7 @@ var UnsubscribeRemove200 = Struct({ success: Boolean3 });
51850
52141
  var UnsubscribeRemove401 = UnauthorizedError;
51851
52142
  var UnsubscribeRemove403 = ForbiddenError;
51852
52143
  var UnsubscribeRemove404 = ResourceNotFoundError;
52144
+ var UnsubscribeRemove409 = ConflictError;
51853
52145
  var UnsubscribeRemove500 = InternalError;
51854
52146
  var UnsubscribeRemove504 = GatewayTimeoutError;
51855
52147
  var UnsubscribeUpdatePathParams = Struct({ id: UnsubscribeId });
@@ -51862,6 +52154,7 @@ var UnsubscribeUpdate200 = Struct({
51862
52154
  organizationId: String4,
51863
52155
  name: String4,
51864
52156
  description: Union2([String4, Null2]),
52157
+ isDefault: Boolean3,
51865
52158
  memberCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
51866
52159
  createdAt: String4,
51867
52160
  updatedAt: String4
@@ -51871,6 +52164,22 @@ var UnsubscribeUpdate403 = ForbiddenError;
51871
52164
  var UnsubscribeUpdate404 = ResourceNotFoundError;
51872
52165
  var UnsubscribeUpdate500 = InternalError;
51873
52166
  var UnsubscribeUpdate504 = GatewayTimeoutError;
52167
+ var UnsubscribeSetDefaultPathParams = Struct({ id: UnsubscribeId });
52168
+ var UnsubscribeSetDefault200 = Struct({
52169
+ id: UnsubscribeId,
52170
+ organizationId: String4,
52171
+ name: String4,
52172
+ description: Union2([String4, Null2]),
52173
+ isDefault: Boolean3,
52174
+ memberCount: Finite.check(isInt().annotate({ expected: "an integer" })).check(isGreaterThanOrEqualTo2(0).annotate({ expected: "a value greater than or equal to 0" })),
52175
+ createdAt: String4,
52176
+ updatedAt: String4
52177
+ });
52178
+ var UnsubscribeSetDefault401 = UnauthorizedError;
52179
+ var UnsubscribeSetDefault403 = ForbiddenError;
52180
+ var UnsubscribeSetDefault404 = ResourceNotFoundError;
52181
+ var UnsubscribeSetDefault500 = InternalError;
52182
+ var UnsubscribeSetDefault504 = GatewayTimeoutError;
51874
52183
  var UnsubscribeCheckSubscriptionQuery = Struct({
51875
52184
  email: String4,
51876
52185
  groupIds: optionalKey2(Union2([String4, Null2]))
@@ -51913,9 +52222,13 @@ var WebhooksCreateRequestJson = Struct({
51913
52222
  "message.bounced",
51914
52223
  "message.complained",
51915
52224
  "message.received",
52225
+ "message.opened",
52226
+ "message.clicked",
51916
52227
  "contact.created",
51917
52228
  "contact.updated",
51918
52229
  "contact.deleted",
52230
+ "contact.unsubscribed",
52231
+ "contact.resubscribed",
51919
52232
  "conversation.created",
51920
52233
  "conversation.updated",
51921
52234
  "conversation.archived",
@@ -51969,9 +52282,13 @@ var WebhooksUpdateRequestJson = Struct({
51969
52282
  "message.bounced",
51970
52283
  "message.complained",
51971
52284
  "message.received",
52285
+ "message.opened",
52286
+ "message.clicked",
51972
52287
  "contact.created",
51973
52288
  "contact.updated",
51974
52289
  "contact.deleted",
52290
+ "contact.unsubscribed",
52291
+ "contact.resubscribed",
51975
52292
  "conversation.created",
51976
52293
  "conversation.updated",
51977
52294
  "conversation.archived",
@@ -53427,7 +53744,7 @@ var EmailGroup = class extends make36("Email").add(get5("emailListBlocks", "/v1/
53427
53744
  EmailListSenders500,
53428
53745
  EmailListSenders504.pipe(status(504))
53429
53746
  ]
53430
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.listSenders").annotate(Summary, "List sender identities").annotate(Description, "Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours) and `series`, the last 14 days of daily email sends from the address, oldest first."), post("emailAddSender", "/v1/email/senders", {
53747
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.listSenders").annotate(Summary, "List senders").annotate(Description, "Returns a paginated list of senders, optionally filtered by verification status, active state, or default flag. Each row carries `deliverability` (bounce and complaint rates over the last 24 hours) and `series`, the last 14 days of daily email sends from the address, oldest first."), post("emailAddSender", "/v1/email/senders", {
53431
53748
  headers: EmailAddSenderHeaders,
53432
53749
  payload: EmailAddSenderRequestJson,
53433
53750
  success: EmailAddSender201.pipe(status(201)),
@@ -53441,7 +53758,7 @@ var EmailGroup = class extends make36("Email").add(get5("emailListBlocks", "/v1/
53441
53758
  EmailAddSender502.pipe(status(502)),
53442
53759
  EmailAddSender504.pipe(status(504))
53443
53760
  ]
53444
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.addSender").annotate(Summary, "Add a sender identity").annotate(Description, "Creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input."), get5("emailGetSender", "/v1/email/senders/:id", {
53761
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.addSender").annotate(Summary, "Add a sender").annotate(Description, "Creates a sender. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input."), get5("emailGetSender", "/v1/email/senders/:id", {
53445
53762
  params: EmailGetSenderPathParams,
53446
53763
  success: EmailGetSender200,
53447
53764
  error: [
@@ -53451,7 +53768,7 @@ var EmailGroup = class extends make36("Email").add(get5("emailListBlocks", "/v1/
53451
53768
  EmailGetSender500,
53452
53769
  EmailGetSender504.pipe(status(504))
53453
53770
  ]
53454
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.getSender").annotate(Summary, "Get a sender identity").annotate(Description, "Returns one sender identity owned by the authenticated organization. Other organizations' ids are reported as not found."), del("emailRemoveSender", "/v1/email/senders/:id", {
53771
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.getSender").annotate(Summary, "Get a sender").annotate(Description, "Returns one sender owned by the authenticated organization. Other organizations' ids are reported as not found."), del("emailRemoveSender", "/v1/email/senders/:id", {
53455
53772
  params: EmailRemoveSenderPathParams,
53456
53773
  success: EmailRemoveSender200,
53457
53774
  error: [
@@ -53462,7 +53779,7 @@ var EmailGroup = class extends make36("Email").add(get5("emailListBlocks", "/v1/
53462
53779
  EmailRemoveSender500,
53463
53780
  EmailRemoveSender504.pipe(status(504))
53464
53781
  ]
53465
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.removeSender").annotate(Summary, "Remove a sender identity").annotate(Description, "Accepts sender removal and marks the sender inactive. It reports the `deleting` lifecycle until removal finishes."), post("emailSetDefaultSender", "/v1/email/senders/:id/default", {
53782
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.removeSender").annotate(Summary, "Remove a sender").annotate(Description, "Accepts sender removal and marks the sender inactive. A default sender can be removed when no other active sender remains in the organization. It reports the `deleting` lifecycle until removal finishes."), post("emailSetDefaultSender", "/v1/email/senders/:id/default", {
53466
53783
  params: EmailSetDefaultSenderPathParams,
53467
53784
  success: EmailSetDefaultSender200,
53468
53785
  error: [
@@ -53483,7 +53800,7 @@ var EmailGroup = class extends make36("Email").add(get5("emailListBlocks", "/v1/
53483
53800
  EmailCheckSenderVerification502.pipe(status(502)),
53484
53801
  EmailCheckSenderVerification504.pipe(status(504))
53485
53802
  ]
53486
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.checkSenderVerification").annotate(Summary, "Check sender verification status").annotate(Description, "Returns the current verification status of a sender identity."), get5("emailGetStats", "/v1/email/stats", {
53803
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "email.checkSenderVerification").annotate(Summary, "Check sender verification status").annotate(Description, "Returns the current verification status of a sender."), get5("emailGetStats", "/v1/email/stats", {
53487
53804
  query: EmailGetStatsQuery,
53488
53805
  success: EmailGetStats200,
53489
53806
  error: [
@@ -53821,7 +54138,15 @@ var OrganizationsGroup = class extends make36("Organizations").add(post("organiz
53821
54138
  OrganizationsUpdate500,
53822
54139
  OrganizationsUpdate504.pipe(status(504))
53823
54140
  ]
53824
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "organizations.update").annotate(Summary, "Update the current organization").annotate(Description, "Updates the current organization's profile, regional defaults, reply-to, and unsubscribe-group defaults and returns the saved organization. `metadata` is merged into the stored value; every other field is replaced."), post("organizationsDelete", "/v1/organizations/deletion-operations", {
54141
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "organizations.update").annotate(Summary, "Update the current organization").annotate(Description, "Updates the current organization's profile, regional defaults, and reply-to default and returns the saved organization. `metadata` is merged into the stored value; every other field is replaced."), get5("organizationsGetProfile", "/v1/organizations/current/profile", {
54142
+ success: OrganizationsGetProfile200,
54143
+ error: [
54144
+ OrganizationsGetProfile401.pipe(status(401)),
54145
+ OrganizationsGetProfile403.pipe(status(403)),
54146
+ OrganizationsGetProfile500,
54147
+ OrganizationsGetProfile504.pipe(status(504))
54148
+ ]
54149
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "organizations.getProfile").annotate(Summary, "Get the current account profile").annotate(Description, "Returns your identity in the organization authorized by your credential. The ID remains stable across reconnects and display-name changes. Removing and re-adding your membership creates a new ID."), post("organizationsDelete", "/v1/organizations/deletion-operations", {
53825
54150
  headers: OrganizationsDeleteHeaders,
53826
54151
  payload: OrganizationsDeleteRequestJson,
53827
54152
  success: OrganizationsDelete202.pipe(status(202)),
@@ -53930,7 +54255,7 @@ var TemplatesGroup = class extends make36("Templates").add(get5("templatesList",
53930
54255
  TemplatesPublish500,
53931
54256
  TemplatesPublish504.pipe(status(504))
53932
54257
  ]
53933
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.publish").annotate(Summary, "Publish an exact template commit").annotate(Description, "Builds an exact Git commit and entry path, stores the immutable executable and its assets, records the input contract it validates against, and makes that publication current."), get5("templatesGetPublication", "/v1/templates/:id/publications/:publicationId", {
54258
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.publish").annotate(Summary, "Publish an exact template commit").annotate(Description, "Builds an exact Git commit and entry path, stores the immutable compiled IR and its assets, records the input contract it validates against, and makes that publication current."), get5("templatesGetPublication", "/v1/templates/:id/publications/:publicationId", {
53934
54259
  params: TemplatesGetPublicationPathParams,
53935
54260
  success: TemplatesGetPublication200,
53936
54261
  error: [
@@ -54059,19 +54384,7 @@ var TemplatesGroup = class extends make36("Templates").add(get5("templatesList",
54059
54384
  TemplatesWorkspaceHistory500,
54060
54385
  TemplatesWorkspaceHistory504.pipe(status(504))
54061
54386
  ]
54062
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.workspaceHistory").annotate(Summary, "List template project commit history").annotate(Description, "Returns recent history from the template repository's default branch."), post("templatesReconcileWorkspace", "/v1/templates/:id/workspace/reconcile", {
54063
- params: TemplatesReconcileWorkspacePathParams,
54064
- payload: TemplatesReconcileWorkspaceRequestJson,
54065
- success: TemplatesReconcileWorkspace200,
54066
- error: [
54067
- TemplatesReconcileWorkspace401.pipe(status(401)),
54068
- TemplatesReconcileWorkspace403.pipe(status(403)),
54069
- TemplatesReconcileWorkspace404.pipe(status(404)),
54070
- TemplatesReconcileWorkspace409.pipe(status(409)),
54071
- TemplatesReconcileWorkspace500,
54072
- TemplatesReconcileWorkspace504.pipe(status(504))
54073
- ]
54074
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.reconcileWorkspace").annotate(Summary, "Reconcile a template project workspace").annotate(Description, "Fast-forwards or rebases the workspace onto the latest saved version, retaining file conflicts for explicit resolution."), post("templatesAttachWorkspaceResource", "/v1/templates/:id/workspace/resources", {
54387
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.workspaceHistory").annotate(Summary, "List template project commit history").annotate(Description, "Returns recent history from the template repository's default branch."), post("templatesAttachWorkspaceResource", "/v1/templates/:id/workspace/resources", {
54075
54388
  params: TemplatesAttachWorkspaceResourcePathParams,
54076
54389
  payload: TemplatesAttachWorkspaceResourceRequestJson,
54077
54390
  success: TemplatesAttachWorkspaceResource200,
@@ -54219,7 +54532,7 @@ var TemplatesGroup = class extends make36("Templates").add(get5("templatesList",
54219
54532
  TemplatesAddEntry500,
54220
54533
  TemplatesAddEntry504.pipe(status(504))
54221
54534
  ]
54222
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.addEntry").annotate(Summary, "Add a template entry").annotate(Description, "Registers an `emails/*.tsx` file in an existing template project as its own template and returns it with status 201. The file does not need to exist yet; publishing fails until a commit contains it. Repeating the call with the same entry path, name, and slug returns the existing template.")).annotate(Description, "Git-backed email template projects, workspace editing, immutable publications, and delivery defaults") {
54535
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "templates.addEntry").annotate(Summary, "Add a template entry").annotate(Description, "Registers a `.tsx` file under `templates/` or `emails/` in an existing template project as its own template and returns it with status 201. The file does not need to exist yet; publishing fails until a commit contains it. Repeating the call with the same entry path, name, and slug returns the existing template.")).annotate(Description, "Git-backed email template projects, workspace editing, immutable publications, and delivery defaults") {
54223
54536
  };
54224
54537
  var UnsubscribeGroupsGroup = class extends make36("Unsubscribe Groups").add(get5("unsubscribeList", "/v1/unsubscribe-groups", {
54225
54538
  query: UnsubscribeListQuery,
@@ -54230,7 +54543,7 @@ var UnsubscribeGroupsGroup = class extends make36("Unsubscribe Groups").add(get5
54230
54543
  UnsubscribeList500,
54231
54544
  UnsubscribeList504.pipe(status(504))
54232
54545
  ]
54233
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.list").annotate(Summary, "List unsubscribe groups").annotate(Description, "Returns a paginated list of the organization's unsubscribe groups."), post("unsubscribeCreate", "/v1/unsubscribe-groups", {
54546
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.list").annotate(Summary, "List unsubscribe groups").annotate(Description, "Returns a paginated list of the organization's unsubscribe groups, the default group first."), post("unsubscribeCreate", "/v1/unsubscribe-groups", {
54234
54547
  payload: UnsubscribeCreateRequestJson,
54235
54548
  success: UnsubscribeCreate201.pipe(status(201)),
54236
54549
  error: [
@@ -54279,10 +54592,11 @@ var UnsubscribeGroupsGroup = class extends make36("Unsubscribe Groups").add(get5
54279
54592
  UnsubscribeRemove401.pipe(status(401)),
54280
54593
  UnsubscribeRemove403.pipe(status(403)),
54281
54594
  UnsubscribeRemove404.pipe(status(404)),
54595
+ UnsubscribeRemove409.pipe(status(409)),
54282
54596
  UnsubscribeRemove500,
54283
54597
  UnsubscribeRemove504.pipe(status(504))
54284
54598
  ]
54285
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.remove").annotate(Summary, "Delete an unsubscribe group").annotate(Description, "Permanently deletes an unsubscribe group by its ID."), patch("unsubscribeUpdate", "/v1/unsubscribe-groups/:id", {
54599
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.remove").annotate(Summary, "Delete an unsubscribe group").annotate(Description, "Permanently deletes an unsubscribe group by its ID. The default group cannot be deleted; make another group the default first. A group a scheduled or running campaign uses cannot be deleted until that run finishes or is cancelled."), patch("unsubscribeUpdate", "/v1/unsubscribe-groups/:id", {
54286
54600
  params: UnsubscribeUpdatePathParams,
54287
54601
  payload: UnsubscribeUpdateRequestJson,
54288
54602
  success: UnsubscribeUpdate200,
@@ -54293,7 +54607,17 @@ var UnsubscribeGroupsGroup = class extends make36("Unsubscribe Groups").add(get5
54293
54607
  UnsubscribeUpdate500,
54294
54608
  UnsubscribeUpdate504.pipe(status(504))
54295
54609
  ]
54296
- }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.update").annotate(Summary, "Update an unsubscribe group").annotate(Description, "Updates the name or description of an unsubscribe group."), get5("unsubscribeCheckSubscription", "/v1/unsubscribe-groups/check", {
54610
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.update").annotate(Summary, "Update an unsubscribe group").annotate(Description, "Updates the name or description of an unsubscribe group."), post("unsubscribeSetDefault", "/v1/unsubscribe-groups/:id/default", {
54611
+ params: UnsubscribeSetDefaultPathParams,
54612
+ success: UnsubscribeSetDefault200,
54613
+ error: [
54614
+ UnsubscribeSetDefault401.pipe(status(401)),
54615
+ UnsubscribeSetDefault403.pipe(status(403)),
54616
+ UnsubscribeSetDefault404.pipe(status(404)),
54617
+ UnsubscribeSetDefault500,
54618
+ UnsubscribeSetDefault504.pipe(status(504))
54619
+ ]
54620
+ }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "unsubscribe.setDefault").annotate(Summary, "Make an unsubscribe group the default").annotate(Description, "Makes this group the organization's default: campaigns that name no group, and whose template and sending domain name none, unsubscribe recipients from it."), get5("unsubscribeCheckSubscription", "/v1/unsubscribe-groups/check", {
54297
54621
  query: UnsubscribeCheckSubscriptionQuery,
54298
54622
  success: UnsubscribeCheckSubscription200,
54299
54623
  error: [
@@ -54418,7 +54742,7 @@ var WebhooksGroup = class extends make36("Webhooks").add(get5("webhooksList", "/
54418
54742
  ]
54419
54743
  }).middleware(ApiKeySecurityMiddleware).annotate(Identifier, "webhooks.getStats").annotate(Summary, "Get webhook delivery statistics").annotate(Description, "Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per organization-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.")).annotate(Description, "Customer event webhook management, testing, and delivery logs") {
54420
54744
  };
54421
- var SamvaApi = class extends make34("SamvaApi").annotate(Title, "Samva API").annotate(Version2, "1.0.0").annotate(Description, "Samva is a developer email API for product teams: deliverability, versioned templates, inbound threading, and signed webhooks behind one typed send call.").annotate(Servers, [{ url: "https://api.samva.dev" }]).add(AnalyticsGroup, APIKeysGroup, AttachmentsGroup, BrandsGroup, CampaignsGroup, ContactGroupsGroup, ContactsGroup, ConversationsGroup, CustomFieldsGroup, EmailGroup, MediaGroup, MessagesGroup, ScheduledMessagesGroup, OperationsGroup, OrganizationsGroup, TemplatesGroup, UnsubscribeGroupsGroup, WebhooksGroup) {
54745
+ var SamvaApi = class extends make34("SamvaApi").annotate(Title, "Samva API").annotate(Version2, "1.0.0").annotate(Description, "Samva is the email API for your app. Send transactional email in one typed call. Delivery events and customer replies come back as signed webhooks, and replies thread to the email they answer.").annotate(Servers, [{ url: "https://api.samva.dev" }]).add(AnalyticsGroup, APIKeysGroup, AttachmentsGroup, BrandsGroup, CampaignsGroup, ContactGroupsGroup, ContactsGroup, ConversationsGroup, CustomFieldsGroup, EmailGroup, MediaGroup, MessagesGroup, ScheduledMessagesGroup, OperationsGroup, OrganizationsGroup, TemplatesGroup, UnsubscribeGroupsGroup, WebhooksGroup) {
54422
54746
  };
54423
54747
  var DEFAULT_BASE_URL = "https://api.samva.dev";
54424
54748
  var Service3 = class extends Service()("samva/Client") {
@@ -54617,7 +54941,7 @@ var generateIdempotencyKey = gen2(function* () {
54617
54941
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
54618
54942
  });
54619
54943
 
54620
- // ../sdk/dist/operation-Cb5V9FJ7.js
54944
+ // ../sdk/dist/operation-Cdp1EI_1.js
54621
54945
  var SDK_OPERATION_CALLS = {
54622
54946
  brandsList: { kind: "none" },
54623
54947
  brandsCreate: { kind: "payload" },
@@ -55058,10 +55382,6 @@ var SDK_OPERATION_CALLS = {
55058
55382
  kind: "pathPayload",
55059
55383
  paths: ["id"]
55060
55384
  },
55061
- templatesReconcileWorkspace: {
55062
- kind: "pathPayload",
55063
- paths: ["id"]
55064
- },
55065
55385
  templatesRestoreWorkspace: {
55066
55386
  kind: "pathPayload",
55067
55387
  paths: ["id"]
@@ -55122,6 +55442,7 @@ var SDK_OPERATION_CALLS = {
55122
55442
  },
55123
55443
  organizationsCreate: { kind: "payload" },
55124
55444
  organizationsGet: { kind: "none" },
55445
+ organizationsGetProfile: { kind: "none" },
55125
55446
  organizationsUpdate: { kind: "payload" },
55126
55447
  organizationsGetUsage: { kind: "params" },
55127
55448
  organizationsDelete: { kind: "idempotentPayload" },
@@ -55219,6 +55540,10 @@ var SDK_OPERATION_CALLS = {
55219
55540
  kind: "path",
55220
55541
  paths: ["id"]
55221
55542
  },
55543
+ unsubscribeSetDefault: {
55544
+ kind: "path",
55545
+ paths: ["id"]
55546
+ },
55222
55547
  unsubscribeListMembers: {
55223
55548
  kind: "pathParams",
55224
55549
  paths: ["groupId"]
@@ -55581,6 +55906,7 @@ var retry4 = make38("operationsRetry");
55581
55906
  // ../sdk/dist/effect/organizations.js
55582
55907
  var create9 = make38("organizationsCreate");
55583
55908
  var get13 = make38("organizationsGet");
55909
+ var getProfile = make38("organizationsGetProfile");
55584
55910
  var update9 = make38("organizationsUpdate");
55585
55911
  var getUsage = make38("organizationsGetUsage");
55586
55912
  var deleteOrganization = make38("organizationsDelete");
@@ -55615,7 +55941,6 @@ var putWorkspaceAsset = make38("templatesPutWorkspaceAsset");
55615
55941
  var resolveWorkspaceConflict = make38("templatesResolveWorkspaceConflict");
55616
55942
  var attachWorkspaceResource = make38("templatesAttachWorkspaceResource");
55617
55943
  var removeWorkspaceResource = make38("templatesRemoveWorkspaceResource");
55618
- var reconcileWorkspace = make38("templatesReconcileWorkspace");
55619
55944
  var restoreWorkspace = make38("templatesRestoreWorkspace");
55620
55945
  var saveWorkspace = make38("templatesSaveWorkspace");
55621
55946
  var checkWorkspace = make38("templatesCheckWorkspace");
@@ -55632,6 +55957,7 @@ var list13 = make38("unsubscribeList");
55632
55957
  var create12 = make38("unsubscribeCreate");
55633
55958
  var update11 = make38("unsubscribeUpdate");
55634
55959
  var remove13 = make38("unsubscribeRemove");
55960
+ var setDefault2 = make38("unsubscribeSetDefault");
55635
55961
  var listMembers = make38("unsubscribeListMembers");
55636
55962
  var addEmails = make38("unsubscribeAddEmails");
55637
55963
  var removeEmails = make38("unsubscribeRemoveEmails");
@@ -55815,7 +56141,10 @@ var commandTree = {
55815
56141
  credential: {},
55816
56142
  add: {},
55817
56143
  move: {},
56144
+ dev: {},
55818
56145
  check: {},
56146
+ render: {},
56147
+ snapshot: {},
55819
56148
  build: {},
55820
56149
  export: {},
55821
56150
  types: {},
@@ -56169,18 +56498,6 @@ var decodeStoredCredentials = (profile, rawCredentials) => try_3({
56169
56498
  })));
56170
56499
  var resolveApiUrl = map7(resolveExecutionSelection, (selection) => selection.apiUrl);
56171
56500
  var isCredentialExpired = (credentials, nowMillis) => credentials.expiresAt <= Math.floor(nowMillis / 1000);
56172
- var resolveAuthToken = gen2(function* () {
56173
- const context = yield* resolveExecutionContext;
56174
- if (!context.credentials)
56175
- return;
56176
- if (isCredentialExpired(context.credentials, yield* currentTimeMillis2)) {
56177
- return yield* new CliAuthError({
56178
- code: "expired_credentials",
56179
- message: "Your session has expired. Run `samva login` to sign in again."
56180
- });
56181
- }
56182
- return context.credentials.accessToken;
56183
- });
56184
56501
  var writeCredentials = fn2("CliConfig.writeCredentials")(function* (credentials) {
56185
56502
  const context = yield* resolveExecutionSelection;
56186
56503
  const config = yield* readConfig;
@@ -56588,7 +56905,7 @@ var templateDataFlag = String8("template-data").pipe(withDescription2("JSON obje
56588
56905
  var includeTagsFlag = String8("include-tags").pipe(withDescription2("Contact tags to include (comma-separated or repeated)"), atLeast2(0));
56589
56906
  var excludeTagsFlag = String8("exclude-tags").pipe(withDescription2("Contact tags to exclude from the include set (comma-separated or repeated)"), atLeast2(0));
56590
56907
  var contactIdsFlag = String8("contact-ids").pipe(withDescription2("Explicit contact ids to target (comma-separated or repeated)"), atLeast2(0));
56591
- var unsubscribeGroupIdFlag = String8("unsubscribe-group-id").pipe(withDescription2("Unsubscribe group id applied to every send"), optional4);
56908
+ var unsubscribeGroupIdFlag = String8("unsubscribe-group-id").pipe(withDescription2("Unsubscribe group id applied to every send; overrides the organization's default group"), optional4);
56592
56909
  var pageSizeFlag = Int5("page-size").pipe(withDescription2("Recipients dispatched per batch"), optional4);
56593
56910
  var dryRunFlag = Boolean6("dry-run").pipe(withDescription2("Validate inputs and print the request payload without calling the API"), withDefault4(false));
56594
56911
  var trackOpensFlag = Literals3("track-opens", ["on", "off"]).pipe(withDescription2("Override open tracking for campaign sends; recipient opt-out wins"), optional4);
@@ -57263,14 +57580,26 @@ var check = (name, run) => run.pipe(match6({
57263
57580
  }));
57264
57581
  var reachability = (apiUrl) => check("API reachability", getText(`${apiUrl.replace(/\/+$/, "")}/v1/health/ping`).pipe(flatMap3((response) => response.ok ? succeed6("Health endpoint responded") : fail6(new SamvaCliError({ message: `Health endpoint returned ${response.status}` })))));
57265
57582
  var orgAccess = check("Organization permissions", getClientProvider.pipe(flatMap3((client) => get13().pipe(client.provide, map7((organization) => `${organization.name} (${organization.slug})`), mapError2((error) => new SamvaCliError({ message: formatApiError("Organization read failed", error) }))))));
57266
- var domains = check("Sending domains", getClientProvider.pipe(flatMap3((client) => listDomains({ limit: "1" }).pipe(client.provide, map7((result) => {
57267
- const verified = result.items.filter((domain) => domain.phase === "ready").length;
57268
- return `${result.pagination.total} configured; ${verified} verified on this page`;
57269
- }), mapError2((error) => new SamvaCliError({ message: formatApiError("Domain read failed", error) }))))));
57270
- var senders = check("Senders", getClientProvider.pipe(flatMap3((client) => listSenders({ limit: "1" }).pipe(client.provide, map7((result) => {
57271
- const verified = result.items.filter((sender) => sender.verificationStatus === "verified").length;
57272
- return `${result.pagination.total} configured; ${verified} verified on this page`;
57273
- }), mapError2((error) => new SamvaCliError({ message: formatApiError("Sender read failed", error) }))))));
57583
+ var sendReview = getClientProvider.pipe(flatMap3((client) => getOnboardingReview().pipe(client.provide, map7((review) => ({
57584
+ name: "Send review",
57585
+ status: review.canSend ? "passed" : review.code === "review_rejected" || review.code === "identity_review_rejected" ? "failed" : "unavailable",
57586
+ detail: review.canSend ? `${review.decision}; trust tier ${review.trustTier}` : `${review.code}; next action: ${review.nextAction}`
57587
+ })))), catch_2((error) => succeed6({
57588
+ name: "Send review",
57589
+ status: "failed",
57590
+ detail: formatApiError("Send review read failed", error)
57591
+ })));
57592
+ var identityCount = (name, noun, read) => getClientProvider.pipe(flatMap3((client) => client.provide(read)), map7(({ pagination }) => ({
57593
+ name,
57594
+ status: pagination.total > 0 ? "passed" : "unavailable",
57595
+ detail: `${pagination.total} ${noun}`
57596
+ })), catch_2((error) => succeed6({
57597
+ name,
57598
+ status: "failed",
57599
+ detail: formatApiError(`${name} read failed`, error)
57600
+ })));
57601
+ var domains = identityCount("Sending domains", "sendable", listDomains({ sendable: "true", limit: "1" }));
57602
+ var senders = identityCount("Senders", "verified and active", listSenders({ verificationStatus: "verified", isActive: "true", limit: "1" }));
57274
57603
  var domainVerificationReadback = getClientProvider.pipe(flatMap3((client) => listDomains({ limit: "1" }).pipe(client.provide, mapError2((error) => new SamvaCliError({ message: formatApiError("Domain verification read failed", error) })), flatMap3((result) => {
57275
57604
  const domain = result.items[0];
57276
57605
  if (!domain) {
@@ -57298,19 +57627,29 @@ var domainVerificationReadback = getClientProvider.pipe(flatMap3((client) => lis
57298
57627
  var doctorCommand = make28("doctor", { json: jsonFlag }).pipe(withDescription3("Read local configuration and remote email state"), withExamples([{ command: "samva email doctor --json" }]), withHandler(({ json }) => gen2(function* () {
57299
57628
  const context = yield* resolveExecutionContext;
57300
57629
  const authSource = context.apiKey ? "SAMVA_API_KEY" : context.credentials ? "stored OAuth credential" : "none";
57301
- const checks = yield* all2([
57630
+ const [reachable, org, review, domainCount, senderCount, verification] = yield* all2([
57302
57631
  reachability(context.apiUrl),
57303
57632
  orgAccess,
57633
+ sendReview,
57304
57634
  domains,
57305
57635
  senders,
57306
57636
  domainVerificationReadback
57307
- ]);
57637
+ ], { concurrency: "unbounded" });
57638
+ const checks = [
57639
+ reachable,
57640
+ org,
57641
+ review,
57642
+ domainCount,
57643
+ senderCount,
57644
+ verification
57645
+ ];
57308
57646
  const ok = checks.every((result) => result.status !== "failed");
57309
57647
  const payload = {
57310
57648
  schemaVersion: 1,
57311
57649
  mode: "read-only",
57312
57650
  ok,
57313
- limitations: "Checks CLI/API visibility only. It does not send, mutate, replay fixtures, verify DNS, or verify provider readiness.",
57651
+ readyToSend: review.status === "passed" && (domainCount.status === "passed" || senderCount.status === "passed"),
57652
+ limitations: "Reads the send fence and identity lists only. It does not send, mutate, replay fixtures, or check DNS itself.",
57314
57653
  resolved: {
57315
57654
  profile: context.profile,
57316
57655
  apiUrl: context.apiUrl,
@@ -57327,7 +57666,8 @@ var doctorCommand = make28("doctor", { json: jsonFlag }).pipe(withDescription3("
57327
57666
  ["Profile", payload.resolved.profile],
57328
57667
  ["API", payload.resolved.apiUrl],
57329
57668
  ["Auth source", payload.resolved.authSource],
57330
- ["Organization", payload.resolved.organization]
57669
+ ["Organization", payload.resolved.organization],
57670
+ ["Ready to send", payload.readyToSend ? "yes" : "no"]
57331
57671
  ]);
57332
57672
  yield* log(`
57333
57673
  Read-only checks:`);
@@ -57727,7 +58067,7 @@ var readStatus = gen2(function* () {
57727
58067
  message: formatApiError("Could not get email review status", error)
57728
58068
  })));
57729
58069
  });
57730
- var status3 = make28("status", { json: jsonFlag }).pipe(withDescription3("Get workspace and sending-identity review status"), withExamples([{ command: "samva email review status --json" }]), withHandler(({ json }) => gen2(function* () {
58070
+ var status3 = make28("status", { json: jsonFlag }).pipe(withDescription3("Get organization and sending-identity review status"), withExamples([{ command: "samva email review status --json" }]), withHandler(({ json }) => gen2(function* () {
57731
58071
  const data = yield* readStatus;
57732
58072
  if (json)
57733
58073
  return yield* printJson(data);
@@ -57747,7 +58087,7 @@ Sending identities:`);
57747
58087
  }
57748
58088
  }
57749
58089
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
57750
- var reapply = make28("reapply", { json: jsonFlag }).pipe(withDescription3("Resubmit a rejected workspace for email review"), withExamples([{ command: "samva email review reapply --json" }]), withHandler(({ json }) => gen2(function* () {
58090
+ var reapply = make28("reapply", { json: jsonFlag }).pipe(withDescription3("Resubmit a rejected organization for email review"), withExamples([{ command: "samva email review reapply --json" }]), withHandler(({ json }) => gen2(function* () {
57751
58091
  const client = yield* getClientProvider;
57752
58092
  const current = yield* readStatus;
57753
58093
  const data = yield* reapplyOnboardingReview({
@@ -57788,6 +58128,7 @@ var projectMessage = (message) => ({
57788
58128
  id: message.id,
57789
58129
  channel: message.channel,
57790
58130
  status: message.status,
58131
+ from: message.emailDeliveryDetails[0]?.fromEmail ?? null,
57791
58132
  conversationId: message.conversationId,
57792
58133
  createdAt: message.createdAt,
57793
58134
  updatedAt: message.updatedAt,
@@ -57808,6 +58149,7 @@ var printMessage = (message) => printFields([
57808
58149
  ["Message ID", message.id],
57809
58150
  ["Channel", message.channel],
57810
58151
  ["Status", message.status],
58152
+ ["From", message.from],
57811
58153
  ["Waiting", waitingLine(message)],
57812
58154
  ["Conversation", message.conversationId],
57813
58155
  ["Created", message.createdAt],
@@ -58040,6 +58382,8 @@ var textFlag2 = String8("text").pipe(withDescription2("Plain-text body (use `-`
58040
58382
  var templateIdFlag2 = String8("template-id").pipe(withDescription2("Template id to render instead of inline body"), optional4);
58041
58383
  var templateSlugFlag2 = String8("template-slug").pipe(withDescription2("Template handle to render instead of inline body, e.g. welcome-email"), optional4);
58042
58384
  var templateDataFlag2 = String8("template-data").pipe(withDescription2("JSON object of variables for the template"), optional4);
58385
+ var localeFlag = String8("locale").pipe(withDescription2("BCP 47 language tag (for example en-US) for dates, numbers and money in a template send; defaults to the template's locale"), optional4);
58386
+ var timeZoneFlag = String8("time-zone").pipe(withDescription2("IANA time zone (for example America/New_York) that a template send renders dates in; defaults to UTC"), optional4);
58043
58387
  var replyToMessageFlag = String8("reply-to-message-id").pipe(withDescription2("Message id this email replies to (threads the conversation)"), optional4);
58044
58388
  var replyToAddressFlag = String8("reply-to").pipe(withDescription2("Reply-To header email address"), optional4);
58045
58389
  var idempotencyKeyFlag2 = String8("idempotency-key").pipe(withDescription2("Key (1-255 characters) so identical retries return the original email"), optional4);
@@ -58074,6 +58418,8 @@ var send2 = make28("send", {
58074
58418
  inputContractId: inputContractIdFlag,
58075
58419
  templateSlug: templateSlugFlag2,
58076
58420
  templateData: templateDataFlag2,
58421
+ locale: localeFlag,
58422
+ timeZone: timeZoneFlag,
58077
58423
  replyTo: replyToMessageFlag,
58078
58424
  replyToAddress: replyToAddressFlag,
58079
58425
  idempotencyKey: idempotencyKeyFlag2,
@@ -58092,6 +58438,10 @@ var send2 = make28("send", {
58092
58438
  command: `samva email send --to you@example.com --template-slug welcome-email --template-data '{"name":"Ada"}'`,
58093
58439
  description: "Render a template by handle"
58094
58440
  },
58441
+ {
58442
+ command: `samva email send --to you@example.com --template-slug order-receipt --template-data '{"total":42}' --locale de-DE --time-zone Europe/Berlin`,
58443
+ description: "Render a template's dates and money for a locale and time zone"
58444
+ },
58095
58445
  {
58096
58446
  command: 'echo "Hello" | samva email send --to you@example.com --subject Hi --text -',
58097
58447
  description: "Pipe plain-text body from stdin"
@@ -58116,6 +58466,8 @@ var send2 = make28("send", {
58116
58466
  inputContractId,
58117
58467
  templateSlug,
58118
58468
  templateData,
58469
+ locale,
58470
+ timeZone,
58119
58471
  replyTo,
58120
58472
  replyToAddress,
58121
58473
  idempotencyKey,
@@ -58144,6 +58496,8 @@ var send2 = make28("send", {
58144
58496
  const ccValue = getOrUndefined(cc);
58145
58497
  const bccValue = getOrUndefined(bcc);
58146
58498
  const templateDataValue = yield* parseTemplateData2(templateData);
58499
+ const localeValue = getOrUndefined(locale);
58500
+ const timeZoneValue = getOrUndefined(timeZone);
58147
58501
  if (idempotencyKeyValue !== undefined && (idempotencyKeyValue.length < 1 || idempotencyKeyValue.length > 255)) {
58148
58502
  return yield* new SamvaCliError({
58149
58503
  message: "--idempotency-key must contain between 1 and 255 characters."
@@ -58155,6 +58509,11 @@ var send2 = make28("send", {
58155
58509
  });
58156
58510
  }
58157
58511
  const templateRefValue = templateSlugValue ?? templateIdValue;
58512
+ if ((localeValue !== undefined || timeZoneValue !== undefined) && !templateIdValue && !templateSlugValue) {
58513
+ return yield* new SamvaCliError({
58514
+ message: "--locale and --time-zone apply to template sends."
58515
+ });
58516
+ }
58158
58517
  if (templateRefValue && subjectValue) {
58159
58518
  return yield* new SamvaCliError({
58160
58519
  message: "Template sends derive their subject from the template. Omit --subject."
@@ -58196,6 +58555,8 @@ var send2 = make28("send", {
58196
58555
  ...reference,
58197
58556
  ...templateSlugValue === undefined ? {} : { templateSlug: templateSlugValue },
58198
58557
  ...templateDataValue === undefined ? {} : { templateData: templateDataValue },
58558
+ ...localeValue === undefined ? {} : { locale: localeValue },
58559
+ ...timeZoneValue === undefined ? {} : { timeZone: timeZoneValue },
58199
58560
  ...replyToValue === undefined ? {} : { inReplyToMessageId: replyToValue },
58200
58561
  ...replyToAddressValue === undefined ? {} : { replyTo: replyToAddressValue },
58201
58562
  ...trackOpensValue !== undefined || trackClicksValue !== undefined ? {
@@ -58453,7 +58814,7 @@ var remove16 = make28("remove", {
58453
58814
  dryRun: Boolean6("dry-run").pipe(withDescription2("Print the deletion plan without calling the API"), withDefault4(false)),
58454
58815
  yes: Boolean6("yes").pipe(withDescription2("Confirm permanent deletion (required for non-interactive use)"), withDefault4(false)),
58455
58816
  json: jsonFlag
58456
- }).pipe(withDescription3("Permanently remove a sender identity"), withExamples([
58817
+ }).pipe(withDescription3("Permanently remove a sender"), withExamples([
58457
58818
  { command: "samva email senders remove sender_abc123 --dry-run" },
58458
58819
  { command: "samva email senders remove sender_abc123 --yes" }
58459
58820
  ]), withHandler(({ id, dryRun, yes, json }) => gen2(function* () {
@@ -58613,13 +58974,13 @@ var emailCommand = make28("email").pipe(withDescription3("Send, inspect, and con
58613
58974
  trackingCommand
58614
58975
  ]));
58615
58976
 
58616
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/package.mjs
58977
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/package.mjs
58617
58978
  var version2 = "1.7.5";
58618
58979
 
58619
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/version.mjs
58980
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/version.mjs
58620
58981
  var PACKAGE_VERSION = version2;
58621
58982
 
58622
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/broadcast-channel.mjs
58983
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/broadcast-channel.mjs
58623
58984
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
58624
58985
  var now = () => Math.floor(Date.now() / 1000);
58625
58986
  var WindowBroadcastChannel = class {
@@ -58865,7 +59226,7 @@ var onMount = ($store, initialize) => {
58865
59226
  };
58866
59227
  });
58867
59228
  };
58868
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/equality.mjs
59229
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/equality.mjs
58869
59230
  function isPlainObject(value) {
58870
59231
  if (typeof value !== "object" || value === null)
58871
59232
  return false;
@@ -58902,7 +59263,7 @@ function withEquality(store, isEqual) {
58902
59263
  });
58903
59264
  }
58904
59265
 
58905
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/focus-manager.mjs
59266
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/focus-manager.mjs
58906
59267
  var kFocusManager = Symbol.for("better-auth:focus-manager");
58907
59268
  var WindowFocusManager = class {
58908
59269
  listeners = /* @__PURE__ */ new Set;
@@ -58934,7 +59295,7 @@ function getGlobalFocusManager() {
58934
59295
  return globalThis[kFocusManager];
58935
59296
  }
58936
59297
 
58937
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/online-manager.mjs
59298
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/online-manager.mjs
58938
59299
  var kOnlineManager = Symbol.for("better-auth:online-manager");
58939
59300
  var WindowOnlineManager = class {
58940
59301
  listeners = /* @__PURE__ */ new Set;
@@ -58968,7 +59329,7 @@ function getGlobalOnlineManager() {
58968
59329
  return globalThis[kOnlineManager];
58969
59330
  }
58970
59331
 
58971
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/parser.mjs
59332
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/parser.mjs
58972
59333
  var PROTO_POLLUTION_PATTERNS = {
58973
59334
  proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
58974
59335
  constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
@@ -59046,7 +59407,7 @@ function parseJSON(value, options = { strict: true }) {
59046
59407
  return betterJSONParse(value, options);
59047
59408
  }
59048
59409
 
59049
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/query.mjs
59410
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/query.mjs
59050
59411
  var isServer = () => typeof window === "undefined";
59051
59412
  function isAuthQueryStateEqual(a, b) {
59052
59413
  return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
@@ -59172,7 +59533,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
59172
59533
  return value;
59173
59534
  };
59174
59535
 
59175
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/session-refresh.mjs
59536
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/session-refresh.mjs
59176
59537
  var now2 = () => Math.floor(Date.now() / 1000);
59177
59538
  var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
59178
59539
  function createSessionRefreshManager(opts) {
@@ -59501,7 +59862,7 @@ var BetterAuthError = class extends Error {
59501
59862
  }
59502
59863
  };
59503
59864
 
59504
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/utils/url.mjs
59865
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/utils/url.mjs
59505
59866
  var SLASH_CHAR_CODE = 47;
59506
59867
  function trimTrailingSlashes(value) {
59507
59868
  let end = value.length;
@@ -59608,7 +59969,7 @@ function isSafeUrlScheme(value) {
59608
59969
  return !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);
59609
59970
  }
59610
59971
 
59611
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/fetch-plugins.mjs
59972
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/fetch-plugins.mjs
59612
59973
  var redirectPlugin = {
59613
59974
  id: "redirect",
59614
59975
  name: "Redirect",
@@ -59624,7 +59985,7 @@ var redirectPlugin = {
59624
59985
  } }
59625
59986
  };
59626
59987
 
59627
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/session-atom.mjs
59988
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/session-atom.mjs
59628
59989
  var isServer2 = () => typeof window === "undefined";
59629
59990
  var SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
59630
59991
  function hydrateSessionAtom(sessionAtom, session) {
@@ -60488,7 +60849,7 @@ var createFetch = (config) => {
60488
60849
  return $fetch;
60489
60850
  };
60490
60851
 
60491
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/config.mjs
60852
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/config.mjs
60492
60853
  var resolvePublicAuthUrl = (basePath) => {
60493
60854
  if (typeof process === "undefined")
60494
60855
  return;
@@ -60607,7 +60968,7 @@ var getClientConfig = (options, loadEnv) => {
60607
60968
  };
60608
60969
  };
60609
60970
 
60610
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/utils/is-atom.mjs
60971
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/utils/is-atom.mjs
60611
60972
  function isAtom(value) {
60612
60973
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
60613
60974
  }
@@ -60625,7 +60986,7 @@ function toKebabCase(input) {
60625
60986
  return splitWords(input).map((word) => word.toLowerCase()).join("-");
60626
60987
  }
60627
60988
 
60628
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/proxy.mjs
60989
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/proxy.mjs
60629
60990
  function getMethod2(path, knownPathMethods, args) {
60630
60991
  const method = knownPathMethods[path];
60631
60992
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -60707,7 +61068,7 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
60707
61068
  return createProxy();
60708
61069
  }
60709
61070
 
60710
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/client/vanilla.mjs
61071
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/client/vanilla.mjs
60711
61072
  function createAuthClient(options) {
60712
61073
  const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
60713
61074
  const resolvedHooks = {};
@@ -60721,7 +61082,7 @@ function createAuthClient(options) {
60721
61082
  $store
60722
61083
  }, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
60723
61084
  }
60724
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
61085
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
60725
61086
  var deviceAuthorizationClient = () => {
60726
61087
  return {
60727
61088
  id: "device-authorization",
@@ -60736,7 +61097,7 @@ var deviceAuthorizationClient = () => {
60736
61097
  }
60737
61098
  };
60738
61099
  };
60739
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/access/access.mjs
61100
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/access/access.mjs
60740
61101
  function unknownResourceResponse(requestedResource) {
60741
61102
  return {
60742
61103
  success: false,
@@ -60822,7 +61183,7 @@ function createAccessControl(s) {
60822
61183
  };
60823
61184
  }
60824
61185
 
60825
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
61186
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
60826
61187
  var defaultStatements = {
60827
61188
  organization: ["update", "delete"],
60828
61189
  member: [
@@ -60897,7 +61258,7 @@ var defaultRoles = {
60897
61258
  member: memberAc
60898
61259
  };
60899
61260
 
60900
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
61261
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
60901
61262
  var ORGANIZATION_ERROR_CODES = defineErrorCodes({
60902
61263
  YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
60903
61264
  YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
@@ -60960,7 +61321,7 @@ var ORGANIZATION_ERROR_CODES = defineErrorCodes({
60960
61321
  INVALID_TEAM_ID: "Team id contains a reserved character"
60961
61322
  });
60962
61323
 
60963
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/organization/permission.mjs
61324
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/organization/permission.mjs
60964
61325
  var hasPermissionFn = (input, acRoles) => {
60965
61326
  if (!input.permissions)
60966
61327
  return false;
@@ -60976,7 +61337,7 @@ var hasPermissionFn = (input, acRoles) => {
60976
61337
  return false;
60977
61338
  };
60978
61339
 
60979
- // ../../node_modules/.bun/better-auth@1.7.5+a39002ffdfd1704b/node_modules/better-auth/dist/plugins/organization/client.mjs
61340
+ // ../../node_modules/.bun/better-auth@1.7.5+d84e686d419eddf2/node_modules/better-auth/dist/plugins/organization/client.mjs
60980
61341
  var clientSideHasPermission = (input) => {
60981
61342
  return hasPermissionFn(input, input.options.roles || defaultRoles);
60982
61343
  };
@@ -61865,26 +62226,37 @@ var scheduledMessagesCommand = make28("scheduled-messages").pipe(withDescription
61865
62226
 
61866
62227
  // src/commands/templates.ts
61867
62228
  import { constants as constants2 } from "fs";
61868
- import { access as access3, stat as stat3 } from "fs/promises";
61869
- import { dirname as dirname3, resolve as resolve10 } from "path";
61870
- import { pathToFileURL as pathToFileURL2 } from "url";
62229
+ import { access as access3, stat as stat4 } from "fs/promises";
62230
+ import { dirname as dirname4, resolve as resolve14 } from "path";
62231
+ import { pathToFileURL as pathToFileURL3 } from "url";
61871
62232
 
61872
- // src/commands/templates/local-build.ts
62233
+ // src/commands/templates/dev-command.ts
61873
62234
  import { resolve as resolve6 } from "path";
61874
- var buildDir = (dir, assetBase) => tryPromise2({
62235
+
62236
+ // src/commands/templates/flags.ts
62237
+ var dirFlag = Directory2("dir").pipe(withDescription2("Directory containing your .tsx templates (default: templates/ and emails/, whichever exist)"), optional4);
62238
+ var assetBaseFlag = String8("asset-base").pipe(withDescription2("Actual HTTPS serving base for imported email assets"), optional4);
62239
+ var offlineFlag = Boolean6("offline").pipe(withDescription2("Use the cached brand in .samva/brands instead of fetching it"), withDefault4(false));
62240
+
62241
+ // src/commands/templates/toolchain.ts
62242
+ var TOOLCHAIN_INSTALL = "npm install --save-dev @samva/markup @samva/vite vite";
62243
+ var MISSING_MODULE = /Cannot find (?:package|module) '([^']+)'/;
62244
+ var toolchainFailure = (stderr, action) => {
62245
+ const missing = MISSING_MODULE.exec(stderr)?.[1];
62246
+ if (stderr.includes("`vite` is required")) {
62247
+ return `${action}: vite is not installed in this project. Install the authoring toolchain with \`${TOOLCHAIN_INSTALL}\`.`;
62248
+ }
62249
+ if (missing !== undefined && /^(@samva\/|vite)/.test(missing)) {
62250
+ return `${action}: ${missing} is not installed in this project. Install the authoring toolchain with \`${TOOLCHAIN_INSTALL}\`.`;
62251
+ }
62252
+ return `${action}: ${stderr.trim() || "the toolchain process failed."}`;
62253
+ };
62254
+ var NODE_MISSING = "Install Node.js 22+ to run template authoring commands.";
62255
+ var runToolchain = (input) => tryPromise2({
61875
62256
  try: async () => {
61876
- const child = Bun.spawn([
61877
- "node",
61878
- "--input-type=module",
61879
- "--eval",
61880
- 'import { buildTemplates } from "@samva/vite/build"; const dir = process.env.SAMVA_TEMPLATE_BUILD_DIR; if (dir === undefined) throw new Error("SAMVA_TEMPLATE_BUILD_DIR is required"); const result = await buildTemplates(dir, { root: process.cwd(), assetBase: process.env.SAMVA_TEMPLATE_ASSET_BASE }); process.stdout.write(JSON.stringify(result));'
61881
- ], {
62257
+ const child = Bun.spawn(["node", "--input-type=module", "--eval", input.script], {
61882
62258
  cwd: process.cwd(),
61883
- env: {
61884
- ...Bun.env,
61885
- SAMVA_TEMPLATE_BUILD_DIR: resolve6(dir),
61886
- SAMVA_TEMPLATE_ASSET_BASE: assetBase
61887
- },
62259
+ env: { ...Bun.env, SAMVA_TOOLCHAIN_INPUT: JSON.stringify(input.options) },
61888
62260
  stdout: "pipe",
61889
62261
  stderr: "pipe"
61890
62262
  });
@@ -61894,17 +62266,122 @@ var buildDir = (dir, assetBase) => tryPromise2({
61894
62266
  child.exited
61895
62267
  ]);
61896
62268
  if (exitCode !== 0) {
61897
- return Promise.reject(new SamvaCliError({ message: stderr.trim() || "Template build process failed." }));
62269
+ return Promise.reject(new SamvaCliError({ message: toolchainFailure(stderr, input.action) }));
61898
62270
  }
61899
62271
  return JSON.parse(stdout);
61900
62272
  },
61901
- catch: (cause) => new SamvaCliError({
61902
- message: `Could not build templates in ${dir}. Install Node.js 22+, @samva/markup, @samva/vite, and vite in this project: ${String(cause)}`
62273
+ catch: (cause) => cause instanceof SamvaCliError ? cause : new SamvaCliError({
62274
+ message: `${input.action}: ${NODE_MISSING} ${String(cause)}`
62275
+ })
62276
+ });
62277
+ var OPTIONS_PRELUDE = "const options = JSON.parse(process.env.SAMVA_TOOLCHAIN_INPUT);";
62278
+
62279
+ // src/commands/templates/dev-command.ts
62280
+ var DEV_SCRIPT = `import { startDevServer } from "@samva/vite/dev";
62281
+ ${OPTIONS_PRELUDE}
62282
+ const server = await startDevServer(options);
62283
+ process.stdout.write("Samva template editor: " + server.url + "\\nPress Ctrl+C to stop.\\n");
62284
+ const stop = () => { server.close().finally(() => process.exit(0)); };
62285
+ process.on("SIGINT", stop);
62286
+ process.on("SIGTERM", stop);`;
62287
+ var runDevServer = (input) => tryPromise2({
62288
+ try: async () => {
62289
+ const child = Bun.spawn(["node", "--input-type=module", "--eval", DEV_SCRIPT], {
62290
+ cwd: process.cwd(),
62291
+ env: {
62292
+ ...Bun.env,
62293
+ SAMVA_TOOLCHAIN_INPUT: JSON.stringify({
62294
+ root: process.cwd(),
62295
+ ...input.dir === undefined ? {} : { dir: input.dir },
62296
+ ...input.port === undefined ? {} : { port: input.port },
62297
+ ...input.host === undefined ? {} : { host: input.host },
62298
+ open: input.open
62299
+ })
62300
+ },
62301
+ stdout: "inherit",
62302
+ stderr: "pipe"
62303
+ });
62304
+ const forward = (signal) => () => child.kill(signal);
62305
+ const onInterrupt = forward("SIGINT");
62306
+ const onTerminate = forward("SIGTERM");
62307
+ process.on("SIGINT", onInterrupt);
62308
+ process.on("SIGTERM", onTerminate);
62309
+ let stderr = "";
62310
+ const drain = (async () => {
62311
+ for await (const chunk of child.stderr) {
62312
+ stderr += Buffer.from(chunk).toString();
62313
+ process.stderr.write(chunk);
62314
+ }
62315
+ })();
62316
+ const exitCode = await child.exited;
62317
+ await drain;
62318
+ process.off("SIGINT", onInterrupt);
62319
+ process.off("SIGTERM", onTerminate);
62320
+ if (exitCode !== 0 && child.signalCode === null) {
62321
+ return Promise.reject(new SamvaCliError({
62322
+ message: toolchainFailure(stderr, "Could not start the template editor")
62323
+ }));
62324
+ }
62325
+ },
62326
+ catch: (cause) => cause instanceof SamvaCliError ? cause : new SamvaCliError({
62327
+ message: `Could not start the template editor. Install Node.js 22+: ${String(cause)}`
61903
62328
  })
61904
62329
  });
62330
+ var devCommand = make28("dev", {
62331
+ dir: dirFlag,
62332
+ port: Int5("port").pipe(withDescription2("Port to listen on (default: Vite's, 5173, or the next free one)"), optional4),
62333
+ host: String8("host").pipe(withDescription2("Interface to listen on (default: loopback only)"), optional4),
62334
+ open: Boolean6("open").pipe(withDescription2("Open the editor in a browser once it is listening"), withDefault4(false))
62335
+ }).pipe(withDescription3("Start the local visual editor for the templates in this project; no vite.config.ts needed"), withExamples([
62336
+ { command: "samva templates dev", description: "Serve templates/ and emails/" },
62337
+ {
62338
+ command: "samva templates dev --dir templates --port 4000 --open",
62339
+ description: "Serve one directory on a fixed port and open the browser"
62340
+ }
62341
+ ]), withHandler(({ dir, port, host, open }) => runDevServer({
62342
+ dir: map(dir, (value) => resolve6(value)).pipe(getOrUndefined),
62343
+ port: getOrUndefined(port),
62344
+ host: getOrUndefined(host),
62345
+ open
62346
+ })));
61905
62347
 
61906
- // src/commands/templates/project.ts
62348
+ // src/commands/templates/diagnostics.ts
62349
+ var reportDiagnostic = (diagnostic, context) => {
62350
+ const origin = diagnostic.origins[0];
62351
+ const range = diagnostic.range ?? (origin === undefined ? undefined : { start: { line: origin.lineNumber, column: origin.columnNumber } });
62352
+ return {
62353
+ file: origin?.fileName ?? context.file,
62354
+ code: diagnostic.code,
62355
+ severity: diagnostic.severity,
62356
+ message: diagnostic.message,
62357
+ ...origin === undefined ? {} : { line: origin.lineNumber, column: origin.columnNumber },
62358
+ ...range === undefined ? {} : { range },
62359
+ ...diagnostic.fix === undefined ? {} : { fix: diagnostic.fix },
62360
+ ...diagnostic.edit === undefined ? {} : { edit: diagnostic.edit },
62361
+ ...context.fixture === undefined ? {} : { fixture: context.fixture }
62362
+ };
62363
+ };
62364
+ var formatReportedDiagnostic = (diagnostic) => {
62365
+ const at = diagnostic.line === undefined ? diagnostic.file : `${diagnostic.file}:${diagnostic.line}${diagnostic.column === undefined ? "" : `:${diagnostic.column}`}`;
62366
+ const head = `${at} ${diagnostic.severity} ${diagnostic.code}: ${diagnostic.message}`;
62367
+ return diagnostic.fix === undefined ? head : `${head}
62368
+ Fix: ${diagnostic.fix}`;
62369
+ };
62370
+
62371
+ // src/commands/templates/local-build.ts
61907
62372
  import { resolve as resolve7 } from "path";
62373
+ var buildDir = (dir, assetBase) => runToolchain({
62374
+ action: `Could not build templates${dir === undefined ? "" : ` in ${dir}`}`,
62375
+ options: {
62376
+ root: process.cwd(),
62377
+ ...dir === undefined ? {} : { dir: resolve7(dir) },
62378
+ ...assetBase === undefined ? {} : { assetBase }
62379
+ },
62380
+ script: `import { buildTemplates } from "@samva/vite/build"; ${OPTIONS_PRELUDE} process.stdout.write(JSON.stringify(await buildTemplates(options)));`
62381
+ });
62382
+
62383
+ // src/commands/templates/project.ts
62384
+ import { resolve as resolve8 } from "path";
61908
62385
  var templateId = String9("id").pipe(withDescription4("Template id"));
61909
62386
  var projectOrTemplateId = String9("id").pipe(withDescription4("Template project id (tproj_...) or the id of any template in it"));
61910
62387
  var runGit = (args, options = {}) => tryPromise2({
@@ -61993,7 +62470,7 @@ var cloneProject = fn2("Templates.cloneProject")(function* (input) {
61993
62470
  ], { concurrency: 2 }).pipe(mapError2((error) => new SamvaCliError({
61994
62471
  message: formatApiError("Could not resolve template project", error)
61995
62472
  })));
61996
- const root = resolve7(input.dir);
62473
+ const root = resolve8(input.dir);
61997
62474
  const helper = yield* helperCommand(template.id, "read");
61998
62475
  yield* runGit([
61999
62476
  "-c",
@@ -62083,7 +62560,7 @@ var init = make28("init", {
62083
62560
  description: "Create deterministically for CI or a coding agent"
62084
62561
  }
62085
62562
  ]), withHandler(({ name, projectName, slug, dir, idempotencyKey, dryRun, json }) => gen2(function* () {
62086
- const root = resolve7(getOrElse(dir, () => projectDirectory(name)));
62563
+ const root = resolve8(getOrElse(dir, () => projectDirectory(name)));
62087
62564
  const key = getOrUndefined(idempotencyKey);
62088
62565
  const request = {
62089
62566
  name,
@@ -62179,37 +62656,36 @@ var resolveProjectId = fn2("Templates.resolveProjectId")(function* (flag) {
62179
62656
  }
62180
62657
  return projectId;
62181
62658
  });
62182
- var ENTRY_PATH = /^emails\/.+\.tsx$/;
62659
+ var ENTRY_ROOTS = ["templates", "emails"];
62660
+ var ENTRY_PATH = new RegExp(`^(?:${ENTRY_ROOTS.join("|")})/.+\\.tsx$`);
62661
+ var ENTRY_ROOTS_LABEL = ENTRY_ROOTS.map((root) => `${root}/*.tsx`).join(" or ");
62183
62662
  var TEMPLATE_SLUG = /^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$/;
62184
62663
  var entryPathArgument = (name, description) => String9(name).pipe(withDescription4(description), filterMap3((value) => {
62185
62664
  const normalized = value.replace(/^\.\//, "");
62186
62665
  return ENTRY_PATH.test(normalized) ? some2(normalized) : none2();
62187
- }, (value) => `${value} is not an emails/*.tsx entry path`));
62666
+ }, (value) => `${value} is not a ${ENTRY_ROOTS_LABEL} entry path`));
62188
62667
  var humanize2 = (id) => {
62189
62668
  const words = id.replace(/[-_.]+/g, " ").trim();
62190
62669
  return words.charAt(0).toUpperCase() + words.slice(1);
62191
62670
  };
62192
62671
  var declaredTemplateId = fn2("Templates.declaredTemplateId")(function* (entryPath) {
62193
- const built = yield* buildDir("emails", undefined);
62194
- const file = built.files.find(({ id }) => `emails/${id}` === entryPath);
62195
- if (file === undefined || file.preview.kind !== "email")
62196
- return;
62197
- return file.preview.templates[0]?.name;
62672
+ const built = yield* buildDir(undefined, undefined);
62673
+ return built.files.find(({ id }) => id === entryPath)?.template?.template;
62198
62674
  });
62199
62675
  var add4 = make28("add", {
62200
- entry: entryPathArgument("entry", "Entry file to register, such as emails/reset.tsx"),
62201
- name: String8("name").pipe(withDescription2("Template name (defaults from the entry's defineEmail id)"), optional4),
62202
- slug: String8("slug").pipe(withDescription2("Template handle (defaults to the entry's defineEmail id)"), optional4),
62676
+ entry: entryPathArgument("entry", "Entry file to register, such as templates/reset.tsx"),
62677
+ name: String8("name").pipe(withDescription2("Template name (defaults from the entry's defineTemplate id)"), optional4),
62678
+ slug: String8("slug").pipe(withDescription2("Template handle (defaults to the entry's defineTemplate id)"), optional4),
62203
62679
  projectId: projectIdFlag,
62204
62680
  dryRun: Boolean6("dry-run").pipe(withDescription2("Show the registration request without writing"), withDefault4(false)),
62205
62681
  json: jsonFlag
62206
- }).pipe(withDescription3("Register another email entry in a template project"), withExamples([
62682
+ }).pipe(withDescription3("Register another template entry in a template project"), withExamples([
62207
62683
  {
62208
- command: "samva templates add emails/reset.tsx",
62209
- description: "Register a local entry under the handle its defineEmail id declares"
62684
+ command: "samva templates add templates/reset.tsx",
62685
+ description: "Register a local entry under the handle its defineTemplate id declares"
62210
62686
  },
62211
62687
  {
62212
- command: 'samva templates add emails/reset.tsx --slug password-reset --name "Password reset"',
62688
+ command: 'samva templates add templates/reset.tsx --slug password-reset --name "Password reset"',
62213
62689
  description: "Register an entry that is not written yet, or override the defaults"
62214
62690
  }
62215
62691
  ]), withHandler(({ entry, name, slug, projectId, dryRun, json }) => gen2(function* () {
@@ -62220,12 +62696,12 @@ var add4 = make28("add", {
62220
62696
  const resolvedSlug = explicitSlug ?? declared;
62221
62697
  if (resolvedSlug === undefined) {
62222
62698
  return yield* new SamvaCliError({
62223
- message: `${entry} does not build to a defineEmail template here. Pass --slug and --name to register it before it exists.`
62699
+ message: `${entry} does not build to a defineTemplate template here. Pass --slug and --name to register it before it exists.`
62224
62700
  });
62225
62701
  }
62226
62702
  if (!TEMPLATE_SLUG.test(resolvedSlug)) {
62227
62703
  return yield* new SamvaCliError({
62228
- message: `defineEmail id ${JSON.stringify(resolvedSlug)} is not a valid handle (lowercase kebab-case). Pass --slug.`
62704
+ message: `defineTemplate id ${JSON.stringify(resolvedSlug)} is not a valid handle (lowercase kebab-case). Pass --slug.`
62229
62705
  });
62230
62706
  }
62231
62707
  const request = {
@@ -62267,7 +62743,7 @@ var move = make28("move", {
62267
62743
  json: jsonFlag
62268
62744
  }).pipe(withDescription3("Point a template at another entry file in its project"), withExamples([
62269
62745
  {
62270
- command: "samva templates move emails/reset.tsx emails/account/reset.tsx",
62746
+ command: "samva templates move templates/reset.tsx templates/account/reset.tsx",
62271
62747
  description: "Keep the template's id, handle, and publications after `git mv`"
62272
62748
  }
62273
62749
  ]), withHandler(({ from, to, projectId, json }) => gen2(function* () {
@@ -62291,7 +62767,14 @@ var move = make28("move", {
62291
62767
  Publish fails until a pushed commit has ${to}; move the file with \`git mv\` if you have not.`);
62292
62768
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
62293
62769
  var unregisteredEntries = fn2("Templates.unregisteredEntries")(function* (commit, templates) {
62294
- const matches = yield* runGit(["grep", "-l", "defineEmail", commit, "--", "emails/"]).pipe(catch_2(() => succeed6("")));
62770
+ const matches = yield* runGit([
62771
+ "grep",
62772
+ "-l",
62773
+ "defineTemplate",
62774
+ commit,
62775
+ "--",
62776
+ ...ENTRY_ROOTS.map((root) => `${root}/`)
62777
+ ]).pipe(catch_2(() => succeed6("")));
62295
62778
  const registered = new Set(templates.map(({ entryPath }) => entryPath));
62296
62779
  return matches.split(`
62297
62780
  `).map((line) => line.slice(line.indexOf(":") + 1)).filter((path) => ENTRY_PATH.test(path) && !registered.has(path));
@@ -62327,7 +62810,7 @@ var publish2 = make28("publish", {
62327
62810
  json: jsonFlag
62328
62811
  }).pipe(withDescription3("Publish template entries at an exact clean, pushed commit"), withExamples([
62329
62812
  {
62330
- command: "samva templates publish emails/reset.tsx",
62813
+ command: "samva templates publish templates/reset.tsx",
62331
62814
  description: "Publish one entry at the current commit"
62332
62815
  },
62333
62816
  {
@@ -62420,8 +62903,489 @@ ${lines.join(`
62420
62903
  `)}`);
62421
62904
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
62422
62905
 
62906
+ // src/commands/templates/render-command.ts
62907
+ import { mkdir as mkdir2, writeFile as writeFile3 } from "fs/promises";
62908
+ import { dirname as dirname2, resolve as resolve10 } from "path";
62909
+
62910
+ // src/commands/templates/local-render.ts
62911
+ import { resolve as resolve9 } from "path";
62912
+ var renderLocal = (input) => runToolchain({
62913
+ action: `Could not render ${input.template}`,
62914
+ options: {
62915
+ root: process.cwd(),
62916
+ template: input.template,
62917
+ fixture: input.fixture,
62918
+ channel: input.channel,
62919
+ ...input.dir === undefined ? {} : { dir: resolve9(input.dir) },
62920
+ ...input.locale === undefined ? {} : { locale: input.locale },
62921
+ ...input.timeZone === undefined ? {} : { timeZone: input.timeZone },
62922
+ ...input.assetBase === undefined ? {} : { assetBase: input.assetBase },
62923
+ ...input.offline === true ? { offline: true } : {}
62924
+ },
62925
+ script: `import { renderChannel, renderTemplate } from "@samva/vite/render"; ${OPTIONS_PRELUDE} const { channel, ...rest } = options; const result = channel === "email" ? await renderTemplate(rest) : await renderChannel({ ...rest, channel }); process.stdout.write(JSON.stringify(result));`
62926
+ });
62927
+
62928
+ // src/commands/templates/render-command.ts
62929
+ var renderPayload = (result, out) => ({
62930
+ action: "templates.render",
62931
+ ...result,
62932
+ diagnostics: result.diagnostics.map((diagnostic) => reportDiagnostic(diagnostic, { file: "." })),
62933
+ ...out === undefined ? {} : { out }
62934
+ });
62935
+ var renderedBody = (result, format) => {
62936
+ if ("html" in result) {
62937
+ if (format === "html")
62938
+ return result.html;
62939
+ return [
62940
+ `Subject: ${result.subject}`,
62941
+ ...result.preheader === undefined ? [] : [`Preheader: ${result.preheader}`],
62942
+ "",
62943
+ result.text
62944
+ ].join(`
62945
+ `);
62946
+ }
62947
+ if ("message" in result) {
62948
+ const { header, body, footer, buttons } = result.message;
62949
+ return [
62950
+ ...header === undefined ? [] : [`Header (${header.type}): ${header.text}`, ""],
62951
+ body,
62952
+ ...footer === undefined ? [] : ["", footer],
62953
+ ...buttons.length === 0 ? [] : ["", ...buttons.map((button) => `[${JSON.stringify(button)}]`)]
62954
+ ].join(`
62955
+ `);
62956
+ }
62957
+ return result.text;
62958
+ };
62959
+ var renderCommand = make28("render", {
62960
+ template: String9("template").pipe(withDescription4("Template id, or the path of its .tsx entry")),
62961
+ fixture: String8("fixture").pipe(withDescription2("Fixture to render, such as no-tracking")),
62962
+ channel: Literals3("channel", ["email", "sms", "whatsapp"]).pipe(withDescription2("Channel to render"), withDefault4("email")),
62963
+ dir: dirFlag,
62964
+ locale: String8("locale").pipe(withDescription2("Locale for formatters (default: the template's)"), optional4),
62965
+ timeZone: String8("time-zone").pipe(withDescription2("IANA time zone for date and time formatters (default: UTC)"), optional4),
62966
+ assetBase: assetBaseFlag,
62967
+ offline: offlineFlag,
62968
+ format: Literals3("format", ["text", "html", "json"]).pipe(withDescription2("text: subject, preheader and plain-text body; html: the HTML; json: the full result"), withDefault4("text")),
62969
+ out: File3("out").pipe(withDescription2("Write the rendered output to a file instead of stdout"), optional4),
62970
+ json: jsonFlag
62971
+ }).pipe(withDescription3("Render one fixture of a local template and print the result"), withExamples([
62972
+ {
62973
+ command: "samva templates render welcome --fixture no-tracking",
62974
+ description: "Print the subject, preheader and plain-text body"
62975
+ },
62976
+ {
62977
+ command: "samva templates render welcome --fixture default --format html --out welcome.html",
62978
+ description: "Write the rendered HTML to a file"
62979
+ },
62980
+ {
62981
+ command: "samva templates render welcome --fixture default --json",
62982
+ description: "Print the full result with located findings, fixes and edits"
62983
+ },
62984
+ {
62985
+ command: "samva templates render order-shipped --fixture default --channel sms",
62986
+ description: "Render the SMS body of a multi-channel template"
62987
+ }
62988
+ ]), withHandler(({
62989
+ template,
62990
+ fixture,
62991
+ channel,
62992
+ dir,
62993
+ locale,
62994
+ timeZone,
62995
+ assetBase,
62996
+ offline,
62997
+ format,
62998
+ out,
62999
+ json
63000
+ }) => gen2(function* () {
63001
+ const machine = json || format === "json";
63002
+ const outPath = map(out, (value) => resolve10(value)).pipe(getOrUndefined);
63003
+ const result = yield* renderLocal({
63004
+ template,
63005
+ fixture,
63006
+ channel,
63007
+ dir: getOrUndefined(dir),
63008
+ locale: getOrUndefined(locale),
63009
+ timeZone: getOrUndefined(timeZone),
63010
+ assetBase: getOrUndefined(assetBase),
63011
+ offline
63012
+ });
63013
+ if (!result.ok) {
63014
+ const message = `Could not render ${template} (${fixture}): ${result.diagnostics.length} finding(s).`;
63015
+ if (machine) {
63016
+ return yield* new CliResultError({
63017
+ code: "template_render_failed",
63018
+ message,
63019
+ result: renderPayload(result, undefined),
63020
+ human: message
63021
+ });
63022
+ }
63023
+ for (const diagnostic of result.diagnostics) {
63024
+ yield* error(formatReportedDiagnostic(reportDiagnostic(diagnostic, { file: "." })));
63025
+ }
63026
+ return yield* new SamvaCliError({ message });
63027
+ }
63028
+ const payload = renderPayload(result, outPath);
63029
+ if (outPath !== undefined) {
63030
+ const content = machine ? `${JSON.stringify(payload, null, 2)}
63031
+ ` : `${renderedBody(result, format)}
63032
+ `;
63033
+ yield* tryPromise2({
63034
+ try: async () => {
63035
+ await mkdir2(dirname2(outPath), { recursive: true });
63036
+ await writeFile3(outPath, content);
63037
+ },
63038
+ catch: (cause) => new SamvaCliError({ message: `Could not write ${outPath}: ${String(cause)}` })
63039
+ });
63040
+ }
63041
+ if (machine)
63042
+ return yield* printJson(payload);
63043
+ for (const diagnostic of result.diagnostics) {
63044
+ yield* error(formatReportedDiagnostic(reportDiagnostic(diagnostic, { file: "." })));
63045
+ }
63046
+ if (outPath !== undefined)
63047
+ return yield* logInfo(`Wrote ${outPath}`);
63048
+ yield* log(renderedBody(result, format));
63049
+ }).pipe(json || format === "json" ? provideService2(MinimumLogLevel2, "None") : identity)));
63050
+
63051
+ // src/commands/templates/snapshot-command.ts
63052
+ import { resolve as resolve11 } from "path";
63053
+
63054
+ // src/commands/templates/snapshot-browser.ts
63055
+ import { existsSync } from "fs";
63056
+ import { copyFile as copyFile3, mkdir as mkdir3, mkdtemp as mkdtemp2, readFile as readFile4, rm as rm2, stat as stat3, writeFile as writeFile4 } from "fs/promises";
63057
+ import { tmpdir as tmpdir2 } from "os";
63058
+ import { join as join4 } from "path";
63059
+ import { pathToFileURL as pathToFileURL2 } from "url";
63060
+ var VIEWPORTS = {
63061
+ desktop: { width: 1280, height: 800 },
63062
+ mobile: { width: 390, height: 844 }
63063
+ };
63064
+ var SCHEMES = ["light", "dark"];
63065
+ var BROWSER_REMEDY = "Install a browser to screenshot with: add `playwright` to this project (`npm install --save-dev playwright && npx playwright install chromium`), or install Google Chrome or Chromium and set SAMVA_CHROME to its executable path if it is not in the usual location.";
63066
+ var snapshotFileName = (template, fixture, viewport, scheme) => `${template}-${fixture}-${viewport}-${scheme}.png`;
63067
+ var takeSnapshots = async (input) => {
63068
+ await mkdir3(input.outDir, { recursive: true });
63069
+ const scratch = await mkdtemp2(join4(tmpdir2(), "samva-snapshot-"));
63070
+ const htmlPath = join4(scratch, "page.html");
63071
+ await writeFile4(htmlPath, input.html);
63072
+ const requests = input.viewports.flatMap((viewport) => input.schemes.map((scheme) => ({
63073
+ htmlPath,
63074
+ viewport,
63075
+ width: VIEWPORTS[viewport].width,
63076
+ height: VIEWPORTS[viewport].height,
63077
+ scheme,
63078
+ outFile: join4(input.outDir, snapshotFileName(input.template, input.fixture, viewport, scheme))
63079
+ })));
63080
+ const reasons = [];
63081
+ try {
63082
+ for (const launcher of input.launchers) {
63083
+ const outcome = await launcher.capture(requests);
63084
+ if (outcome.status === "done")
63085
+ return {
63086
+ ok: true,
63087
+ browser: launcher.name,
63088
+ files: requests.map(({ viewport, scheme, width, outFile }) => ({
63089
+ viewport,
63090
+ scheme,
63091
+ width,
63092
+ path: outFile
63093
+ }))
63094
+ };
63095
+ reasons.push(`${launcher.name}: ${outcome.reason}`);
63096
+ }
63097
+ return { ok: false, reasons };
63098
+ } finally {
63099
+ await rm2(scratch, { recursive: true, force: true });
63100
+ }
63101
+ };
63102
+ var CHROME_PATHS = [
63103
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
63104
+ "/Applications/Chromium.app/Contents/MacOS/Chromium",
63105
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
63106
+ "/usr/bin/google-chrome",
63107
+ "/usr/bin/google-chrome-stable",
63108
+ "/usr/bin/chromium",
63109
+ "/usr/bin/chromium-browser",
63110
+ "/snap/bin/chromium"
63111
+ ];
63112
+ var CHROME_COMMANDS = ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"];
63113
+ var findChrome = (env, which = (command) => Bun.which(command), exists = existsSync) => {
63114
+ const override = env["SAMVA_CHROME"];
63115
+ if (override !== undefined && override !== "")
63116
+ return override;
63117
+ return CHROME_PATHS.find((path) => exists(path)) ?? CHROME_COMMANDS.map((command) => which(command)).find((path) => path !== null) ?? undefined;
63118
+ };
63119
+ var chromeScreenshotArgs = (input) => [
63120
+ "--headless=new",
63121
+ "--disable-gpu",
63122
+ "--hide-scrollbars",
63123
+ "--disable-background-networking",
63124
+ "--disable-component-update",
63125
+ "--no-first-run",
63126
+ "--no-default-browser-check",
63127
+ `--user-data-dir=${input.profile}`,
63128
+ `--window-size=${input.width},${input.height}`,
63129
+ `--blink-settings=preferredColorScheme=${input.scheme === "dark" ? 1 : 0}`,
63130
+ `--screenshot=${input.outFile}`,
63131
+ input.url
63132
+ ];
63133
+ var chromeMeasureArgs = (input) => [
63134
+ "--headless=new",
63135
+ "--disable-gpu",
63136
+ "--hide-scrollbars",
63137
+ "--disable-background-networking",
63138
+ "--disable-component-update",
63139
+ "--no-first-run",
63140
+ "--no-default-browser-check",
63141
+ `--user-data-dir=${input.profile}`,
63142
+ `--window-size=${input.width},${input.height}`,
63143
+ `--blink-settings=preferredColorScheme=${input.scheme === "dark" ? 1 : 0}`,
63144
+ "--dump-dom",
63145
+ input.url
63146
+ ];
63147
+ var MEASURE_SCRIPT = "<script>addEventListener('load',()=>{document.documentElement.setAttribute('data-samva-height',String(Math.ceil(Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0))))})</script>";
63148
+ var withMeasurement = (html) => /<\/body>/i.test(html) ? html.replace(/<\/body>/i, `${MEASURE_SCRIPT}</body>`) : `${html}${MEASURE_SCRIPT}`;
63149
+ var parseMeasuredHeight = (dom) => {
63150
+ const height = /data-samva-height="(\d+)"/.exec(dom)?.[1];
63151
+ return height === undefined ? undefined : Number(height);
63152
+ };
63153
+ var RUN_TIMEOUT_MS = 30000;
63154
+ var POLL_MS = 100;
63155
+ var runProcess = async (command, args, until) => {
63156
+ const child = Bun.spawn([command, ...args], { stdout: "pipe", stderr: "pipe" });
63157
+ let stdout = "";
63158
+ let stderr = "";
63159
+ const drain = async (stream, sink) => {
63160
+ for await (const chunk of stream)
63161
+ sink(Buffer.from(chunk).toString());
63162
+ };
63163
+ drain(child.stdout, (text) => {
63164
+ stdout += text;
63165
+ });
63166
+ drain(child.stderr, (text) => {
63167
+ stderr += text;
63168
+ });
63169
+ const deadline = Date.now() + RUN_TIMEOUT_MS;
63170
+ const produced = async () => until.stdoutIncludes !== undefined && stdout.includes(until.stdoutIncludes) || until.file !== undefined && existsSync(until.file) && (await stat3(until.file)).size > 0;
63171
+ const state = { exited: false };
63172
+ child.exited.then(() => {
63173
+ state.exited = true;
63174
+ });
63175
+ while (!state.exited && Date.now() < deadline && !await produced()) {
63176
+ await new Promise((done) => setTimeout(done, POLL_MS));
63177
+ }
63178
+ if (!state.exited) {
63179
+ await new Promise((done) => setTimeout(done, POLL_MS * 3));
63180
+ child.kill("SIGKILL");
63181
+ }
63182
+ await child.exited;
63183
+ return { code: state.exited ? child.exitCode : null, stdout, stderr };
63184
+ };
63185
+ var chromeLauncher = (binary, run = runProcess) => ({
63186
+ name: "Chrome",
63187
+ capture: async (requests) => {
63188
+ if (binary === undefined)
63189
+ return {
63190
+ status: "unavailable",
63191
+ reason: "no Chrome or Chromium found in the usual locations and SAMVA_CHROME is not set"
63192
+ };
63193
+ const profile = await mkdtemp2(join4(tmpdir2(), "samva-chrome-"));
63194
+ try {
63195
+ for (const request of requests) {
63196
+ const source = await readFile4(request.htmlPath, "utf8");
63197
+ const measured = request.htmlPath.replace(/\.html$/, `.${request.viewport}.${request.scheme}.html`);
63198
+ await writeFile4(measured, withMeasurement(source));
63199
+ const measure = await run(binary, chromeMeasureArgs({
63200
+ profile,
63201
+ width: request.width,
63202
+ height: request.height,
63203
+ scheme: request.scheme,
63204
+ url: pathToFileURL2(measured).href
63205
+ }), { stdoutIncludes: "</html>" });
63206
+ const height = Math.max(request.height, parseMeasuredHeight(measure.stdout) ?? request.height);
63207
+ const staged = join4(profile, `shot-${request.viewport}-${request.scheme}.png`);
63208
+ const shot = await run(binary, chromeScreenshotArgs({
63209
+ profile,
63210
+ width: request.width,
63211
+ height,
63212
+ scheme: request.scheme,
63213
+ outFile: staged,
63214
+ url: pathToFileURL2(request.htmlPath).href
63215
+ }), { file: staged });
63216
+ if (!existsSync(staged))
63217
+ return {
63218
+ status: "unavailable",
63219
+ reason: `${binary} did not produce a screenshot (exit ${shot.code ?? "killed"}): ${shot.stderr.trim().split(`
63220
+ `).slice(-3).join(" ")}`
63221
+ };
63222
+ await copyFile3(staged, request.outFile);
63223
+ }
63224
+ return { status: "done" };
63225
+ } finally {
63226
+ await rm2(profile, { recursive: true, force: true });
63227
+ }
63228
+ }
63229
+ });
63230
+ var PLAYWRIGHT_SCRIPT = `
63231
+ const options = JSON.parse(process.env.SAMVA_TOOLCHAIN_INPUT);
63232
+ const load = async () => {
63233
+ for (const name of ["playwright", "playwright-core"]) {
63234
+ try { return await import(name); } catch {}
63235
+ }
63236
+ return undefined;
63237
+ };
63238
+ const done = (value) => process.stdout.write(JSON.stringify(value));
63239
+ const playwright = await load();
63240
+ if (playwright === undefined) {
63241
+ done({ status: "unavailable", reason: "neither playwright nor playwright-core is installed in this project" });
63242
+ } else {
63243
+ const chromium = playwright.chromium ?? playwright.default?.chromium;
63244
+ let browser;
63245
+ let failure = "";
63246
+ for (const launch of [{}, { channel: "chrome" }]) {
63247
+ try { browser = await chromium.launch(launch); break; } catch (error) { failure = String(error?.message ?? error).split("\\n")[0]; }
63248
+ }
63249
+ if (browser === undefined) {
63250
+ done({ status: "unavailable", reason: "playwright could not launch a browser (" + failure + ")" });
63251
+ } else {
63252
+ try {
63253
+ for (const request of options.requests) {
63254
+ const context = await browser.newContext({
63255
+ viewport: { width: request.width, height: request.height },
63256
+ colorScheme: request.scheme,
63257
+ });
63258
+ const page = await context.newPage();
63259
+ await page.goto(options.urls[request.htmlPath]);
63260
+ await page.screenshot({ path: request.outFile, fullPage: true });
63261
+ await context.close();
63262
+ }
63263
+ done({ status: "done" });
63264
+ } finally {
63265
+ await browser.close();
63266
+ }
63267
+ }
63268
+ }
63269
+ `;
63270
+ var playwrightLauncher = () => ({
63271
+ name: "Playwright",
63272
+ capture: async (requests) => {
63273
+ const urls = Object.fromEntries([...new Set(requests.map((request) => request.htmlPath))].map((path) => [
63274
+ path,
63275
+ pathToFileURL2(path).href
63276
+ ]));
63277
+ const child = Bun.spawn(["node", "--input-type=module", "--eval", PLAYWRIGHT_SCRIPT], {
63278
+ cwd: process.cwd(),
63279
+ env: { ...Bun.env, SAMVA_TOOLCHAIN_INPUT: JSON.stringify({ requests, urls }) },
63280
+ stdout: "pipe",
63281
+ stderr: "pipe"
63282
+ });
63283
+ const [stdout, stderr, code] = await Promise.all([
63284
+ new Response(child.stdout).text(),
63285
+ new Response(child.stderr).text(),
63286
+ child.exited
63287
+ ]);
63288
+ if (code !== 0)
63289
+ return {
63290
+ status: "unavailable",
63291
+ reason: stderr.trim().split(`
63292
+ `).slice(-3).join(" ") || `node exited ${code}`
63293
+ };
63294
+ return JSON.parse(stdout);
63295
+ }
63296
+ });
63297
+ var defaultLaunchers = (env) => [
63298
+ playwrightLauncher(),
63299
+ chromeLauncher(findChrome(env))
63300
+ ];
63301
+
63302
+ // src/commands/templates/snapshot-command.ts
63303
+ var parseChoices = (flag, raw, allowed) => {
63304
+ const chosen = raw.split(",").map((value) => value.trim()).filter((value) => value !== "");
63305
+ const unknown = chosen.filter((value) => !allowed.includes(value));
63306
+ return unknown.length > 0 || chosen.length === 0 ? fail6(new CliUsageError({
63307
+ code: "invalid_snapshot_choice",
63308
+ message: `--${flag} takes a comma-separated list of ${allowed.join(", ")}${unknown.length > 0 ? `; got ${unknown.join(", ")}` : ""}.`
63309
+ })) : succeed6([...new Set(chosen)]);
63310
+ };
63311
+ var snapshotCommand = make28("snapshot", {
63312
+ template: String9("template").pipe(withDescription4("Template id, or the path of its .tsx entry")),
63313
+ fixture: String8("fixture").pipe(withDescription2("Fixture to screenshot")),
63314
+ dir: dirFlag,
63315
+ out: Directory2("out").pipe(withDescription2("Directory to write the PNGs into"), withDefault4(".samva/snapshots")),
63316
+ viewport: String8("viewport").pipe(withDescription2(`Comma-separated viewports: ${Object.entries(VIEWPORTS).map(([name, size]) => `${name} (${size.width}px)`).join(", ")}`), withDefault4("desktop,mobile")),
63317
+ scheme: String8("scheme").pipe(withDescription2("Comma-separated color schemes: light, dark"), withDefault4("light,dark")),
63318
+ assetBase: assetBaseFlag,
63319
+ offline: offlineFlag,
63320
+ json: jsonFlag
63321
+ }).pipe(withDescription3("Screenshot one fixture in a headless browser at desktop and mobile widths, light and dark"), withExamples([
63322
+ {
63323
+ command: "samva templates snapshot welcome --fixture no-tracking",
63324
+ description: "Write four PNGs to .samva/snapshots"
63325
+ },
63326
+ {
63327
+ command: "samva templates snapshot welcome --fixture default --viewport mobile --scheme dark --out shots",
63328
+ description: "One screenshot: mobile, dark"
63329
+ }
63330
+ ]), withHandler(({ template, fixture, dir, out, viewport, scheme, assetBase, offline, json }) => gen2(function* () {
63331
+ const viewports = yield* parseChoices("viewport", viewport, Object.keys(VIEWPORTS));
63332
+ const schemes = yield* parseChoices("scheme", scheme, SCHEMES);
63333
+ const rendered = yield* renderLocal({
63334
+ template,
63335
+ fixture,
63336
+ channel: "email",
63337
+ dir: getOrUndefined(dir),
63338
+ assetBase: getOrUndefined(assetBase),
63339
+ offline
63340
+ });
63341
+ if (!rendered.ok || !("html" in rendered)) {
63342
+ const message = `Could not render ${template} (${fixture}) to screenshot it.`;
63343
+ const diagnostics = rendered.diagnostics.map((diagnostic) => reportDiagnostic(diagnostic, { file: "." }));
63344
+ if (json) {
63345
+ return yield* new CliResultError({
63346
+ code: "template_render_failed",
63347
+ message,
63348
+ result: { action: "templates.snapshot", ok: false, diagnostics },
63349
+ human: message
63350
+ });
63351
+ }
63352
+ for (const diagnostic of diagnostics) {
63353
+ yield* error(formatReportedDiagnostic(diagnostic));
63354
+ }
63355
+ return yield* new SamvaCliError({ message });
63356
+ }
63357
+ const outDir = resolve11(out);
63358
+ const shots = yield* promise2(() => takeSnapshots({
63359
+ html: rendered.html,
63360
+ template: rendered.template,
63361
+ fixture,
63362
+ outDir,
63363
+ viewports,
63364
+ schemes,
63365
+ launchers: defaultLaunchers(Bun.env)
63366
+ }));
63367
+ if (!shots.ok) {
63368
+ return yield* new SamvaCliError({
63369
+ message: `No browser could take the screenshots (${shots.reasons.join("; ")}). ${BROWSER_REMEDY}`
63370
+ });
63371
+ }
63372
+ const result = {
63373
+ action: "templates.snapshot",
63374
+ ok: true,
63375
+ template: rendered.template,
63376
+ fixture,
63377
+ browser: shots.browser,
63378
+ out: outDir,
63379
+ files: shots.files
63380
+ };
63381
+ if (json)
63382
+ return yield* printJson(result);
63383
+ for (const file of shots.files)
63384
+ yield* log(file.path);
63385
+ }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
63386
+
62423
63387
  // src/commands/templates/types-command.ts
62424
- import { dirname as dirname2, resolve as resolve8 } from "path";
63388
+ import { dirname as dirname3, resolve as resolve12 } from "path";
62425
63389
 
62426
63390
  // src/commands/templates/schema-types.ts
62427
63391
  var RESERVED = new Set([
@@ -62866,7 +63830,7 @@ var typesCommand = make28("types", {
62866
63830
  });
62867
63831
  }
62868
63832
  const context = yield* resolveExecutionContext;
62869
- const path = resolve8(out);
63833
+ const path = resolve12(out);
62870
63834
  const entries = yield* readCatalog();
62871
63835
  const generated = renderTemplateTypes({
62872
63836
  entries,
@@ -62930,7 +63894,7 @@ var typesCommand = make28("types", {
62930
63894
  });
62931
63895
  }
62932
63896
  const fs = yield* FileSystem;
62933
- yield* fs.makeDirectory(dirname2(path), { recursive: true }).pipe(catch_2(() => void_3));
63897
+ yield* fs.makeDirectory(dirname3(path), { recursive: true }).pipe(catch_2(() => void_3));
62934
63898
  yield* fs.writeFileString(path, generated.source).pipe(mapError2((cause) => new SamvaCliError({ message: `Could not write ${path}: ${String(cause)}` })));
62935
63899
  const written = { ...result, written: true };
62936
63900
  if (json)
@@ -62946,7 +63910,7 @@ var typesCommand = make28("types", {
62946
63910
  })));
62947
63911
 
62948
63912
  // src/commands/templates/workspace.ts
62949
- import { basename, resolve as resolve9 } from "path";
63913
+ import { basename, resolve as resolve13 } from "path";
62950
63914
  var templateIdArgument = String9("template-id").pipe(withDescription4("Template whose project workspace to act on"));
62951
63915
  var revisionFlag = String8("revision").pipe(withDescription2("Workspace revision this call is fenced to; a workspace that moved refuses the call"));
62952
63916
  var idempotencyKeyFlag4 = String8("idempotency-key").pipe(withDescription2("Key so an identical retry returns the original result rather than repeating it"));
@@ -62980,7 +63944,7 @@ var patch2 = make28("patch", {
62980
63944
  json: jsonFlag
62981
63945
  }).pipe(withDescription3("Apply file replacements and deletions to the shared workspace"), withExamples([
62982
63946
  {
62983
- command: "samva templates workspace patch tmpl_abc123 --revision 4 --set emails/welcome.tsx=./welcome.tsx --idempotency-key edit-1",
63947
+ command: "samva templates workspace patch tmpl_abc123 --revision 4 --set templates/welcome.tsx=./welcome.tsx --idempotency-key edit-1",
62984
63948
  description: "Write one file, fenced to the revision you inspected"
62985
63949
  }
62986
63950
  ]), withHandler(fnUntraced2(function* ({ id, revision, set, remove, idempotencyKey, json }) {
@@ -62999,7 +63963,7 @@ var patch2 = make28("patch", {
62999
63963
  message: `--set must be <project-path>=<local-file>; got ${entry}.`
63000
63964
  });
63001
63965
  const path = entry.slice(0, separator);
63002
- const source = resolve9(entry.slice(separator + 1));
63966
+ const source = resolve13(entry.slice(separator + 1));
63003
63967
  const content = yield* fs.readFileString(source).pipe(mapError2((cause) => new SamvaCliError({ message: `Could not read ${source}: ${String(cause)}` })));
63004
63968
  written.push({ path, content });
63005
63969
  }
@@ -63033,7 +63997,7 @@ var addAsset = make28("add-asset", {
63033
63997
  }
63034
63998
  ]), withHandler(fnUntraced2(function* ({ id, file, revision, path, replace, idempotencyKey, json }) {
63035
63999
  const fs = yield* FileSystem;
63036
- const source = resolve9(file);
64000
+ const source = resolve13(file);
63037
64001
  const bytes = yield* fs.readFile(source).pipe(mapError2((cause) => new SamvaCliError({ message: `Could not read ${source}: ${String(cause)}` })));
63038
64002
  const client = yield* getClientProvider;
63039
64003
  const view = yield* putWorkspaceAsset({
@@ -63119,7 +64083,7 @@ var publish3 = make28("publish", {
63119
64083
  json: jsonFlag
63120
64084
  }).pipe(withDescription3("Publish an exact saved commit without a local clone"), withExamples([
63121
64085
  {
63122
- command: "samva templates workspace publish tmpl_abc123 --revision 6 --commit 0a1b\u2026 --entry emails/welcome.tsx --project-id tproj_abc123",
64086
+ command: "samva templates workspace publish tmpl_abc123 --revision 6 --commit 0a1b\u2026 --entry templates/welcome.tsx --project-id tproj_abc123",
63123
64087
  description: "Complete the workspace journey; `templates publish` is the Git-clone equivalent"
63124
64088
  }
63125
64089
  ]), withHandler(fnUntraced2(function* ({ id, revision, commit, entry, projectId, json }) {
@@ -63145,9 +64109,7 @@ var workspaceCommand = make28("workspace").pipe(withDescription3("Author a templ
63145
64109
  ]), withSubcommands([open3, diff, patch2, addAsset, check4, fixture, save, history, publish3]));
63146
64110
 
63147
64111
  // src/commands/templates.ts
63148
- var dirFlag = Directory2("dir").pipe(withDescription2("Directory containing your .tsx templates"), withDefault4("emails"));
63149
64112
  var tsconfigFlag = String8("tsconfig").pipe(withDescription2("TypeScript project used to check authored templates"), withDefault4("tsconfig.json"));
63150
- var assetBaseFlag = String8("asset-base").pipe(withDescription2("Actual HTTPS serving base for imported email assets"), optional4);
63151
64113
  var dryRunFlag4 = Boolean6("dry-run").pipe(withDescription2("Show the request without calling the API"), withDefault4(false));
63152
64114
  var templateIdArgument2 = String9("id").pipe(withDescription4("Remote template id"));
63153
64115
  var parseObject = (raw, flag) => try_3({
@@ -63158,14 +64120,15 @@ var decodePayload = (raw, flag, schema) => parseObject(raw, flag).pipe(flatMap3(
63158
64120
  var createProjectBuildSession = (dir, assetBase) => tryPromise2({
63159
64121
  try: async () => {
63160
64122
  const entry = Bun.resolveSync("@samva/vite/build", process.cwd());
63161
- const projectBuild = await import(pathToFileURL2(entry).href);
63162
- return projectBuild.createTemplateBuildSession(resolve10(dir), {
64123
+ const projectBuild = await import(pathToFileURL3(entry).href);
64124
+ return projectBuild.createTemplateBuildSession({
63163
64125
  root: process.cwd(),
63164
- assetBase
64126
+ ...dir === undefined ? {} : { dir: resolve14(dir) },
64127
+ ...assetBase === undefined ? {} : { assetBase }
63165
64128
  });
63166
64129
  },
63167
64130
  catch: (cause) => new SamvaCliError({
63168
- message: `Could not start template watch in ${dir}. Install @samva/vite and vite in this project: ${String(cause)}`
64131
+ message: toolchainFailure(String(cause), `Could not start template watch${dir === undefined ? "" : ` in ${dir}`}`)
63169
64132
  })
63170
64133
  });
63171
64134
  var TSC_DIAGNOSTIC_LINE = /^(?:(.*?)(?:\((\d+),(\d+)\))?: )?(?:error )?(TS\d+): (.*)$/;
@@ -63183,16 +64146,16 @@ var parseTypeScriptDiagnostics = (output, tsconfig) => output.split(`
63183
64146
  var typecheckProject = (tsconfig) => tryPromise2({
63184
64147
  try: async () => {
63185
64148
  const typescriptPackage = Bun.resolveSync("typescript/package.json", process.cwd());
63186
- const tsc = resolve10(dirname3(typescriptPackage), "bin/tsc");
64149
+ const tsc = resolve14(dirname4(typescriptPackage), "bin/tsc");
63187
64150
  const typescriptManifest = await Bun.file(typescriptPackage).json();
63188
- const child = Bun.spawn(["node", tsc, "--noEmit", "--pretty", "false", "--project", resolve10(tsconfig)], { cwd: process.cwd(), stdout: "pipe", stderr: "pipe" });
64151
+ const child = Bun.spawn(["node", tsc, "--noEmit", "--pretty", "false", "--project", resolve14(tsconfig)], { cwd: process.cwd(), stdout: "pipe", stderr: "pipe" });
63189
64152
  const [stdout, stderr, exitCode] = await Promise.all([
63190
64153
  new Response(child.stdout).text(),
63191
64154
  new Response(child.stderr).text(),
63192
64155
  child.exited
63193
64156
  ]);
63194
64157
  const output = `${stdout}${stderr}`.trim();
63195
- const diagnostics = parseTypeScriptDiagnostics(output, resolve10(tsconfig));
64158
+ const diagnostics = parseTypeScriptDiagnostics(output, resolve14(tsconfig));
63196
64159
  if (exitCode !== 0 && diagnostics.length === 0) {
63197
64160
  return Promise.reject(new SamvaCliError({
63198
64161
  message: output || `Could not run TypeScript from this project. Install typescript and check ${tsconfig}.`
@@ -63206,7 +64169,7 @@ var typecheckProject = (tsconfig) => tryPromise2({
63206
64169
  });
63207
64170
  var validateTemplatesDir = (dir) => tryPromise2({
63208
64171
  try: async () => {
63209
- const info = await stat3(dir);
64172
+ const info = await stat4(dir);
63210
64173
  if (!info.isDirectory()) {
63211
64174
  return Promise.reject(new SamvaCliError({ message: `${dir} is not a directory.` }));
63212
64175
  }
@@ -63227,69 +64190,28 @@ var validateTemplatesDir = (dir) => tryPromise2({
63227
64190
  });
63228
64191
  }
63229
64192
  });
63230
- var smlLocation = (source, span) => lineColumn(buildLineMap(source), span.start);
63231
- var diagnosticProblem = (file, phase, provenance, diagnostic, source) => ({
63232
- file,
64193
+ var problemOf = (phase, diagnostic, context) => ({
64194
+ ...reportDiagnostic(diagnostic, context),
63233
64195
  phase,
63234
- provenance,
63235
- code: diagnostic.code,
63236
- message: diagnostic.message,
63237
- span: diagnostic.span,
63238
- ...source === undefined ? {} : smlLocation(source, diagnostic.span),
63239
- repair: diagnostic.repair
63240
- });
63241
- var emailProblem = (file, diagnostic, fixture) => {
63242
- const origin = diagnostic.origins[0];
63243
- return {
63244
- file: origin?.fileName ?? file,
63245
- phase: diagnostic.code.startsWith("caniemail/") ? "compatibility" : "compile",
63246
- provenance: "tsx",
63247
- code: diagnostic.code,
63248
- message: diagnostic.message,
63249
- ...origin === undefined ? {} : { line: origin.lineNumber, column: origin.columnNumber },
63250
- ...fixture === undefined ? {} : { fixture }
63251
- };
63252
- };
63253
- var compatibilityWarnings = (result) => result.files.flatMap((file) => {
63254
- if (file.preview.kind !== "email")
63255
- return [];
63256
- return file.preview.templates.flatMap((template) => template.fixtures.flatMap((fixture) => fixture.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").map((diagnostic) => emailProblem(file.id, diagnostic, fixture.name))));
63257
- });
63258
- var compilerVersionOf = (result) => result.files[0]?.preview.compilerVersion ?? "unknown";
63259
- var collectBuildProblems = (result) => {
63260
- const files = result.files.flatMap((file) => {
63261
- if (file.preview.kind === "email")
63262
- return [
63263
- ...file.preview.diagnostics.filter((finding) => finding.severity === "error").map((finding) => emailProblem(file.id, finding)),
63264
- ...file.preview.templates.flatMap((template) => template.fixtures.flatMap((fixture) => fixture.diagnostics.filter((finding) => finding.severity === "error").map((finding) => emailProblem(file.id, finding, fixture.name))))
63265
- ];
63266
- const moduleDiagnostics = file.preview.diagnostics.map((diagnostic) => ({
63267
- file: file.id,
63268
- phase: "module",
63269
- provenance: "tsx",
63270
- code: diagnostic.code,
63271
- message: diagnostic.message,
63272
- span: diagnostic.span,
63273
- repair: diagnostic.repair
63274
- }));
63275
- const templateDiagnostics = file.preview.templates.flatMap((template) => {
63276
- const source = template.source;
63277
- return [
63278
- ...template.diagnostics.map((diagnostic) => diagnosticProblem(file.id, "emit", "sml", diagnostic, source)),
63279
- ...(template.compiled.ok ? [] : template.compiled.diagnostics ?? []).map((diagnostic) => diagnosticProblem(file.id, "compile", "sml", diagnostic, source))
63280
- ];
63281
- });
63282
- return [...moduleDiagnostics, ...templateDiagnostics];
63283
- });
63284
- return files;
63285
- };
63286
- var isSuccessfulBuild = (result) => result.files.length > 0 && result.files.every((file) => file.preview.ok) && collectBuildProblems(result).length === 0;
64196
+ provenance: "tsx"
64197
+ });
64198
+ var compatibilityFindings = (result, severity) => result.files.flatMap((file) => (file.template?.compatibility ?? []).filter((diagnostic) => diagnostic.severity === severity).map((diagnostic) => problemOf("compatibility", diagnostic, { file: file.id })));
64199
+ var compileWarnings = (result) => result.files.flatMap((file) => file.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").map((diagnostic) => problemOf("compile", diagnostic, { file: file.id })));
64200
+ var collectBuildProblems = (result) => [
64201
+ ...result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").map((diagnostic) => problemOf("project", diagnostic, { file: "." })),
64202
+ ...result.files.flatMap((file) => [
64203
+ ...file.diagnostics.filter((diagnostic) => diagnostic.severity === "error").map((diagnostic) => problemOf("compile", diagnostic, { file: file.id })),
64204
+ ...(file.template?.fixtures ?? []).flatMap((fixture) => fixture.diagnostics.filter((diagnostic) => diagnostic.severity === "error").map((diagnostic) => problemOf("compile", diagnostic, { file: file.id, fixture: fixture.name })))
64205
+ ]),
64206
+ ...compatibilityFindings(result, "error")
64207
+ ];
64208
+ var isSuccessfulBuild = (result) => result.files.length > 0 && result.ok && collectBuildProblems(result).length === 0;
63287
64209
  var toTemplateBuildArtifact = (result) => ({
63288
- schemaVersion: 2,
63289
- compilerVersion: compilerVersionOf(result),
64210
+ schemaVersion: 3,
64211
+ compilerVersion: result.compilerVersion,
63290
64212
  result
63291
64213
  });
63292
- var problemLocation = (problem) => problem.line === undefined ? "" : `:${problem.line}${problem.column === undefined ? "" : `:${problem.column}`}`;
64214
+ var NO_TEMPLATES = (dir) => `No templates found in ${dir ?? "templates/ or emails/"}. A template is a .tsx file that default-exports defineTemplate with an input schema, fixtures, and an email, sms, or whatsapp body.`;
63293
64215
  var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
63294
64216
  const typecheck = yield* typecheckProject(tsconfig);
63295
64217
  const typeProblems = typecheck.diagnostics.map((diagnostic) => ({
@@ -63297,6 +64219,7 @@ var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
63297
64219
  phase: "typescript",
63298
64220
  provenance: "tsx",
63299
64221
  code: diagnostic.code,
64222
+ severity: "error",
63300
64223
  message: diagnostic.message,
63301
64224
  line: diagnostic.line,
63302
64225
  column: diagnostic.column
@@ -63320,9 +64243,9 @@ var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
63320
64243
  const built = yield* build();
63321
64244
  const problems = collectBuildProblems(built);
63322
64245
  const ok = isSuccessfulBuild(built);
63323
- const compilerVersion = compilerVersionOf(built);
63324
- const warnings = compatibilityWarnings(built);
63325
- const message = ok ? `TypeScript v${typecheck.version} \xB7 compiler v${compilerVersion} \xB7 ${built.files.length} template(s) compiled \xB7 ${warnings.length} compatibility warning(s)` : built.files.length === 0 ? `No templates found in ${dir}. Email entries must default-export defineEmail with an input schema and fixtures; SMS/WhatsApp entries use their structured channel function.` : `Template check failed (${problems.length} problem(s)).`;
64246
+ const compilerVersion = built.compilerVersion;
64247
+ const warnings = compatibilityFindings(built, "warning");
64248
+ const message = ok ? `TypeScript v${typecheck.version} \xB7 compiler ${compilerVersion} \xB7 ${built.files.length} template(s) compiled \xB7 ${warnings.length} compatibility warning(s)` : built.files.length === 0 ? NO_TEMPLATES(dir) : `Template check failed (${problems.length} problem(s)).`;
63326
64249
  return {
63327
64250
  ok,
63328
64251
  message,
@@ -63334,9 +64257,10 @@ var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
63334
64257
  tsconfig,
63335
64258
  typescriptVersion: typecheck.version,
63336
64259
  compilerVersion,
63337
- buildSchemaVersion: 2,
64260
+ buildSchemaVersion: 3,
63338
64261
  files: built.files,
63339
64262
  problems,
64263
+ warnings: compileWarnings(built),
63340
64264
  compatibility: {
63341
64265
  errors: problems.filter((problem) => problem.phase === "compatibility").length,
63342
64266
  warnings: warnings.length,
@@ -63353,10 +64277,11 @@ var watchTemplateChecks = (dir, tsconfig, assetBase) => acquireUseRelease2(creat
63353
64277
  });
63354
64278
  const observe = () => observeTemplateCheck(dir, tsconfig, build).pipe(catch_2((error) => {
63355
64279
  const problem = {
63356
- file: dir,
63357
- phase: "module",
64280
+ file: dir ?? ".",
64281
+ phase: "watch",
63358
64282
  provenance: "tsx",
63359
64283
  code: "watch-rebuild-error",
64284
+ severity: "error",
63360
64285
  message: error.message
63361
64286
  };
63362
64287
  return succeed6({
@@ -63382,12 +64307,11 @@ var watchTemplateChecks = (dir, tsconfig, assetBase) => acquireUseRelease2(creat
63382
64307
  files: files.map((file) => ({
63383
64308
  id: file.id,
63384
64309
  kind: file.kind,
63385
- ok: file.preview.ok,
63386
- templates: file.preview.templates.map((template) => ({
63387
- name: template.name,
63388
- channel: template.channel,
63389
- ok: template.ok
63390
- }))
64310
+ ok: file.ok,
64311
+ ...file.template === undefined ? {} : {
64312
+ template: file.template.template,
64313
+ channels: file.template.channels
64314
+ }
63391
64315
  }))
63392
64316
  },
63393
64317
  observation: sequence,
@@ -63401,7 +64325,7 @@ var watchTemplateChecks = (dir, tsconfig, assetBase) => acquireUseRelease2(creat
63401
64325
  process.stdout.write(`${status} ${observation.message}
63402
64326
  `);
63403
64327
  for (const problem of observation.problems) {
63404
- process.stdout.write(` ${problem.file}${problemLocation(problem)} [${problem.phase}/${problem.provenance}] ${problem.code} ${problem.message}
64328
+ process.stdout.write(` ${formatReportedDiagnostic(problem)}
63405
64329
  `);
63406
64330
  }
63407
64331
  });
@@ -63418,10 +64342,10 @@ var check5 = make28("check", {
63418
64342
  tsconfig: tsconfigFlag,
63419
64343
  assetBase: assetBaseFlag,
63420
64344
  watch: Boolean6("watch").pipe(withDescription2("Continuously re-run checks as project files change"), withDefault4(false))
63421
- }).pipe(withDescription3("Check local TSX templates without writing files"), withExamples([
64345
+ }).pipe(withDescription3("Type-check and compile local TSX templates, render every fixture, and report located findings"), withExamples([
63422
64346
  {
63423
- command: "samva templates check --dir emails",
63424
- description: "Check templates in emails/ without writing files"
64347
+ command: "samva templates check",
64348
+ description: "Check the templates in templates/ and emails/ without writing files"
63425
64349
  },
63426
64350
  {
63427
64351
  command: "samva templates check --json",
@@ -63444,7 +64368,9 @@ var check5 = make28("check", {
63444
64368
  description: "Stream one machine-readable result per observation"
63445
64369
  }
63446
64370
  ]), withHandler(({ dir, json, tsconfig, watch, assetBase }) => gen2(function* () {
63447
- yield* validateTemplatesDir(dir);
64371
+ const dirValue = getOrUndefined(dir);
64372
+ if (dirValue !== undefined)
64373
+ yield* validateTemplatesDir(dirValue);
63448
64374
  if (watch) {
63449
64375
  if (json && !isJsonLinesRequested()) {
63450
64376
  return yield* new CliUsageError({
@@ -63452,9 +64378,9 @@ var check5 = make28("check", {
63452
64378
  message: "--watch uses --jsonl for machine output; --json remains one-shot."
63453
64379
  });
63454
64380
  }
63455
- return yield* watchTemplateChecks(dir, tsconfig, getOrUndefined(assetBase));
64381
+ return yield* watchTemplateChecks(dirValue, tsconfig, getOrUndefined(assetBase));
63456
64382
  }
63457
- const observation = yield* observeTemplateCheck(dir, tsconfig, () => buildDir(dir, getOrUndefined(assetBase)));
64383
+ const observation = yield* observeTemplateCheck(dirValue, tsconfig, () => buildDir(dirValue, getOrUndefined(assetBase)));
63458
64384
  if (!observation.ok) {
63459
64385
  if (json) {
63460
64386
  return yield* new CliResultError({
@@ -63465,7 +64391,7 @@ var check5 = make28("check", {
63465
64391
  });
63466
64392
  }
63467
64393
  for (const problem of observation.problems) {
63468
- yield* error(`${problem.file}${problemLocation(problem)}: [${problem.phase}/${problem.provenance}] ${problem.code} ${problem.message}`);
64394
+ yield* error(formatReportedDiagnostic(problem));
63469
64395
  }
63470
64396
  return yield* new SamvaCliError({ message: observation.message });
63471
64397
  }
@@ -63477,7 +64403,7 @@ var check5 = make28("check", {
63477
64403
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
63478
64404
  var writeJsonFile = (target, value) => gen2(function* () {
63479
64405
  const fs = yield* FileSystem;
63480
- yield* fs.makeDirectory(dirname3(target), { recursive: true });
64406
+ yield* fs.makeDirectory(dirname4(target), { recursive: true });
63481
64407
  yield* fs.writeFileString(target, `${JSON.stringify(value, null, 2)}
63482
64408
  `);
63483
64409
  }).pipe(mapError2((cause) => new SamvaCliError({
@@ -63490,7 +64416,7 @@ var build2 = make28("build", {
63490
64416
  json: jsonFlag
63491
64417
  }).pipe(withDescription3("Build local TSX templates into a reusable JSON artifact"), withExamples([
63492
64418
  {
63493
- command: "samva templates build --dir emails --out dist/templates.json",
64419
+ command: "samva templates build --out dist/templates.json",
63494
64420
  description: "Compile local templates for another package or deployment step"
63495
64421
  },
63496
64422
  {
@@ -63498,10 +64424,11 @@ var build2 = make28("build", {
63498
64424
  description: "Build executable fixtures with their imported asset URLs"
63499
64425
  }
63500
64426
  ]), withHandler(({ dir, out, json, assetBase }) => gen2(function* () {
63501
- const built = yield* buildDir(dir, getOrUndefined(assetBase));
64427
+ const dirValue = getOrUndefined(dir);
64428
+ const built = yield* buildDir(dirValue, getOrUndefined(assetBase));
63502
64429
  const problems = collectBuildProblems(built);
63503
64430
  if (!isSuccessfulBuild(built)) {
63504
- const message = built.files.length === 0 ? `No templates found in ${dir}. Email entries must default-export defineEmail with an input schema and fixtures; SMS/WhatsApp entries use their structured channel function.` : `Template build failed (${problems.length} problem(s)).`;
64431
+ const message = built.files.length === 0 ? NO_TEMPLATES(dirValue) : `Template build failed (${problems.length} problem(s)).`;
63505
64432
  if (json) {
63506
64433
  return yield* new CliResultError({
63507
64434
  code: "template_build_failed",
@@ -63515,11 +64442,11 @@ var build2 = make28("build", {
63515
64442
  });
63516
64443
  }
63517
64444
  for (const problem of problems) {
63518
- yield* error(`${problem.file}: ${problem.code} ${problem.message}`);
64445
+ yield* error(formatReportedDiagnostic(problem));
63519
64446
  }
63520
64447
  return yield* new SamvaCliError({ message });
63521
64448
  }
63522
- const target = resolve10(out);
64449
+ const target = resolve14(out);
63523
64450
  const artifact = toTemplateBuildArtifact(built);
63524
64451
  yield* writeJsonFile(target, artifact);
63525
64452
  const result = {
@@ -63532,7 +64459,7 @@ var build2 = make28("build", {
63532
64459
  if (json) {
63533
64460
  yield* printJson(result);
63534
64461
  } else {
63535
- yield* logInfo(`Built ${built.files.length} template file(s) with compiler v${artifact.compilerVersion} to ${target}`);
64462
+ yield* logInfo(`Built ${built.files.length} template file(s) with compiler ${artifact.compilerVersion} to ${target}`);
63536
64463
  }
63537
64464
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
63538
64465
  var listRemote = make28("list", {
@@ -63646,34 +64573,29 @@ var removeRemote = make28("remove", {
63646
64573
  return yield* printJson(result);
63647
64574
  yield* printJson(result);
63648
64575
  }).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
63649
- var exportProject = (input) => tryPromise2({
63650
- try: async () => {
63651
- const entry = Bun.resolveSync("@samva/vite/project", process.cwd());
63652
- const project = await import(pathToFileURL2(entry).href);
63653
- return project.exportEmailProject({
63654
- dir: resolve10(input.dir),
63655
- root: process.cwd(),
63656
- out: resolve10(input.out),
63657
- ...input.assetBase === undefined ? {} : { assetBase: input.assetBase }
63658
- });
64576
+ var exportProject = (input) => runToolchain({
64577
+ action: `Could not export templates${input.dir === undefined ? "" : ` in ${input.dir}`}`,
64578
+ options: {
64579
+ root: process.cwd(),
64580
+ out: resolve14(input.out),
64581
+ ...input.dir === undefined ? {} : { dir: resolve14(input.dir) },
64582
+ ...input.assetBase === undefined ? {} : { assetBase: input.assetBase }
63659
64583
  },
63660
- catch: (cause) => new SamvaCliError({
63661
- message: `Could not export templates in ${input.dir}. Install @samva/markup, @samva/vite, and vite in this project: ${String(cause)}`
63662
- })
64584
+ script: `import { exportProject } from "@samva/vite/project"; ${OPTIONS_PRELUDE} process.stdout.write(JSON.stringify(await exportProject(options)));`
63663
64585
  });
63664
64586
  var exportCommand = make28("export", {
63665
64587
  dir: dirFlag,
63666
64588
  out: Directory2("out").pipe(withDescription2("Directory to write rendered fixtures, assets, and the catalog into")),
63667
64589
  assetBase: String8("asset-base").pipe(withDescription2("Origin the exported assets will be served from; omit to point each exported page at the export's own assets directory"), optional4),
63668
64590
  json: jsonFlag
63669
- }).pipe(withDescription3("Render every local template's fixtures to HTML, text, and assets"), withExamples([
64591
+ }).pipe(withDescription3("Render every local template's fixtures to HTML, text, SMS, WhatsApp files, and assets"), withExamples([
63670
64592
  {
63671
- command: "samva templates export --dir emails --out dist/email",
64593
+ command: "samva templates export --out dist/email",
63672
64594
  description: "Render fixtures for review, images resolving from the export's assets directory"
63673
64595
  }
63674
64596
  ]), withHandler(fnUntraced2(function* ({ dir, out, assetBase, json }) {
63675
64597
  const receipt = yield* exportProject({
63676
- dir,
64598
+ dir: getOrUndefined(dir),
63677
64599
  out,
63678
64600
  assetBase: getOrUndefined(assetBase)
63679
64601
  });
@@ -63681,7 +64603,7 @@ var exportCommand = make28("export", {
63681
64603
  const result = {
63682
64604
  action: "templates.export",
63683
64605
  ok: errors.length === 0,
63684
- out: resolve10(out),
64606
+ out: resolve14(out),
63685
64607
  assetBase: receipt.assets.base,
63686
64608
  templates: receipt.templates.map((template) => ({
63687
64609
  id: template.id,
@@ -63689,7 +64611,7 @@ var exportCommand = make28("export", {
63689
64611
  fixtures: template.fixtures.map((fixture) => fixture.fixture)
63690
64612
  })),
63691
64613
  assets: receipt.assets.assets.length,
63692
- diagnostics: receipt.diagnostics
64614
+ diagnostics: receipt.diagnostics.map((diagnostic) => reportDiagnostic(diagnostic, { file: "." }))
63693
64615
  };
63694
64616
  if (errors.length > 0) {
63695
64617
  const message = `Template export found ${errors.length} error(s).`;
@@ -63714,15 +64636,27 @@ var templatesCommand = make28("templates").pipe(withDescription3("Create, author
63714
64636
  description: "Clone an existing project with its repository credential helper"
63715
64637
  },
63716
64638
  {
63717
- command: "samva templates check --dir emails",
64639
+ command: "samva templates dev",
64640
+ description: "Start the local visual editor for templates/ and emails/"
64641
+ },
64642
+ {
64643
+ command: "samva templates check",
63718
64644
  description: "Check local TSX templates without writing files"
63719
64645
  },
64646
+ {
64647
+ command: "samva templates render welcome --fixture default",
64648
+ description: "Print one fixture's subject, preheader and plain-text body"
64649
+ },
64650
+ {
64651
+ command: "samva templates snapshot welcome --fixture default",
64652
+ description: "Screenshot one fixture at desktop and mobile widths, light and dark"
64653
+ },
63720
64654
  {
63721
64655
  command: "samva templates publish --commit HEAD",
63722
64656
  description: "Publish the current clean commit, then continue with ordinary Git"
63723
64657
  },
63724
64658
  {
63725
- command: "samva templates export --dir emails --out dist/email",
64659
+ command: "samva templates export --out dist/email",
63726
64660
  description: "Render every template's fixtures to HTML, text, and assets"
63727
64661
  },
63728
64662
  {
@@ -63741,7 +64675,10 @@ var templatesCommand = make28("templates").pipe(withDescription3("Create, author
63741
64675
  createRemote,
63742
64676
  updateRemote,
63743
64677
  removeRemote,
64678
+ devCommand,
63744
64679
  check5,
64680
+ renderCommand,
64681
+ snapshotCommand,
63745
64682
  build2,
63746
64683
  exportCommand,
63747
64684
  typesCommand,