@fabiofiorita/porcelain 0.63.2 → 0.63.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @fabiofiorita/porcelain (0.63.2)
1
+ # @fabiofiorita/porcelain (0.63.4)
2
2
 
3
3
  The Electron-free Porcelain daemon and browser client, packaged for plain Node. Run it on the
4
4
  machine that owns the repositories and terminals you want to review.
@@ -792,27 +792,6 @@ var commitGroupGenerationOutputSchema = import_zod.z.object({
792
792
 
793
793
  // ../../packages/contracts/src/environment.ts
794
794
  var import_zod2 = require("zod");
795
- var wslReadinessIssueSchema = import_zod2.z.enum([
796
- "unsupported-version",
797
- "probe-failed",
798
- "node-missing",
799
- "node-too-old",
800
- "npx-missing",
801
- "git-missing"
802
- ]);
803
- var wslManagedStateSchema = import_zod2.z.enum(["available", "starting", "online", "error"]);
804
- var wslDistributionSchema = import_zod2.z.object({
805
- name: import_zod2.z.string().min(1),
806
- version: import_zod2.z.union([import_zod2.z.literal(1), import_zod2.z.literal(2)]),
807
- isDefault: import_zod2.z.boolean(),
808
- nodeVersion: import_zod2.z.string().nullable(),
809
- gitVersion: import_zod2.z.string().nullable(),
810
- ready: import_zod2.z.boolean(),
811
- issues: import_zod2.z.array(wslReadinessIssueSchema),
812
- managedState: wslManagedStateSchema,
813
- environmentId: import_zod2.z.string().nullable(),
814
- managementError: import_zod2.z.string().nullable()
815
- });
816
795
  var endpointKinds = ["tailnet", "lan", "other"];
817
796
  var endpointKindSchema = import_zod2.z.enum(endpointKinds);
818
797
 
@@ -7776,9 +7755,13 @@ function compileLayers(layers) {
7776
7755
  function layerForCompiled(path, compiled) {
7777
7756
  let best = null;
7778
7757
  for (const { label, re } of compiled) {
7779
- re.lastIndex = 0;
7780
7758
  let last = null;
7781
- for (let m = re.exec(path); m !== null; m = re.exec(path)) last = m;
7759
+ let lastEmpty = null;
7760
+ for (const match of path.matchAll(re)) {
7761
+ if (match[0].length > 0) last = match;
7762
+ else lastEmpty = match;
7763
+ }
7764
+ last ??= lastEmpty;
7782
7765
  if (last && (best === null || last.index > best.index)) {
7783
7766
  best = { label, index: last.index };
7784
7767
  }
@@ -10445,6 +10428,17 @@ function createProjectsOperations(options) {
10445
10428
  if (!browsed.ok) return failure(mapPortError(browsed.error));
10446
10429
  return { ok: true, value: browsed.value };
10447
10430
  },
10431
+ async checkoutIdentity(path) {
10432
+ const gitDir = await resolveGitDir(path);
10433
+ if (gitDir === null) return null;
10434
+ const stored = await options.hub.inventory.readProjects();
10435
+ if (!stored.ok) throw new Error("Project inventory is unavailable");
10436
+ for (const project of stored.value) {
10437
+ const worktree = project.worktrees.find((entry) => entry.gitDir === gitDir);
10438
+ if (worktree) return { projectId: project.id, worktreeId: worktree.id };
10439
+ }
10440
+ return null;
10441
+ },
10448
10442
  listHubInventory: hub.listHubInventory,
10449
10443
  environmentIdentity: hub.environmentIdentity,
10450
10444
  renameEnvironment: hub.renameEnvironment,
@@ -12035,11 +12029,15 @@ function createRemoteOperations(options) {
12035
12029
  },
12036
12030
  async setTailnetBind(input) {
12037
12031
  if (input) await options.cloudflare.stop();
12038
- await options.config.update((current) => ({
12039
- ...current,
12040
- tailnetBind: input,
12041
- cloudflareBind: input ? false : current.cloudflareBind
12042
- }));
12032
+ await options.config.update((current) => {
12033
+ const { cloudflareHostname, ...rest } = current;
12034
+ return {
12035
+ ...rest,
12036
+ tailnetBind: input,
12037
+ cloudflareBind: input ? false : current.cloudflareBind,
12038
+ ...!input && cloudflareHostname !== void 0 ? { cloudflareHostname } : {}
12039
+ };
12040
+ });
12043
12041
  if (input) await options.listeners.startTailnetListener();
12044
12042
  else await options.listeners.stopTailnetListener();
12045
12043
  const envForced = options.env.tailnetBindForced();
@@ -12064,6 +12062,9 @@ function createRemoteOperations(options) {
12064
12062
  };
12065
12063
  },
12066
12064
  async setLanBind(input) {
12065
+ if (!input && (await options.config.load()).cloudflareHostname !== void 0) {
12066
+ throw new Error("Remove the custom Cloudflare hostname before turning off Local network.");
12067
+ }
12067
12068
  await options.config.update((current) => ({ ...current, lanBind: input }));
12068
12069
  if (input) await options.listeners.startLanListener();
12069
12070
  else await options.listeners.stopLanListener();
@@ -12089,11 +12090,10 @@ function createRemoteOperations(options) {
12089
12090
  const status = input ? await options.cloudflare.start() : await options.cloudflare.stop();
12090
12091
  if (input) await options.listeners.stopTailnetListener();
12091
12092
  const flags = await options.config.update((current) => {
12092
- const { cloudflareHostname, ...rest } = current;
12093
+ const { cloudflareHostname: _cloudflareHostname, ...rest } = current;
12093
12094
  return {
12094
12095
  ...rest,
12095
12096
  cloudflareBind: input,
12096
- ...input || cloudflareHostname === void 0 ? {} : { cloudflareHostname },
12097
12097
  tailnetBind: input ? false : current.tailnetBind
12098
12098
  };
12099
12099
  });
@@ -12105,6 +12105,16 @@ function createRemoteOperations(options) {
12105
12105
  },
12106
12106
  async setCloudflareHostname(input) {
12107
12107
  if (input !== null) {
12108
+ if (options.env.cloudflareBindForced() || options.env.tailnetBindForced()) {
12109
+ throw new Error(
12110
+ "Change the startup sharing mode before using a custom Cloudflare hostname."
12111
+ );
12112
+ }
12113
+ if (options.listeners.lanUrl() === null || options.listeners.lanBindError() !== null) {
12114
+ throw new Error(
12115
+ "Turn on Local network and resolve its listener error before using a custom Cloudflare hostname."
12116
+ );
12117
+ }
12108
12118
  await options.cloudflare.stop();
12109
12119
  await options.listeners.stopTailnetListener();
12110
12120
  }
@@ -14668,9 +14678,6 @@ function createDaemonRouter({ operations }) {
14668
14678
  );
14669
14679
  }
14670
14680
 
14671
- // ../daemon/src/daemon-composition/daemon-operations.ts
14672
- var import_promises33 = require("node:fs/promises");
14673
-
14674
14681
  // ../daemon/src/net/admin-token.ts
14675
14682
  var import_node_crypto20 = require("node:crypto");
14676
14683
  var import_promises32 = require("node:fs/promises");
@@ -14718,13 +14725,10 @@ function daemonIdentity(host = process.env.PORCELAIN_DAEMON_HOST?.trim() || (0,
14718
14725
 
14719
14726
  // ../daemon/src/net/daemon-version.ts
14720
14727
  function daemonVersion() {
14721
- return "0.63.2";
14728
+ return "0.63.4";
14722
14729
  }
14723
14730
 
14724
14731
  // ../daemon/src/daemon-composition/daemon-operations.ts
14725
- async function canonicalCheckoutPath(path) {
14726
- return (0, import_promises33.realpath)(path).catch(() => path);
14727
- }
14728
14732
  function actionsProjectsCapability(projects) {
14729
14733
  return {
14730
14734
  async listRunTargets(projectId) {
@@ -14743,19 +14747,7 @@ function actionsProjectsCapability(projects) {
14743
14747
  }
14744
14748
  function createDaemonOperations(options) {
14745
14749
  const publish2 = options.publishSessionChange ?? publishSessionChange;
14746
- const identityForRepo = async (repoPath) => {
14747
- const inventory = await options.projects.listHubInventory();
14748
- if (!inventory.ok) return null;
14749
- const canonicalRepoPath = await canonicalCheckoutPath(repoPath);
14750
- for (const project of inventory.value.projects) {
14751
- for (const worktree of project.worktrees) {
14752
- if (worktree.path === repoPath || worktree.path === canonicalRepoPath || await canonicalCheckoutPath(worktree.path) === canonicalRepoPath) {
14753
- return { projectId: project.id, worktreeId: worktree.id };
14754
- }
14755
- }
14756
- }
14757
- return null;
14758
- };
14750
+ const identityForRepo = options.projects.checkoutIdentity;
14759
14751
  const scope = createScopeStore({ homeDir: options.homeDir, identityForRepo });
14760
14752
  const filesScope = createFilesScope({ homeDir: options.homeDir, identityForRepo });
14761
14753
  return Object.freeze({
@@ -14833,7 +14825,7 @@ function createDaemonOperations(options) {
14833
14825
 
14834
14826
  // ../daemon/src/dev-config.ts
14835
14827
  var import_node_fs5 = require("node:fs");
14836
- var import_promises34 = require("node:fs/promises");
14828
+ var import_promises33 = require("node:fs/promises");
14837
14829
  var import_node_os8 = require("node:os");
14838
14830
  var import_node_path51 = require("node:path");
14839
14831
  function devRepoPath(source = process.env, home = (0, import_node_os8.homedir)()) {
@@ -14909,7 +14901,7 @@ async function seedDevConfig(source = process.env, home = (0, import_node_os8.ho
14909
14901
  await recents.removePath(path);
14910
14902
  }
14911
14903
  try {
14912
- await (0, import_promises34.stat)(devRepo);
14904
+ await (0, import_promises33.stat)(devRepo);
14913
14905
  } catch {
14914
14906
  return;
14915
14907
  }
@@ -14919,11 +14911,11 @@ async function seedDevConfig(source = process.env, home = (0, import_node_os8.ho
14919
14911
  }
14920
14912
 
14921
14913
  // ../daemon/src/git/linked-worktree.ts
14922
- var import_promises35 = require("node:fs/promises");
14914
+ var import_promises34 = require("node:fs/promises");
14923
14915
  var import_node_path52 = require("node:path");
14924
14916
  async function isLinkedWorktree(repoPath) {
14925
14917
  try {
14926
- return (await (0, import_promises35.stat)((0, import_node_path52.join)(repoPath, ".git"))).isFile();
14918
+ return (await (0, import_promises34.stat)((0, import_node_path52.join)(repoPath, ".git"))).isFile();
14927
14919
  } catch {
14928
14920
  return false;
14929
14921
  }
@@ -15160,7 +15152,7 @@ function reviewBundleSource(data, commitHash, workingFingerprint, assetsDir) {
15160
15152
  }
15161
15153
 
15162
15154
  // ../daemon/src/net/mcp/mcp-workspace.ts
15163
- var import_promises36 = require("node:fs/promises");
15155
+ var import_promises35 = require("node:fs/promises");
15164
15156
  var import_node_path53 = require("node:path");
15165
15157
  function describeKnownProjects(inventory) {
15166
15158
  if (inventory.projects.length === 0) {
@@ -15183,7 +15175,7 @@ function isWorkspaceRef(value) {
15183
15175
  }
15184
15176
  async function realpathOrNull(path) {
15185
15177
  try {
15186
- return await (0, import_promises36.realpath)((0, import_node_path53.resolve)(path));
15178
+ return await (0, import_promises35.realpath)((0, import_node_path53.resolve)(path));
15187
15179
  } catch {
15188
15180
  return null;
15189
15181
  }
@@ -16633,7 +16625,7 @@ async function handleMcpRequest(req, res, options) {
16633
16625
 
16634
16626
  // ../daemon/src/net/mcp/mcp-local-server.ts
16635
16627
  var import_node_fs6 = require("node:fs");
16636
- var import_promises37 = require("node:fs/promises");
16628
+ var import_promises36 = require("node:fs/promises");
16637
16629
  var import_node_http3 = require("node:http");
16638
16630
  var import_node_net = require("node:net");
16639
16631
  var import_node_path55 = require("node:path");
@@ -16670,16 +16662,16 @@ async function prepareEndpoint(endpoint) {
16670
16662
  }
16671
16663
  return;
16672
16664
  }
16673
- await (0, import_promises37.mkdir)((0, import_node_path55.dirname)(endpoint), { recursive: true, mode: 448 });
16665
+ await (0, import_promises36.mkdir)((0, import_node_path55.dirname)(endpoint), { recursive: true, mode: 448 });
16674
16666
  try {
16675
- const existing = await (0, import_promises37.lstat)(endpoint);
16667
+ const existing = await (0, import_promises36.lstat)(endpoint);
16676
16668
  if (!existing.isSocket()) {
16677
16669
  throw new Error(`refusing to replace non-socket MCP channel path ${endpoint}`);
16678
16670
  }
16679
16671
  if (await socketIsListening(endpoint)) {
16680
16672
  throw new Error(`another Porcelain daemon already owns the MCP channel ${endpoint}`);
16681
16673
  }
16682
- await (0, import_promises37.rm)(endpoint);
16674
+ await (0, import_promises36.rm)(endpoint);
16683
16675
  } catch (error) {
16684
16676
  if (error instanceof Error && "code" in error && error.code === "ENOENT") return;
16685
16677
  throw error;
@@ -16707,12 +16699,12 @@ async function startLocalMcpServer(input) {
16707
16699
  resolve16();
16708
16700
  });
16709
16701
  });
16710
- if (!isNamedPipe(input.endpoint)) await (0, import_promises37.chmod)(input.endpoint, 384);
16702
+ if (!isNamedPipe(input.endpoint)) await (0, import_promises36.chmod)(input.endpoint, 384);
16711
16703
  let ownsEndpoint = true;
16712
16704
  const removeEndpoint = async () => {
16713
16705
  if (!ownsEndpoint || isNamedPipe(input.endpoint)) return;
16714
16706
  ownsEndpoint = false;
16715
- await (0, import_promises37.rm)(input.endpoint, { force: true });
16707
+ await (0, import_promises36.rm)(input.endpoint, { force: true });
16716
16708
  };
16717
16709
  const cleanupSync = () => {
16718
16710
  if (!ownsEndpoint) return;
@@ -16738,7 +16730,7 @@ async function startLocalMcpServer(input) {
16738
16730
 
16739
16731
  // ../daemon/src/net/static-server.ts
16740
16732
  var import_node_fs7 = require("node:fs");
16741
- var import_promises38 = require("node:fs/promises");
16733
+ var import_promises37 = require("node:fs/promises");
16742
16734
  var import_node_path56 = require("node:path");
16743
16735
  var import_node_zlib = require("node:zlib");
16744
16736
  var RENDERER_ROOT = (0, import_node_path56.resolve)(__dirname, "..", "..", "renderer");
@@ -16851,7 +16843,7 @@ async function serveStatic(req, res, root = RENDERER_ROOT) {
16851
16843
  if (isAppShell) {
16852
16844
  let html;
16853
16845
  try {
16854
- html = await (0, import_promises38.readFile)(filePath, "utf8");
16846
+ html = await (0, import_promises37.readFile)(filePath, "utf8");
16855
16847
  } catch {
16856
16848
  res.writeHead(404);
16857
16849
  res.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabiofiorita/porcelain",
3
- "version": "0.63.2",
3
+ "version": "0.63.4",
4
4
  "description": "Headless Porcelain daemon — plain Node backend for remote machines (npx @fabiofiorita/porcelain@latest serve)",
5
5
  "license": "MIT",
6
6
  "author": "Fabio Fiorita <fabiolfp@gmail.com>",
@@ -1,4 +1,4 @@
1
- import{bm as re}from"./index-BG75F5tP.js";function oe(r,o){for(var i=0;i<o.length;i++){const e=o[i];if(typeof e!="string"&&!Array.isArray(e)){for(const t in e)if(t!=="default"&&!(t in r)){const n=Object.getOwnPropertyDescriptor(e,t);n&&Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var z={},Q,Bt;function ie(){return Bt||(Bt=1,Q=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Q}var $={},_={},At;function U(){if(At)return _;At=1;let r;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return _.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},_.getSymbolTotalCodewords=function(e){return o[e]},_.getBCHDigit=function(i){let e=0;for(;i!==0;)e++,i>>>=1;return e},_.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');r=e},_.isKanjiModeEnabled=function(){return typeof r<"u"},_.toSJIS=function(e){return r(e)},_}var W={},Rt;function yt(){return Rt||(Rt=1,(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function o(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+i)}}r.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},r.from=function(e,t){if(r.isValid(e))return e;try{return o(e)}catch{return t}}})(W)),W}var Z,Tt;function se(){if(Tt)return Z;Tt=1;function r(){this.buffer=[],this.length=0}return r.prototype={get:function(o){const i=Math.floor(o/8);return(this.buffer[i]>>>7-o%8&1)===1},put:function(o,i){for(let e=0;e<i;e++)this.putBit((o>>>i-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),o&&(this.buffer[i]|=128>>>this.length%8),this.length++}},Z=r,Z}var X,It;function ue(){if(It)return X;It=1;function r(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}return r.prototype.set=function(o,i,e,t){const n=o*this.size+i;this.data[n]=e,t&&(this.reservedBit[n]=!0)},r.prototype.get=function(o,i){return this.data[o*this.size+i]},r.prototype.xor=function(o,i,e){this.data[o*this.size+i]^=e},r.prototype.isReserved=function(o,i){return this.reservedBit[o*this.size+i]},X=r,X}var x={},Nt;function ae(){return Nt||(Nt=1,(function(r){const o=U().getSymbolSize;r.getRowColCoords=function(e){if(e===1)return[];const t=Math.floor(e/7)+2,n=o(e),s=n===145?26:Math.ceil((n-13)/(2*t-2))*2,a=[n-7];for(let u=1;u<t-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},r.getPositions=function(e){const t=[],n=r.getRowColCoords(e),s=n.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||t.push([n[a],n[u]]);return t}})(x)),x}var tt={},Pt;function ce(){if(Pt)return tt;Pt=1;const r=U().getSymbolSize,o=7;return tt.getPositions=function(e){const t=r(e);return[[0,0],[t-o,0],[0,t-o]]},tt}var et={},Mt;function fe(){return Mt||(Mt=1,(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const o={N1:3,N2:3,N3:40,N4:10};r.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){const n=t.size;let s=0,a=0,u=0,c=null,d=null;for(let p=0;p<n;p++){a=u=0,c=d=null;for(let h=0;h<n;h++){let f=t.get(p,h);f===c?a++:(a>=5&&(s+=o.N1+(a-5)),c=f,a=1),f=t.get(h,p),f===d?u++:(u>=5&&(s+=o.N1+(u-5)),d=f,u=1)}a>=5&&(s+=o.N1+(a-5)),u>=5&&(s+=o.N1+(u-5))}return s},r.getPenaltyN2=function(t){const n=t.size;let s=0;for(let a=0;a<n-1;a++)for(let u=0;u<n-1;u++){const c=t.get(a,u)+t.get(a,u+1)+t.get(a+1,u)+t.get(a+1,u+1);(c===4||c===0)&&s++}return s*o.N2},r.getPenaltyN3=function(t){const n=t.size;let s=0,a=0,u=0;for(let c=0;c<n;c++){a=u=0;for(let d=0;d<n;d++)a=a<<1&2047|t.get(c,d),d>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|t.get(d,c),d>=10&&(u===1488||u===93)&&s++}return s*o.N3},r.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let u=0;u<s;u++)n+=t.data[u];return Math.abs(Math.ceil(n*100/s/5)-10)*o.N4};function i(e,t,n){switch(e){case r.Patterns.PATTERN000:return(t+n)%2===0;case r.Patterns.PATTERN001:return t%2===0;case r.Patterns.PATTERN010:return n%3===0;case r.Patterns.PATTERN011:return(t+n)%3===0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2===0;case r.Patterns.PATTERN101:return t*n%2+t*n%3===0;case r.Patterns.PATTERN110:return(t*n%2+t*n%3)%2===0;case r.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}r.applyMask=function(t,n){const s=n.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)n.isReserved(u,a)||n.xor(u,a,i(t,u,a))},r.getBestMask=function(t,n){const s=Object.keys(r.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){n(c),r.applyMask(c,t);const d=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(c,t),d<u&&(u=d,a=c)}return a}})(et)),et}var J={},bt;function $t(){if(bt)return J;bt=1;const r=yt(),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return J.getBlocksCount=function(t,n){switch(n){case r.L:return o[(t-1)*4+0];case r.M:return o[(t-1)*4+1];case r.Q:return o[(t-1)*4+2];case r.H:return o[(t-1)*4+3];default:return}},J.getTotalCodewordsCount=function(t,n){switch(n){case r.L:return i[(t-1)*4+0];case r.M:return i[(t-1)*4+1];case r.Q:return i[(t-1)*4+2];case r.H:return i[(t-1)*4+3];default:return}},J}var nt={},K={},St;function le(){if(St)return K;St=1;const r=new Uint8Array(512),o=new Uint8Array(256);return(function(){let e=1;for(let t=0;t<255;t++)r[t]=e,o[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)r[t]=r[t-255]})(),K.log=function(e){if(e<1)throw new Error("log("+e+")");return o[e]},K.exp=function(e){return r[e]},K.mul=function(e,t){return e===0||t===0?0:r[o[e]+o[t]]},K}var Lt;function de(){return Lt||(Lt=1,(function(r){const o=le();r.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let s=0;s<e.length;s++)for(let a=0;a<t.length;a++)n[s+a]^=o.mul(e[s],t[a]);return n},r.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const s=n[0];for(let u=0;u<t.length;u++)n[u]^=o.mul(t[u],s);let a=0;for(;a<n.length&&n[a]===0;)a++;n=n.slice(a)}return n},r.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=r.mul(t,new Uint8Array([1,o.exp(n)]));return t}})(nt)),nt}var rt,Dt;function ge(){if(Dt)return rt;Dt=1;const r=de();function o(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),s=this.degree-n.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(n,s),a}return n},rt=o,rt}var ot={},it={},st={},qt;function Wt(){return qt||(qt=1,st.isValid=function(o){return!isNaN(o)&&o>=1&&o<=40}),st}var L={},vt;function Zt(){if(vt)return L;vt=1;const r="[0-9]+",o="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const e="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
1
+ import{bo as re}from"./index-CuWbxCsX.js";function oe(r,o){for(var i=0;i<o.length;i++){const e=o[i];if(typeof e!="string"&&!Array.isArray(e)){for(const t in e)if(t!=="default"&&!(t in r)){const n=Object.getOwnPropertyDescriptor(e,t);n&&Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var z={},Q,Bt;function ie(){return Bt||(Bt=1,Q=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Q}var $={},_={},At;function U(){if(At)return _;At=1;let r;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return _.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},_.getSymbolTotalCodewords=function(e){return o[e]},_.getBCHDigit=function(i){let e=0;for(;i!==0;)e++,i>>>=1;return e},_.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');r=e},_.isKanjiModeEnabled=function(){return typeof r<"u"},_.toSJIS=function(e){return r(e)},_}var W={},Rt;function yt(){return Rt||(Rt=1,(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function o(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+i)}}r.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4},r.from=function(e,t){if(r.isValid(e))return e;try{return o(e)}catch{return t}}})(W)),W}var Z,Tt;function se(){if(Tt)return Z;Tt=1;function r(){this.buffer=[],this.length=0}return r.prototype={get:function(o){const i=Math.floor(o/8);return(this.buffer[i]>>>7-o%8&1)===1},put:function(o,i){for(let e=0;e<i;e++)this.putBit((o>>>i-e-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),o&&(this.buffer[i]|=128>>>this.length%8),this.length++}},Z=r,Z}var X,It;function ue(){if(It)return X;It=1;function r(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}return r.prototype.set=function(o,i,e,t){const n=o*this.size+i;this.data[n]=e,t&&(this.reservedBit[n]=!0)},r.prototype.get=function(o,i){return this.data[o*this.size+i]},r.prototype.xor=function(o,i,e){this.data[o*this.size+i]^=e},r.prototype.isReserved=function(o,i){return this.reservedBit[o*this.size+i]},X=r,X}var x={},Nt;function ae(){return Nt||(Nt=1,(function(r){const o=U().getSymbolSize;r.getRowColCoords=function(e){if(e===1)return[];const t=Math.floor(e/7)+2,n=o(e),s=n===145?26:Math.ceil((n-13)/(2*t-2))*2,a=[n-7];for(let u=1;u<t-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},r.getPositions=function(e){const t=[],n=r.getRowColCoords(e),s=n.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||t.push([n[a],n[u]]);return t}})(x)),x}var tt={},Pt;function ce(){if(Pt)return tt;Pt=1;const r=U().getSymbolSize,o=7;return tt.getPositions=function(e){const t=r(e);return[[0,0],[t-o,0],[0,t-o]]},tt}var et={},Mt;function fe(){return Mt||(Mt=1,(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const o={N1:3,N2:3,N3:40,N4:10};r.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){const n=t.size;let s=0,a=0,u=0,c=null,d=null;for(let p=0;p<n;p++){a=u=0,c=d=null;for(let h=0;h<n;h++){let f=t.get(p,h);f===c?a++:(a>=5&&(s+=o.N1+(a-5)),c=f,a=1),f=t.get(h,p),f===d?u++:(u>=5&&(s+=o.N1+(u-5)),d=f,u=1)}a>=5&&(s+=o.N1+(a-5)),u>=5&&(s+=o.N1+(u-5))}return s},r.getPenaltyN2=function(t){const n=t.size;let s=0;for(let a=0;a<n-1;a++)for(let u=0;u<n-1;u++){const c=t.get(a,u)+t.get(a,u+1)+t.get(a+1,u)+t.get(a+1,u+1);(c===4||c===0)&&s++}return s*o.N2},r.getPenaltyN3=function(t){const n=t.size;let s=0,a=0,u=0;for(let c=0;c<n;c++){a=u=0;for(let d=0;d<n;d++)a=a<<1&2047|t.get(c,d),d>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|t.get(d,c),d>=10&&(u===1488||u===93)&&s++}return s*o.N3},r.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let u=0;u<s;u++)n+=t.data[u];return Math.abs(Math.ceil(n*100/s/5)-10)*o.N4};function i(e,t,n){switch(e){case r.Patterns.PATTERN000:return(t+n)%2===0;case r.Patterns.PATTERN001:return t%2===0;case r.Patterns.PATTERN010:return n%3===0;case r.Patterns.PATTERN011:return(t+n)%3===0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2===0;case r.Patterns.PATTERN101:return t*n%2+t*n%3===0;case r.Patterns.PATTERN110:return(t*n%2+t*n%3)%2===0;case r.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}r.applyMask=function(t,n){const s=n.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)n.isReserved(u,a)||n.xor(u,a,i(t,u,a))},r.getBestMask=function(t,n){const s=Object.keys(r.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){n(c),r.applyMask(c,t);const d=r.getPenaltyN1(t)+r.getPenaltyN2(t)+r.getPenaltyN3(t)+r.getPenaltyN4(t);r.applyMask(c,t),d<u&&(u=d,a=c)}return a}})(et)),et}var J={},bt;function $t(){if(bt)return J;bt=1;const r=yt(),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return J.getBlocksCount=function(t,n){switch(n){case r.L:return o[(t-1)*4+0];case r.M:return o[(t-1)*4+1];case r.Q:return o[(t-1)*4+2];case r.H:return o[(t-1)*4+3];default:return}},J.getTotalCodewordsCount=function(t,n){switch(n){case r.L:return i[(t-1)*4+0];case r.M:return i[(t-1)*4+1];case r.Q:return i[(t-1)*4+2];case r.H:return i[(t-1)*4+3];default:return}},J}var nt={},K={},St;function le(){if(St)return K;St=1;const r=new Uint8Array(512),o=new Uint8Array(256);return(function(){let e=1;for(let t=0;t<255;t++)r[t]=e,o[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)r[t]=r[t-255]})(),K.log=function(e){if(e<1)throw new Error("log("+e+")");return o[e]},K.exp=function(e){return r[e]},K.mul=function(e,t){return e===0||t===0?0:r[o[e]+o[t]]},K}var Lt;function de(){return Lt||(Lt=1,(function(r){const o=le();r.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let s=0;s<e.length;s++)for(let a=0;a<t.length;a++)n[s+a]^=o.mul(e[s],t[a]);return n},r.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const s=n[0];for(let u=0;u<t.length;u++)n[u]^=o.mul(t[u],s);let a=0;for(;a<n.length&&n[a]===0;)a++;n=n.slice(a)}return n},r.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=r.mul(t,new Uint8Array([1,o.exp(n)]));return t}})(nt)),nt}var rt,Dt;function ge(){if(Dt)return rt;Dt=1;const r=de();function o(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),s=this.degree-n.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(n,s),a}return n},rt=o,rt}var ot={},it={},st={},qt;function Wt(){return qt||(qt=1,st.isValid=function(o){return!isNaN(o)&&o>=1&&o<=40}),st}var L={},vt;function Zt(){if(vt)return L;vt=1;const r="[0-9]+",o="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const e="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
2
2
  ]))+`;L.KANJI=new RegExp(i,"g"),L.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),L.BYTE=new RegExp(e,"g"),L.NUMERIC=new RegExp(r,"g"),L.ALPHANUMERIC=new RegExp(o,"g");const t=new RegExp("^"+i+"$"),n=new RegExp("^"+r+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return L.testKanji=function(u){return t.test(u)},L.testNumeric=function(u){return n.test(u)},L.testAlphanumeric=function(u){return s.test(u)},L}var _t;function F(){return _t||(_t=1,(function(r){const o=Wt(),i=Zt();r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(n,s){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!o.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?n.ccBits[0]:s<27?n.ccBits[1]:n.ccBits[2]},r.getBestModeForData=function(n){return i.testNumeric(n)?r.NUMERIC:i.testAlphanumeric(n)?r.ALPHANUMERIC:i.testKanji(n)?r.KANJI:r.BYTE},r.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},r.isValid=function(n){return n&&n.bit&&n.ccBits};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}r.from=function(n,s){if(r.isValid(n))return n;try{return e(n)}catch{return s}}})(it)),it}var Ut;function he(){return Ut||(Ut=1,(function(r){const o=U(),i=$t(),e=yt(),t=F(),n=Wt(),s=7973,a=o.getBCHDigit(s);function u(h,f,N){for(let P=1;P<=40;P++)if(f<=r.getCapacity(P,N,h))return P}function c(h,f){return t.getCharCountIndicator(h,f)+4}function d(h,f){let N=0;return h.forEach(function(P){const b=c(P.mode,f);N+=b+P.getBitsLength()}),N}function p(h,f){for(let N=1;N<=40;N++)if(d(h,N)<=r.getCapacity(N,f,t.MIXED))return N}r.from=function(f,N){return n.isValid(f)?parseInt(f,10):N},r.getCapacity=function(f,N,P){if(!n.isValid(f))throw new Error("Invalid QR Code version");typeof P>"u"&&(P=t.BYTE);const b=o.getSymbolTotalCodewords(f),R=i.getTotalCodewordsCount(f,N),M=(b-R)*8;if(P===t.MIXED)return M;const T=M-c(P,f);switch(P){case t.NUMERIC:return Math.floor(T/10*3);case t.ALPHANUMERIC:return Math.floor(T/11*2);case t.KANJI:return Math.floor(T/13);case t.BYTE:default:return Math.floor(T/8)}},r.getBestVersionForData=function(f,N){let P;const b=e.from(N,e.M);if(Array.isArray(f)){if(f.length>1)return p(f,b);if(f.length===0)return 1;P=f[0]}else P=f;return u(P.mode,P.getLength(),b)},r.getEncodedBits=function(f){if(!n.isValid(f)||f<7)throw new Error("Invalid QR Code version");let N=f<<12;for(;o.getBCHDigit(N)-a>=0;)N^=s<<o.getBCHDigit(N)-a;return f<<12|N}})(ot)),ot}var ut={},Ft;function me(){if(Ft)return ut;Ft=1;const r=U(),o=1335,i=21522,e=r.getBCHDigit(o);return ut.getEncodedBits=function(n,s){const a=n.bit<<3|s;let u=a<<10;for(;r.getBCHDigit(u)-e>=0;)u^=o<<r.getBCHDigit(u)-e;return(a<<10|u)^i},ut}var at={},ct,kt;function we(){if(kt)return ct;kt=1;const r=F();function o(i){this.mode=r.NUMERIC,this.data=i.toString()}return o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,n,s;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),s=parseInt(n,10),e.put(s,10);const a=this.data.length-t;a>0&&(n=this.data.substr(t),s=parseInt(n,10),e.put(s,a*3+1))},ct=o,ct}var ft,zt;function ye(){if(zt)return ft;zt=1;const r=F(),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}return i.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let s=o.indexOf(this.data[n])*45;s+=o.indexOf(this.data[n+1]),t.put(s,11)}this.data.length%2&&t.put(o.indexOf(this.data[n]),6)},ft=i,ft}var lt,Vt;function Ce(){if(Vt)return lt;Vt=1;const r=F();function o(i){this.mode=r.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return o.getBitsLength=function(e){return e*8},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){for(let e=0,t=this.data.length;e<t;e++)i.put(this.data[e],8)},lt=o,lt}var dt,Kt;function Ee(){if(Kt)return dt;Kt=1;const r=F(),o=U();function i(e){this.mode=r.KANJI,this.data=e}return i.getBitsLength=function(t){return t*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=o.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
3
3
  Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},dt=i,dt}var gt={exports:{}},Ht;function pe(){return Ht||(Ht=1,(function(r){var o={single_source_shortest_paths:function(i,e,t){var n={},s={};s[e]=0;var a=o.PriorityQueue.make();a.push(e,0);for(var u,c,d,p,h,f,N,P,b;!a.empty();){u=a.pop(),c=u.value,p=u.cost,h=i[c]||{};for(d in h)h.hasOwnProperty(d)&&(f=h[d],N=p+f,P=s[d],b=typeof s[d]>"u",(b||P>N)&&(s[d]=N,a.push(d,N),n[d]=c))}if(typeof t<"u"&&typeof s[t]>"u"){var R=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(R)}return n},extract_shortest_path_from_predecessor_list:function(i,e){for(var t=[],n=e;n;)t.push(n),i[n],n=i[n];return t.reverse(),t},find_path:function(i,e,t){var n=o.single_source_shortest_paths(i,e,t);return o.extract_shortest_path_from_predecessor_list(n,t)},PriorityQueue:{make:function(i){var e=o.PriorityQueue,t={},n;i=i||{};for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.queue=[],t.sorter=i.sorter||e.default_sorter,t},default_sorter:function(i,e){return i.cost-e.cost},push:function(i,e){var t={value:i,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=o})(gt)),gt.exports}var Jt;function Be(){return Jt||(Jt=1,(function(r){const o=F(),i=we(),e=ye(),t=Ce(),n=Ee(),s=Zt(),a=U(),u=pe();function c(R){return unescape(encodeURIComponent(R)).length}function d(R,M,T){const B=[];let S;for(;(S=R.exec(T))!==null;)B.push({data:S[0],index:S.index,mode:M,length:S[0].length});return B}function p(R){const M=d(s.NUMERIC,o.NUMERIC,R),T=d(s.ALPHANUMERIC,o.ALPHANUMERIC,R);let B,S;return a.isKanjiModeEnabled()?(B=d(s.BYTE,o.BYTE,R),S=d(s.KANJI,o.KANJI,R)):(B=d(s.BYTE_KANJI,o.BYTE,R),S=[]),M.concat(T,B,S).sort(function(C,y){return C.index-y.index}).map(function(C){return{data:C.data,mode:C.mode,length:C.length}})}function h(R,M){switch(M){case o.NUMERIC:return i.getBitsLength(R);case o.ALPHANUMERIC:return e.getBitsLength(R);case o.KANJI:return n.getBitsLength(R);case o.BYTE:return t.getBitsLength(R)}}function f(R){return R.reduce(function(M,T){const B=M.length-1>=0?M[M.length-1]:null;return B&&B.mode===T.mode?(M[M.length-1].data+=T.data,M):(M.push(T),M)},[])}function N(R){const M=[];for(let T=0;T<R.length;T++){const B=R[T];switch(B.mode){case o.NUMERIC:M.push([B,{data:B.data,mode:o.ALPHANUMERIC,length:B.length},{data:B.data,mode:o.BYTE,length:B.length}]);break;case o.ALPHANUMERIC:M.push([B,{data:B.data,mode:o.BYTE,length:B.length}]);break;case o.KANJI:M.push([B,{data:B.data,mode:o.BYTE,length:c(B.data)}]);break;case o.BYTE:M.push([{data:B.data,mode:o.BYTE,length:c(B.data)}])}}return M}function P(R,M){const T={},B={start:{}};let S=["start"];for(let g=0;g<R.length;g++){const C=R[g],y=[];for(let l=0;l<C.length;l++){const A=C[l],m=""+g+l;y.push(m),T[m]={node:A,lastCount:0},B[m]={};for(let E=0;E<S.length;E++){const w=S[E];T[w]&&T[w].node.mode===A.mode?(B[w][m]=h(T[w].lastCount+A.length,A.mode)-h(T[w].lastCount,A.mode),T[w].lastCount+=A.length):(T[w]&&(T[w].lastCount=A.length),B[w][m]=h(A.length,A.mode)+4+o.getCharCountIndicator(A.mode,M))}}S=y}for(let g=0;g<S.length;g++)B[S[g]].end=0;return{map:B,table:T}}function b(R,M){let T;const B=o.getBestModeForData(R);if(T=o.from(M,B),T!==o.BYTE&&T.bit<B.bit)throw new Error('"'+R+'" cannot be encoded with mode '+o.toString(T)+`.
4
4
  Suggested mode is: `+o.toString(B));switch(T===o.KANJI&&!a.isKanjiModeEnabled()&&(T=o.BYTE),T){case o.NUMERIC:return new i(R);case o.ALPHANUMERIC:return new e(R);case o.KANJI:return new n(R);case o.BYTE:return new t(R)}}r.fromArray=function(M){return M.reduce(function(T,B){return typeof B=="string"?T.push(b(B,null)):B.data&&T.push(b(B.data,B.mode)),T},[])},r.fromString=function(M,T){const B=p(M,a.isKanjiModeEnabled()),S=N(B),g=P(S,T),C=u.find_path(g.map,"start","end"),y=[];for(let l=1;l<C.length-1;l++)y.push(g.table[C[l]].node);return r.fromArray(f(y))},r.rawSplit=function(M){return r.fromArray(p(M,a.isKanjiModeEnabled()))}})(at)),at}var Ot;function Ae(){if(Ot)return $;Ot=1;const r=U(),o=yt(),i=se(),e=ue(),t=ae(),n=ce(),s=fe(),a=$t(),u=ge(),c=he(),d=me(),p=F(),h=Be();function f(g,C){const y=g.size,l=n.getPositions(C);for(let A=0;A<l.length;A++){const m=l[A][0],E=l[A][1];for(let w=-1;w<=7;w++)if(!(m+w<=-1||y<=m+w))for(let I=-1;I<=7;I++)E+I<=-1||y<=E+I||(w>=0&&w<=6&&(I===0||I===6)||I>=0&&I<=6&&(w===0||w===6)||w>=2&&w<=4&&I>=2&&I<=4?g.set(m+w,E+I,!0,!0):g.set(m+w,E+I,!1,!0))}}function N(g){const C=g.size;for(let y=8;y<C-8;y++){const l=y%2===0;g.set(y,6,l,!0),g.set(6,y,l,!0)}}function P(g,C){const y=t.getPositions(C);for(let l=0;l<y.length;l++){const A=y[l][0],m=y[l][1];for(let E=-2;E<=2;E++)for(let w=-2;w<=2;w++)E===-2||E===2||w===-2||w===2||E===0&&w===0?g.set(A+E,m+w,!0,!0):g.set(A+E,m+w,!1,!0)}}function b(g,C){const y=g.size,l=c.getEncodedBits(C);let A,m,E;for(let w=0;w<18;w++)A=Math.floor(w/3),m=w%3+y-8-3,E=(l>>w&1)===1,g.set(A,m,E,!0),g.set(m,A,E,!0)}function R(g,C,y){const l=g.size,A=d.getEncodedBits(C,y);let m,E;for(m=0;m<15;m++)E=(A>>m&1)===1,m<6?g.set(m,8,E,!0):m<8?g.set(m+1,8,E,!0):g.set(l-15+m,8,E,!0),m<8?g.set(8,l-m-1,E,!0):m<9?g.set(8,15-m-1+1,E,!0):g.set(8,15-m-1,E,!0);g.set(l-8,8,1,!0)}function M(g,C){const y=g.size;let l=-1,A=y-1,m=7,E=0;for(let w=y-1;w>0;w-=2)for(w===6&&w--;;){for(let I=0;I<2;I++)if(!g.isReserved(A,w-I)){let v=!1;E<C.length&&(v=(C[E]>>>m&1)===1),g.set(A,w-I,v),m--,m===-1&&(E++,m=7)}if(A+=l,A<0||y<=A){A-=l,l=-l;break}}}function T(g,C,y){const l=new i;y.forEach(function(I){l.put(I.mode.bit,4),l.put(I.getLength(),p.getCharCountIndicator(I.mode,g)),I.write(l)});const A=r.getSymbolTotalCodewords(g),m=a.getTotalCodewordsCount(g,C),E=(A-m)*8;for(l.getLengthInBits()+4<=E&&l.put(0,4);l.getLengthInBits()%8!==0;)l.putBit(0);const w=(E-l.getLengthInBits())/8;for(let I=0;I<w;I++)l.put(I%2?17:236,8);return B(l,g,C)}function B(g,C,y){const l=r.getSymbolTotalCodewords(C),A=a.getTotalCodewordsCount(C,y),m=l-A,E=a.getBlocksCount(C,y),w=l%E,I=E-w,v=Math.floor(l/E),V=Math.floor(m/E),te=V+1,Ct=v-V,ee=new u(Ct);let O=0;const H=new Array(E),Et=new Array(E);let j=0;const ne=new Uint8Array(g.buffer);for(let k=0;k<E;k++){const G=k<I?V:te;H[k]=ne.slice(O,O+G),Et[k]=ee.encode(H[k]),O+=G,j=Math.max(j,G)}const Y=new Uint8Array(l);let pt=0,D,q;for(D=0;D<j;D++)for(q=0;q<E;q++)D<H[q].length&&(Y[pt++]=H[q][D]);for(D=0;D<Ct;D++)for(q=0;q<E;q++)Y[pt++]=Et[q][D];return Y}function S(g,C,y,l){let A;if(Array.isArray(g))A=h.fromArray(g);else if(typeof g=="string"){let v=C;if(!v){const V=h.rawSplit(g);v=c.getBestVersionForData(V,y)}A=h.fromString(g,v||40)}else throw new Error("Invalid data");const m=c.getBestVersionForData(A,y);if(!m)throw new Error("The amount of data is too big to be stored in a QR Code");if(!C)C=m;else if(C<m)throw new Error(`
@@ -1 +1 @@
1
- import{$ as I,r as o,aE as we,aF as Ve,aG as ne,aH as F,aI as de,aJ as pe,aK as ge,aL as me,j as e,aM as De,aN as Ae,aO as ke,aP as Ie,aQ as _e,aR as ve,aS as Oe,aT as Be,aU as Pe,aV as be,aW as je,aX as Fe,aY as He,aZ as Ue,a_ as We,a$ as qe,b0 as Ye,b1 as Je,n as ie,b2 as Ke,c as Re,aj as V,B as G,y as te,z as se,A as ue,b3 as Xe,ay as Ge,b4 as Qe,b5 as Ze,b6 as et,b7 as tt,b8 as st,b9 as at,ba as nt,bb as it,bc as rt,bd as lt,F as ot,T as X,be as ct,bf as dt,bg as ut,bh as mt,bi as xt,bj as ft,bk as ht}from"./index-BG75F5tP.js";import{M as Te,b as ye}from"./html-view-CDZotjAw.js";const pt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],gt=I("circle-alert",pt);const vt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],bt=I("circle-minus",vt);const jt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],yt=I("external-link",jt);const Nt=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Me=I("file-code-corner",Nt);const Ct=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],wt=I("gauge",Ct);const kt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Rt=I("lightbulb",kt);const Tt=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]],Mt=I("scale",Tt);const Et=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],zt=I("video",Et),Ee=o.createContext(void 0);function xe(){const t=o.useContext(Ee);if(t===void 0)throw new Error(we(64));return t}let $t=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const fe={tabActivationDirection:t=>({[$t.activationDirection]:t})},St=o.forwardRef(function(a,s){const{className:n,defaultValue:r=0,onValueChange:i,orientation:c="horizontal",render:u,value:h,style:b,...p}=a,y=a.defaultValue!==void 0,T=o.useRef([]),[E,d]=o.useState(()=>new Map),[l,R]=Ve({controlled:h,default:r,name:"Tabs",state:"value"}),S=h!==void 0,[f,C]=o.useState(()=>new Map),w=o.useCallback(m=>{if(m===void 0)return null;for(const[v,N]of f.entries())if(N!=null&&m===(N.value??N.index))return v;return null},[f]),[D,L]=o.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:k,tabActivationDirection:M}=D;let g=M,z=!1;k!==l&&(g=Ne(k,l,c,f),z=k!=null&&l!=null&&w(l)==null);const x=z?k:l,$=k!==x||M!==g;ne(()=>{$&&L({previousValue:x,tabActivationDirection:g})},[x,$,g]);const Q=F((m,v)=>{const N=Ne(l,m,c,f);v.activationDirection=N,i?.(m,v),!v.isCanceled&&R(m)}),Y=F((m,v)=>{i?.(m,de(v,void 0,void 0,{activationDirection:"none"}))}),_=F((m,v)=>{d(N=>{if(N.get(m)===v)return N;const A=new Map(N);return A.set(m,v),A})}),W=F((m,v)=>{d(N=>{if(!N.has(m)||N.get(m)!==v)return N;const A=new Map(N);return A.delete(m),A})}),Z=o.useCallback(m=>E.get(m),[E]),ee=o.useCallback(m=>{for(const v of f.values())if(m===v?.value)return v?.id},[f]),re=o.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:ee,getTabPanelIdByValue:Z,onValueChange:Q,orientation:c,registerMountedTabPanel:_,setTabMap:C,unregisterMountedTabPanel:W,tabActivationDirection:g,value:l}),[w,ee,Z,Q,c,_,C,W,g,l]),J=o.useMemo(()=>{for(const m of f.values())if(m!=null&&m.value===l)return m},[f,l]),le=o.useMemo(()=>{for(const m of f.values())if(m!=null&&!m.disabled)return m.value},[f]),j=o.useRef(!y),O=o.useRef(y),oe=o.useRef(!1);ne(()=>{if(S)return;function m(B,K){R(B),L(ce=>ce.previousValue===B&&ce.tabActivationDirection==="none"?ce:{previousValue:B,tabActivationDirection:"none"}),Y(B,K),j.current=!1}if(f.size===0){if(!oe.current||l===null)return;m(null,ge);return}oe.current=!0;const v=J?.disabled,N=J==null&&l!==null;if(!v&&l===r&&(O.current=!1),O.current&&v&&l===r)return;const A=j.current;if(v||N){const B=le??null;if(l===B){j.current=!1;return}let K=ge;A?K=pe:v&&(K=Ae),m(B,K);return}A&&J!=null&&(Y(l,pe),j.current=!1)},[r,le,S,Y,J,R,f,l]);const Le=me("div",a,{state:{orientation:c,tabActivationDirection:g},ref:s,props:p,stateAttributesMapping:fe});return e.jsx(Ee.Provider,{value:re,children:e.jsx(De,{elementsRef:T,children:Le})})});function Ne(t,a,s,n){if(t==null||a==null)return"none";let r=null,i=null;for(const[h,b]of n.entries()){if(b==null)continue;const p=b.value??b.index;if(t===p&&(r=h),a===p&&(i=h),r!=null&&i!=null)break}if(r==null||i==null)return r!==i&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof a?s==="horizontal"?a>t?"right":"left":a>t?"down":"up":"none";const c=r.getBoundingClientRect(),u=i.getBoundingClientRect();if(s==="horizontal"){if(u.left<c.left)return"left";if(u.left>c.left)return"right"}else{if(u.top<c.top)return"up";if(u.top>c.top)return"down"}return"none"}const ze=o.createContext(void 0);function Lt(){const t=o.useContext(ze);if(t===void 0)throw new Error(we(65));return t}const Vt=o.forwardRef(function(a,s){const{className:n,disabled:r=!1,render:i,value:c,id:u,nativeButton:h=!0,style:b,...p}=a,{value:y,getTabPanelIdByValue:T,orientation:E}=xe(),{activateOnFocus:d,highlightedTabIndex:l,onTabActivation:R,registerTabResizeObserverElement:S,setHighlightedTabIndex:f,tabsListElement:C}=Lt(),w=ke(u),D=o.useMemo(()=>({disabled:r,id:w,value:c}),[r,w,c]),{compositeProps:L,compositeRef:k,index:M}=Ie({metadata:D}),g=c===y,z=o.useRef(!1),x=o.useRef(null);o.useEffect(()=>{const j=x.current;if(j)return S(j)},[S]),ne(()=>{if(z.current){z.current=!1;return}if(!(g&&M>-1&&l!==M))return;const j=C;if(j!=null){const O=_e(ve(j));if(O&&Oe(j,O))return}r||f(M)},[g,M,l,f,r,C]);const{getButtonProps:$,buttonRef:Q}=Be({disabled:r,native:h,focusableWhenDisabled:!0}),Y=T(c),_=o.useRef(!1),W=o.useRef(!1);function Z(j){g||r||R(c,de(be,j.nativeEvent,void 0,{activationDirection:"none"}))}function ee(j){g||(M>-1&&!r&&f(M),!r&&d&&(!_.current||_.current&&W.current)&&R(c,de(be,j.nativeEvent,void 0,{activationDirection:"none"})))}function re(j){if(g||r)return;_.current=!0;function O(){_.current=!1,W.current=!1}(!j.button||j.button===0)&&(W.current=!0,ve(j.currentTarget).addEventListener("pointerup",O,{once:!0}))}return me("button",a,{state:{disabled:r,active:g,orientation:E},ref:[s,Q,k,x],props:[L,{role:"tab","aria-controls":Y,"aria-selected":g,id:w,onClick:Z,onFocus:ee,onPointerDown:re,[Pe]:g?"":void 0,onKeyDownCapture(){z.current=!0}},p,$]})});let Dt=(function(t){return t.index="data-index",t.activationDirection="data-activation-direction",t.orientation="data-orientation",t.hidden="data-hidden",t[t.startingStyle=je.startingStyle]="startingStyle",t[t.endingStyle=je.endingStyle]="endingStyle",t})({});const At={...fe,...qe},It=o.forwardRef(function(a,s){const{className:n,value:r,render:i,keepMounted:c=!1,style:u,...h}=a,{value:b,getTabIdByPanelValue:p,orientation:y,tabActivationDirection:T,registerMountedTabPanel:E,unregisterMountedTabPanel:d}=xe(),l=ke(),R=o.useMemo(()=>({id:l,value:r}),[l,r]),{ref:S,index:f}=Fe({metadata:R}),C=r===b,{mounted:w,transitionStatus:D,setMounted:L}=He(C),k=!w,M=p(r),g={hidden:k,orientation:y,tabActivationDirection:T,transitionStatus:D},z=o.useRef(null),x=me("div",a,{state:g,ref:[s,S,z],props:[{"aria-labelledby":M,hidden:k,id:l,role:"tabpanel",tabIndex:C?0:-1,inert:Ue(!C),[Dt.index]:f},h],stateAttributesMapping:At});return We({open:C,ref:z,onComplete(){C||L(!1)}}),ne(()=>{if(!(k&&!c)&&l!=null)return E(r,l),()=>{d(r,l)}},[k,c,r,l,E,d]),c||w?x:null}),_t=o.forwardRef(function(a,s){const{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:c,style:u,...h}=a,{onValueChange:b,orientation:p,value:y,setTabMap:T,tabActivationDirection:E}=xe(),[d,l]=o.useState(0),[R,S]=o.useState(null),f=o.useRef(new Set),C=o.useRef(new Set),w=o.useRef(null);o.useEffect(()=>{if(typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f.current.forEach($=>{$()})});return w.current=x,R&&x.observe(R),C.current.forEach($=>{x.observe($)}),()=>{x.disconnect(),w.current=null}},[R]);const D=F(x=>(f.current.add(x),()=>{f.current.delete(x)})),L=F(x=>(C.current.add(x),w.current?.observe(x),()=>{C.current.delete(x),w.current?.unobserve(x)})),k=F((x,$)=>{x!==y&&b(x,$)}),M={orientation:p,tabActivationDirection:E},g={"aria-orientation":p==="vertical"?"vertical":void 0,role:"tablist"},z=o.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:d,registerIndicatorUpdateListener:D,registerTabResizeObserverElement:L,onTabActivation:k,setHighlightedTabIndex:l,tabsListElement:R}),[n,d,D,L,k,l,R]);return e.jsx(ze.Provider,{value:z,children:e.jsx(Ye,{render:c,className:r,style:u,state:M,refs:[s,S],props:[g,h],stateAttributesMapping:fe,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:p,onHighlightedIndexChange:l,onMapChange:T,disabledIndices:Je})})});function $e({className:t,orientation:a="horizontal",...s}){return e.jsx(St,{"data-slot":"tabs","data-orientation":a,className:ie("group/tabs flex gap-2 data-horizontal:flex-col",t),...s})}const Ot=Ke("group/tabs-list inline-flex w-fit items-center justify-center rounded-2xl p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:p-1 data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Se({className:t,variant:a="default",...s}){return e.jsx(_t,{"data-slot":"tabs-list","data-variant":a,className:ie(Ot({variant:a}),t),...s})}function H({className:t,...a}){return e.jsx(Vt,{"data-slot":"tabs-trigger",className:ie("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent! px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-0.5 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...a})}function U({className:t,...a}){return e.jsx(It,{"data-slot":"tabs-content",className:ie("flex-1 text-sm outline-none",t),...a})}function P({title:t,children:a}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-base font-semibold tracking-tight",children:t}),a]})}function q({items:t,empty:a}){return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a}):e.jsx("ul",{className:"space-y-2 text-sm leading-6",children:t.map(s=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:"mt-2 size-1.5 shrink-0 rounded-full bg-current"}),e.jsx("span",{children:s})]},s))})}function ae({references:t,onOpen:a}){return t.length===0?null:e.jsxs("fieldset",{className:"flex flex-wrap gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Repository references"}),t.map(s=>e.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-auto min-h-8 max-w-full justify-start gap-2 py-1.5 font-mono text-xs",onClick:()=>a(s),children:[e.jsx(Me,{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"truncate",children:[s.label??s.path,s.line===void 0?"":`:${s.line}`]})]},`${s.path}:${s.line??""}`))]})}function Bt({option:t,onOpen:a}){return e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsx(V,{variant:"secondary",children:"Option"}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.name}),e.jsx("p",{className:"max-w-3xl text-base leading-7 text-muted-foreground",children:t.summary}),e.jsx(ae,{references:t.references,onOpen:a})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 font-medium",children:[e.jsx(Xe,{className:"size-4 text-emerald-600 dark:text-emerald-400"})," Pros"]}),e.jsx(q,{items:t.pros,empty:"No advantages recorded."})]}),e.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 font-medium",children:[e.jsx(Ge,{className:"size-4 text-rose-600 dark:text-rose-400"})," Cons"]}),e.jsx(q,{items:t.cons,empty:"No disadvantages recorded."})]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(P,{title:"Risks",children:t.risks.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No risks recorded."}):e.jsx("div",{className:"space-y-3",children:t.risks.map(s=>e.jsxs("div",{className:"rounded-lg border bg-muted/20 p-4 text-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"font-medium",children:s.summary}),s.severity===void 0?null:e.jsx(V,{variant:"outline",className:"capitalize",children:s.severity})]}),s.mitigation===void 0?null:e.jsxs("p",{className:"mt-2 leading-6 text-muted-foreground",children:["Mitigation: ",s.mitigation]})]},s.summary))})}),e.jsx(P,{title:"Effort",children:e.jsx("p",{className:"rounded-lg border bg-muted/20 p-4 text-sm leading-6",children:t.effort??"No effort assessment recorded."})})]})]})}const Pt={poor:"border-rose-500/30 bg-rose-500/10",fair:"border-amber-500/30 bg-amber-500/10",good:"border-sky-500/30 bg-sky-500/10",strong:"border-emerald-500/30 bg-emerald-500/10"};function Ft({document:t}){return e.jsxs("div",{className:"mx-auto w-full max-w-7xl space-y-7 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(Mt,{className:"size-3.5"})," Comparison"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:"Compare the options"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Assessments are explanatory signals, not code truth or review state."})]}),t.criteria.map(a=>e.jsxs("section",{className:"space-y-3 rounded-xl border bg-card p-4 sm:p-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold",children:a.label}),a.description===void 0?null:e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a.description})]}),e.jsx("div",{"data-testid":`decision-comparison-${a.id}`,className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:t.options.map(s=>{const n=t.assessments.find(r=>r.optionId===s.id&&r.criterionId===a.id);return e.jsxs("article",{className:`min-w-0 rounded-lg border p-4 ${n===void 0?"bg-muted/20":Pt[n.rating]}`,children:[e.jsx("h3",{className:"truncate text-sm font-semibold",children:s.name}),n===void 0?e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Not assessed"}):e.jsxs(e.Fragment,{children:[e.jsx(V,{variant:"outline",className:"mt-2 capitalize",children:n.rating}),e.jsx("p",{className:"mt-3 text-sm leading-6",children:n.note})]})]},s.id)})})]},a.id))]})}function Ht({document:t,repoPath:a}){const s=Re(i=>i.openTab),n=i=>{a!==void 0&&s(te("file",`${a}/${i.path}`,{title:ue(i.path),...i.line===void 0?{}:{line:i.line}},se()))},r=t.decision===void 0?"Recommendation":"Decision";return e.jsxs($e,{defaultValue:"summary",className:"flex h-full min-h-0 flex-col gap-0",children:[e.jsx("div",{className:"shrink-0 overflow-x-auto border-b px-3 py-2 sm:px-5",children:e.jsxs(Se,{variant:"line","aria-label":"Decision Canvas views",className:"w-max min-w-full justify-start",children:[e.jsx(H,{value:"summary",children:"Summary"}),t.options.map(i=>e.jsx(H,{value:`option-${i.id}`,children:i.name},i.id)),e.jsx(H,{value:"compare",children:"Compare"}),e.jsx(H,{value:"recommendation",children:r})]})}),e.jsx(U,{value:"summary",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-4",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(Rt,{className:"size-3.5"})," Decision / RFC"]}),e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:t.title}),e.jsx("p",{className:"max-w-3xl text-lg leading-8 text-muted-foreground",children:t.summary}),e.jsx(ae,{references:t.references,onOpen:n})]}),t.context===void 0?null:e.jsx(P,{title:"Context",children:e.jsx("p",{className:"max-w-3xl whitespace-pre-wrap text-sm leading-7",children:t.context})}),e.jsx(P,{title:"Options at a glance",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:t.options.map(i=>e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsx("h3",{className:"font-semibold",children:i.name}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.summary})]},i.id))})})]})}),t.options.map(i=>e.jsx(U,{value:`option-${i.id}`,className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Bt,{option:i,onOpen:n})},i.id)),e.jsx(U,{value:"compare",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Ft,{document:t})}),e.jsx(U,{value:"recommendation",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(wt,{className:"size-3.5"})," ",r]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.recommendation.summary}),e.jsxs(V,{variant:"outline",className:"capitalize",children:[t.recommendation.confidence," confidence"]})]}),e.jsx(P,{title:"Rationale",children:e.jsx(q,{items:t.recommendation.rationale,empty:"No rationale recorded."})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(P,{title:"Assumptions",children:e.jsx(q,{items:t.recommendation.assumptions,empty:"No assumptions recorded."})}),e.jsx(P,{title:"What would change this",children:e.jsx(q,{items:t.recommendation.changeConditions,empty:"No change conditions recorded."})})]}),e.jsx(ae,{references:t.recommendation.references,onOpen:n}),t.decision===void 0?null:e.jsxs("section",{className:"space-y-4 rounded-xl border border-primary/30 bg-primary/5 p-5 sm:p-6",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[e.jsx(gt,{className:"size-5"})," Recorded final decision"]}),e.jsx("p",{className:"text-base leading-7",children:t.decision.summary}),e.jsx(q,{items:t.decision.rationale,empty:"No additional rationale recorded."}),e.jsx(ae,{references:t.decision.references,onOpen:n})]})]})})]})}function Ce(t,a){return t===null?null:`${t}/${a.split("/").map(encodeURIComponent).join("/")}`}function Ut({references:t,onOpen:a}){return t.length===0?null:e.jsxs("fieldset",{className:"flex flex-wrap gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Code references"}),t.map(s=>{const n=s.startLine===void 0?"":s.endLine===void 0||s.endLine===s.startLine?`:${s.startLine}`:`:${s.startLine}-${s.endLine}`;return e.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-auto min-h-8 max-w-full justify-start gap-2 py-1.5 font-mono text-xs",onClick:()=>a(s),children:[e.jsx(Me,{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"truncate",children:[s.label??s.path,n]})]},`${s.path}:${s.startLine??""}:${s.endLine??""}`)})]})}function Wt({section:t,onOpen:a,onComment:s}){return e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-6 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.title}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Comment on this section"}),e.jsx(Ut,{references:t.references,onOpen:a})]}),t.prose===""?null:e.jsx(Te,{content:t.prose,compact:!0,className:"overflow-visible"}),t.svg===void 0?null:e.jsx("div",{className:"overflow-hidden rounded-xl border bg-card",style:{height:t.htmlHeight??448},children:e.jsx(ye,{html:t.svg,title:`${t.title} diagram`})}),t.html===void 0?null:e.jsx("div",{className:"overflow-hidden rounded-xl border bg-card",style:{height:t.htmlHeight??448},children:e.jsx(ye,{html:t.html,title:`${t.title} visual`})})]})}function qt({asset:t,baseUrl:a}){if(t.kind==="link")return e.jsxs("a",{className:"flex items-center gap-3 rounded-xl border bg-card p-4 text-sm hover:bg-muted/40",href:t.href,target:"_blank",rel:"noreferrer",children:[e.jsx(yt,{className:"size-4 shrink-0"}),e.jsx("span",{className:"font-medium",children:t.label})]});const s=Ce(a,t.path);return s===null?e.jsxs("div",{className:"rounded-xl border bg-card p-4 text-sm",children:[e.jsx("p",{className:"font-medium",children:t.label}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Attachment is unavailable."})]}):t.kind==="image"?e.jsxs("figure",{className:"overflow-hidden rounded-xl border bg-card",children:[e.jsx("img",{src:s,alt:t.label,className:"max-h-[36rem] w-full object-contain"}),e.jsx("figcaption",{className:"border-t px-4 py-3 text-sm font-medium",children:t.label})]}):t.kind==="video"?e.jsxs("figure",{className:"overflow-hidden rounded-xl border bg-card",children:[e.jsxs("video",{className:"max-h-[36rem] w-full bg-black",controls:!0,preload:"metadata",children:[e.jsx("source",{src:s,type:t.mime}),t.captions===void 0?null:e.jsx("track",{kind:"captions",src:Ce(a,t.captions)??void 0,srcLang:"en",label:"Captions",default:!0}),"Your browser cannot play this video."]}),e.jsxs("figcaption",{className:"flex items-center gap-2 border-t px-4 py-3 text-sm font-medium",children:[e.jsx(zt,{className:"size-4 shrink-0"}),t.label]})]}):e.jsxs("a",{className:"flex items-center gap-3 rounded-xl border bg-card p-4 text-sm hover:bg-muted/40",href:s,target:"_blank",rel:"noreferrer",children:[e.jsx(ot,{className:"size-4 shrink-0"}),e.jsx("span",{className:"font-medium",children:t.label})]})}const Yt={pass:rt,fail:it,skip:bt};function Jt({document:t,assetBaseUrl:a}){const s=t.evidence;return s===void 0?null:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-7 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx(V,{variant:"secondary",children:"Evidence"}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:s.title})]}),s.checks.length===0?null:e.jsx("section",{className:"grid gap-3 md:grid-cols-2",children:s.checks.map(n=>{const r=Yt[n.status];return e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"size-4 shrink-0"}),e.jsx("p",{className:"font-medium",children:n.label}),e.jsx(V,{variant:"outline",className:"ml-auto capitalize",children:n.status})]}),n.detail===void 0?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n.detail})]},n.label)})}),s.assets.length===0?null:e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Attachments"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:s.assets.map(n=>e.jsx(qt,{asset:n,baseUrl:a},n.kind==="link"?n.href:n.path))})]})]})}function Kt({canvasId:t}){const s=lt().filter(n=>n.anchor?.kind==="changeset"||n.anchor?.kind==="canvas"&&n.anchor.canvasId===t);return s.length===0?null:e.jsxs("section",{className:"mx-auto w-full max-w-5xl space-y-3 border-t p-5 sm:p-8",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Review comments"}),s.map(n=>e.jsxs("article",{className:"rounded-lg border bg-card p-3 text-sm",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n.anchor?.kind==="changeset"?"Whole changeset":n.anchor?.kind!=="canvas"||n.anchor.section===void 0?"Review Canvas":n.anchor.section}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap",children:n.body}),n.agentReply===void 0?null:e.jsxs("div",{className:"mt-3 border-l-2 border-border pl-3","data-testid":`canvas-comment-agent-${n.id}`,children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Agent"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-foreground",children:n.agentReply.body})]})]},n.id))]})}function Xt({document:t,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:r}){const i=Re(d=>d.openTab),{add:c}=Qe(),[u,h]=o.useState(null),[b,p]=o.useState(""),y=d=>{h(d),p("")},T=d=>{if(a===void 0)return;const l=d.startLine;if(r?.type==="working"||r?.type==="range"){i(te("diff",d.path,{title:ue(d.path),...r.type==="range"?{base:r.base}:{},...l===void 0?{}:{line:l}},se()));return}if(r?.type==="commit"){i(te("commit",r.hash,{title:r.hash.slice(0,12),reviewFilePath:d.path,...l===void 0?{}:{line:l}},se()));return}i(te("file",`${a}/${d.path}`,{title:ue(d.path),...l===void 0?{}:{line:l}},se()))};return e.jsxs(e.Fragment,{children:[e.jsxs($e,{defaultValue:"section-0",className:"flex h-full min-h-0 flex-col gap-0",children:[e.jsx("div",{className:"shrink-0 overflow-x-auto border-b px-3 py-2 sm:px-5",children:e.jsxs(Se,{variant:"line","aria-label":"Review Canvas sections",className:"w-max min-w-full justify-start",children:[t.sections.map((d,l)=>e.jsx(H,{value:`section-${l}`,children:d.title},d.title)),t.evidence===void 0?null:e.jsx(H,{value:"evidence",children:"Evidence"}),e.jsx(H,{value:"discussion",children:"Discussion"}),e.jsx(G,{type:"button",variant:"ghost",size:"sm",onClick:()=>y("changeset"),children:"Comment on change"})]})}),t.sections.map((d,l)=>e.jsxs(U,{value:`section-${l}`,className:"min-h-0 flex-1 overflow-y-auto",children:[l!==0||t.summary===void 0?null:e.jsx("p",{className:"mx-auto max-w-5xl px-5 pt-5 text-base leading-7 text-muted-foreground sm:px-8",children:t.summary}),e.jsx(Wt,{section:d,onOpen:T,onComment:()=>y(d.title)})]},d.title)),e.jsx(U,{value:"evidence",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Jt,{document:t,assetBaseUrl:s})}),e.jsx(U,{value:"discussion",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Kt,{canvasId:n??t.title})})]}),e.jsx(Ze,{open:u!==null,onOpenChange:d=>!d&&h(null),children:e.jsxs(et,{children:[e.jsx(tt,{children:e.jsx(st,{children:"Review comment"})}),e.jsx(at,{value:b,onChange:d=>p(d.target.value),placeholder:"What should the reviewer know?"}),e.jsx(nt,{children:e.jsx(G,{type:"button",onClick:()=>{u===null||b.trim()===""||c({body:b.trim(),anchor:u==="changeset"?{kind:"changeset"}:{kind:"canvas",canvasId:n??t.title,section:u}}).then(()=>h(null))},children:"Add comment"})})]})})]})}function Gt({content:t,repoPath:a,assetBaseUrl:s=null,canvasId:n,reviewTarget:r}){let i;try{i=JSON.parse(t)}catch(u){return e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",u instanceof Error?u.message:"invalid JSON"]})}const c=ct.safeParse(i);return c.success?c.data.template==="review"?e.jsx("div",{"data-testid":X.structuredCanvas,className:"h-full min-h-0",children:e.jsx(Xt,{document:c.data,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:r})}):e.jsx("div",{"data-testid":X.structuredCanvas,className:"h-full min-h-0",children:e.jsx(Ht,{document:c.data,repoPath:a})}):e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",dt(c.error)]})}function Qt(t){if(typeof t!="object"||t===null)return null;const a=t;return a.source!=="porcelain-canvas"?null:typeof a.href=="string"&&/^https?:\/\//i.test(a.href)?a.href:null}function he({projectId:t,canvasId:a,worktreePath:s,environmentId:n,revision:r}){const{mint:i}=mt(),u=xt(n??null)?.session.baseUrl()??ft(),[h,b]=o.useState(null),[p,y]=o.useState(null);return o.useEffect(()=>{let T=!1;b(null),y(null);const E={projectId:t,canvasId:a,...s===void 0?{}:{worktreePath:s},...n===void 0?{}:{environmentId:n}};return ht((async()=>{try{const d=await i(E);T||b(`${u}/canvas/${d}`)}catch(d){T||y(d instanceof Error&&d.message.length>0?d.message:"Could not open this Canvas.")}})(),"fallback"),()=>{T=!0}},[t,a,s,n,u,i,r]),{src:h,error:p}}function Zt({projectId:t,canvasId:a,title:s,worktreePath:n,environmentId:r,revision:i}){const{src:c,error:u}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i}),h=o.useRef(null);return o.useEffect(()=>{function b(p){if(p.source!==h.current?.contentWindow)return;const y=Qt(p.data);y!==null&&window.open(y,"_blank","noopener,noreferrer")}return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[]),u!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:u}):c===null?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("iframe",{ref:h,"data-testid":X.canvasIframe,title:s,src:c,sandbox:"allow-scripts",className:"h-full w-full flex-1 border-0 bg-background"})}function es({projectId:t,canvasId:a,content:s,worktreePath:n,environmentId:r,revision:i,reviewTarget:c}){const{src:u}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i});return e.jsx(Gt,{content:s,canvasId:a,repoPath:n,assetBaseUrl:u===null?null:`${u}/assets`,reviewTarget:c})}function is({projectId:t,canvasId:a,worktreePath:s,environmentId:n,reviewTarget:r}){const{canvas:i,isLoading:c,loadError:u}=ut(t,a,s??null,n??null);return u!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:u}):c||i===void 0?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):i.record.kind==="markdown"?e.jsx(ts,{projectId:t,canvasId:a,content:i.content,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`}):i.record.kind==="structured"?e.jsx(es,{projectId:t,canvasId:a,content:i.content,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`,reviewTarget:r}):e.jsx(Zt,{projectId:t,canvasId:a,title:i.record.title,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`})}function ts({projectId:t,canvasId:a,content:s,worktreePath:n,environmentId:r,revision:i}){const{src:c}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i});return e.jsx(Te,{content:s,assetBaseUrl:c===null?null:`${c}/assets`})}export{is as CanvasView};
1
+ import{$ as I,r as o,aG as we,aH as Ve,aI as ne,aJ as F,aK as de,aL as pe,aM as ge,aN as me,j as e,aO as Ae,aP as De,aQ as ke,aR as Ie,aS as _e,aT as ve,aU as Oe,aV as Be,aW as Pe,aX as be,aY as je,aZ as Fe,a_ as He,a$ as Ue,b0 as We,b1 as qe,b2 as Ye,b3 as Je,n as ie,b4 as Ke,c as Re,al as V,B as G,y as te,z as se,A as ue,b5 as Xe,aA as Ge,b6 as Qe,b7 as Ze,b8 as et,b9 as tt,ba as st,bb as at,bc as nt,bd as it,be as rt,bf as lt,F as ot,T as X,bg as ct,bh as dt,bi as ut,bj as mt,bk as xt,bl as ft,bm as ht}from"./index-CuWbxCsX.js";import{M as Te,b as ye}from"./html-view-BPOrX4do.js";const pt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],gt=I("circle-alert",pt);const vt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],bt=I("circle-minus",vt);const jt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],yt=I("external-link",jt);const Nt=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Me=I("file-code-corner",Nt);const Ct=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],wt=I("gauge",Ct);const kt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Rt=I("lightbulb",kt);const Tt=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]],Mt=I("scale",Tt);const Et=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],zt=I("video",Et),Ee=o.createContext(void 0);function xe(){const t=o.useContext(Ee);if(t===void 0)throw new Error(we(64));return t}let $t=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const fe={tabActivationDirection:t=>({[$t.activationDirection]:t})},St=o.forwardRef(function(a,s){const{className:n,defaultValue:r=0,onValueChange:i,orientation:c="horizontal",render:u,value:h,style:b,...p}=a,y=a.defaultValue!==void 0,T=o.useRef([]),[E,d]=o.useState(()=>new Map),[l,R]=Ve({controlled:h,default:r,name:"Tabs",state:"value"}),S=h!==void 0,[f,C]=o.useState(()=>new Map),w=o.useCallback(m=>{if(m===void 0)return null;for(const[v,N]of f.entries())if(N!=null&&m===(N.value??N.index))return v;return null},[f]),[A,L]=o.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:k,tabActivationDirection:M}=A;let g=M,z=!1;k!==l&&(g=Ne(k,l,c,f),z=k!=null&&l!=null&&w(l)==null);const x=z?k:l,$=k!==x||M!==g;ne(()=>{$&&L({previousValue:x,tabActivationDirection:g})},[x,$,g]);const Q=F((m,v)=>{const N=Ne(l,m,c,f);v.activationDirection=N,i?.(m,v),!v.isCanceled&&R(m)}),Y=F((m,v)=>{i?.(m,de(v,void 0,void 0,{activationDirection:"none"}))}),_=F((m,v)=>{d(N=>{if(N.get(m)===v)return N;const D=new Map(N);return D.set(m,v),D})}),W=F((m,v)=>{d(N=>{if(!N.has(m)||N.get(m)!==v)return N;const D=new Map(N);return D.delete(m),D})}),Z=o.useCallback(m=>E.get(m),[E]),ee=o.useCallback(m=>{for(const v of f.values())if(m===v?.value)return v?.id},[f]),re=o.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:ee,getTabPanelIdByValue:Z,onValueChange:Q,orientation:c,registerMountedTabPanel:_,setTabMap:C,unregisterMountedTabPanel:W,tabActivationDirection:g,value:l}),[w,ee,Z,Q,c,_,C,W,g,l]),J=o.useMemo(()=>{for(const m of f.values())if(m!=null&&m.value===l)return m},[f,l]),le=o.useMemo(()=>{for(const m of f.values())if(m!=null&&!m.disabled)return m.value},[f]),j=o.useRef(!y),O=o.useRef(y),oe=o.useRef(!1);ne(()=>{if(S)return;function m(B,K){R(B),L(ce=>ce.previousValue===B&&ce.tabActivationDirection==="none"?ce:{previousValue:B,tabActivationDirection:"none"}),Y(B,K),j.current=!1}if(f.size===0){if(!oe.current||l===null)return;m(null,ge);return}oe.current=!0;const v=J?.disabled,N=J==null&&l!==null;if(!v&&l===r&&(O.current=!1),O.current&&v&&l===r)return;const D=j.current;if(v||N){const B=le??null;if(l===B){j.current=!1;return}let K=ge;D?K=pe:v&&(K=De),m(B,K);return}D&&J!=null&&(Y(l,pe),j.current=!1)},[r,le,S,Y,J,R,f,l]);const Le=me("div",a,{state:{orientation:c,tabActivationDirection:g},ref:s,props:p,stateAttributesMapping:fe});return e.jsx(Ee.Provider,{value:re,children:e.jsx(Ae,{elementsRef:T,children:Le})})});function Ne(t,a,s,n){if(t==null||a==null)return"none";let r=null,i=null;for(const[h,b]of n.entries()){if(b==null)continue;const p=b.value??b.index;if(t===p&&(r=h),a===p&&(i=h),r!=null&&i!=null)break}if(r==null||i==null)return r!==i&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof a?s==="horizontal"?a>t?"right":"left":a>t?"down":"up":"none";const c=r.getBoundingClientRect(),u=i.getBoundingClientRect();if(s==="horizontal"){if(u.left<c.left)return"left";if(u.left>c.left)return"right"}else{if(u.top<c.top)return"up";if(u.top>c.top)return"down"}return"none"}const ze=o.createContext(void 0);function Lt(){const t=o.useContext(ze);if(t===void 0)throw new Error(we(65));return t}const Vt=o.forwardRef(function(a,s){const{className:n,disabled:r=!1,render:i,value:c,id:u,nativeButton:h=!0,style:b,...p}=a,{value:y,getTabPanelIdByValue:T,orientation:E}=xe(),{activateOnFocus:d,highlightedTabIndex:l,onTabActivation:R,registerTabResizeObserverElement:S,setHighlightedTabIndex:f,tabsListElement:C}=Lt(),w=ke(u),A=o.useMemo(()=>({disabled:r,id:w,value:c}),[r,w,c]),{compositeProps:L,compositeRef:k,index:M}=Ie({metadata:A}),g=c===y,z=o.useRef(!1),x=o.useRef(null);o.useEffect(()=>{const j=x.current;if(j)return S(j)},[S]),ne(()=>{if(z.current){z.current=!1;return}if(!(g&&M>-1&&l!==M))return;const j=C;if(j!=null){const O=_e(ve(j));if(O&&Oe(j,O))return}r||f(M)},[g,M,l,f,r,C]);const{getButtonProps:$,buttonRef:Q}=Be({disabled:r,native:h,focusableWhenDisabled:!0}),Y=T(c),_=o.useRef(!1),W=o.useRef(!1);function Z(j){g||r||R(c,de(be,j.nativeEvent,void 0,{activationDirection:"none"}))}function ee(j){g||(M>-1&&!r&&f(M),!r&&d&&(!_.current||_.current&&W.current)&&R(c,de(be,j.nativeEvent,void 0,{activationDirection:"none"})))}function re(j){if(g||r)return;_.current=!0;function O(){_.current=!1,W.current=!1}(!j.button||j.button===0)&&(W.current=!0,ve(j.currentTarget).addEventListener("pointerup",O,{once:!0}))}return me("button",a,{state:{disabled:r,active:g,orientation:E},ref:[s,Q,k,x],props:[L,{role:"tab","aria-controls":Y,"aria-selected":g,id:w,onClick:Z,onFocus:ee,onPointerDown:re,[Pe]:g?"":void 0,onKeyDownCapture(){z.current=!0}},p,$]})});let At=(function(t){return t.index="data-index",t.activationDirection="data-activation-direction",t.orientation="data-orientation",t.hidden="data-hidden",t[t.startingStyle=je.startingStyle]="startingStyle",t[t.endingStyle=je.endingStyle]="endingStyle",t})({});const Dt={...fe,...qe},It=o.forwardRef(function(a,s){const{className:n,value:r,render:i,keepMounted:c=!1,style:u,...h}=a,{value:b,getTabIdByPanelValue:p,orientation:y,tabActivationDirection:T,registerMountedTabPanel:E,unregisterMountedTabPanel:d}=xe(),l=ke(),R=o.useMemo(()=>({id:l,value:r}),[l,r]),{ref:S,index:f}=Fe({metadata:R}),C=r===b,{mounted:w,transitionStatus:A,setMounted:L}=He(C),k=!w,M=p(r),g={hidden:k,orientation:y,tabActivationDirection:T,transitionStatus:A},z=o.useRef(null),x=me("div",a,{state:g,ref:[s,S,z],props:[{"aria-labelledby":M,hidden:k,id:l,role:"tabpanel",tabIndex:C?0:-1,inert:Ue(!C),[At.index]:f},h],stateAttributesMapping:Dt});return We({open:C,ref:z,onComplete(){C||L(!1)}}),ne(()=>{if(!(k&&!c)&&l!=null)return E(r,l),()=>{d(r,l)}},[k,c,r,l,E,d]),c||w?x:null}),_t=o.forwardRef(function(a,s){const{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:c,style:u,...h}=a,{onValueChange:b,orientation:p,value:y,setTabMap:T,tabActivationDirection:E}=xe(),[d,l]=o.useState(0),[R,S]=o.useState(null),f=o.useRef(new Set),C=o.useRef(new Set),w=o.useRef(null);o.useEffect(()=>{if(typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f.current.forEach($=>{$()})});return w.current=x,R&&x.observe(R),C.current.forEach($=>{x.observe($)}),()=>{x.disconnect(),w.current=null}},[R]);const A=F(x=>(f.current.add(x),()=>{f.current.delete(x)})),L=F(x=>(C.current.add(x),w.current?.observe(x),()=>{C.current.delete(x),w.current?.unobserve(x)})),k=F((x,$)=>{x!==y&&b(x,$)}),M={orientation:p,tabActivationDirection:E},g={"aria-orientation":p==="vertical"?"vertical":void 0,role:"tablist"},z=o.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:d,registerIndicatorUpdateListener:A,registerTabResizeObserverElement:L,onTabActivation:k,setHighlightedTabIndex:l,tabsListElement:R}),[n,d,A,L,k,l,R]);return e.jsx(ze.Provider,{value:z,children:e.jsx(Ye,{render:c,className:r,style:u,state:M,refs:[s,S],props:[g,h],stateAttributesMapping:fe,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:p,onHighlightedIndexChange:l,onMapChange:T,disabledIndices:Je})})});function $e({className:t,orientation:a="horizontal",...s}){return e.jsx(St,{"data-slot":"tabs","data-orientation":a,className:ie("group/tabs flex gap-2 data-horizontal:flex-col",t),...s})}const Ot=Ke("group/tabs-list inline-flex w-fit items-center justify-center rounded-2xl p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:p-1 data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Se({className:t,variant:a="default",...s}){return e.jsx(_t,{"data-slot":"tabs-list","data-variant":a,className:ie(Ot({variant:a}),t),...s})}function H({className:t,...a}){return e.jsx(Vt,{"data-slot":"tabs-trigger",className:ie("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent! px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-0.5 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...a})}function U({className:t,...a}){return e.jsx(It,{"data-slot":"tabs-content",className:ie("flex-1 text-sm outline-none",t),...a})}function P({title:t,children:a}){return e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-base font-semibold tracking-tight",children:t}),a]})}function q({items:t,empty:a}){return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a}):e.jsx("ul",{className:"space-y-2 text-sm leading-6",children:t.map(s=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:"mt-2 size-1.5 shrink-0 rounded-full bg-current"}),e.jsx("span",{children:s})]},s))})}function ae({references:t,onOpen:a}){return t.length===0?null:e.jsxs("fieldset",{className:"flex flex-wrap gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Repository references"}),t.map(s=>e.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-auto min-h-8 max-w-full justify-start gap-2 py-1.5 font-mono text-xs",onClick:()=>a(s),children:[e.jsx(Me,{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"truncate",children:[s.label??s.path,s.line===void 0?"":`:${s.line}`]})]},`${s.path}:${s.line??""}`))]})}function Bt({option:t,onOpen:a}){return e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsx(V,{variant:"secondary",children:"Option"}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.name}),e.jsx("p",{className:"max-w-3xl text-base leading-7 text-muted-foreground",children:t.summary}),e.jsx(ae,{references:t.references,onOpen:a})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 font-medium",children:[e.jsx(Xe,{className:"size-4 text-emerald-600 dark:text-emerald-400"})," Pros"]}),e.jsx(q,{items:t.pros,empty:"No advantages recorded."})]}),e.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 font-medium",children:[e.jsx(Ge,{className:"size-4 text-rose-600 dark:text-rose-400"})," Cons"]}),e.jsx(q,{items:t.cons,empty:"No disadvantages recorded."})]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(P,{title:"Risks",children:t.risks.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No risks recorded."}):e.jsx("div",{className:"space-y-3",children:t.risks.map(s=>e.jsxs("div",{className:"rounded-lg border bg-muted/20 p-4 text-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"font-medium",children:s.summary}),s.severity===void 0?null:e.jsx(V,{variant:"outline",className:"capitalize",children:s.severity})]}),s.mitigation===void 0?null:e.jsxs("p",{className:"mt-2 leading-6 text-muted-foreground",children:["Mitigation: ",s.mitigation]})]},s.summary))})}),e.jsx(P,{title:"Effort",children:e.jsx("p",{className:"rounded-lg border bg-muted/20 p-4 text-sm leading-6",children:t.effort??"No effort assessment recorded."})})]})]})}const Pt={poor:"border-rose-500/30 bg-rose-500/10",fair:"border-amber-500/30 bg-amber-500/10",good:"border-sky-500/30 bg-sky-500/10",strong:"border-emerald-500/30 bg-emerald-500/10"};function Ft({document:t}){return e.jsxs("div",{className:"mx-auto w-full max-w-7xl space-y-7 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(Mt,{className:"size-3.5"})," Comparison"]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:"Compare the options"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Assessments are explanatory signals, not code truth or review state."})]}),t.criteria.map(a=>e.jsxs("section",{className:"space-y-3 rounded-xl border bg-card p-4 sm:p-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold",children:a.label}),a.description===void 0?null:e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a.description})]}),e.jsx("div",{"data-testid":`decision-comparison-${a.id}`,className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:t.options.map(s=>{const n=t.assessments.find(r=>r.optionId===s.id&&r.criterionId===a.id);return e.jsxs("article",{className:`min-w-0 rounded-lg border p-4 ${n===void 0?"bg-muted/20":Pt[n.rating]}`,children:[e.jsx("h3",{className:"truncate text-sm font-semibold",children:s.name}),n===void 0?e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Not assessed"}):e.jsxs(e.Fragment,{children:[e.jsx(V,{variant:"outline",className:"mt-2 capitalize",children:n.rating}),e.jsx("p",{className:"mt-3 text-sm leading-6",children:n.note})]})]},s.id)})})]},a.id))]})}function Ht({document:t,repoPath:a}){const s=Re(i=>i.openTab),n=i=>{a!==void 0&&s(te("file",`${a}/${i.path}`,{title:ue(i.path),...i.line===void 0?{}:{line:i.line}},se()))},r=t.decision===void 0?"Recommendation":"Decision";return e.jsxs($e,{defaultValue:"summary",className:"flex h-full min-h-0 flex-col gap-0",children:[e.jsx("div",{className:"shrink-0 overflow-x-auto border-b px-3 py-2 sm:px-5",children:e.jsxs(Se,{variant:"line","aria-label":"Decision Canvas views",className:"w-max min-w-full justify-start",children:[e.jsx(H,{value:"summary",children:"Summary"}),t.options.map(i=>e.jsx(H,{value:`option-${i.id}`,children:i.name},i.id)),e.jsx(H,{value:"compare",children:"Compare"}),e.jsx(H,{value:"recommendation",children:r})]})}),e.jsx(U,{value:"summary",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-4",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(Rt,{className:"size-3.5"})," Decision / RFC"]}),e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:t.title}),e.jsx("p",{className:"max-w-3xl text-lg leading-8 text-muted-foreground",children:t.summary}),e.jsx(ae,{references:t.references,onOpen:n})]}),t.context===void 0?null:e.jsx(P,{title:"Context",children:e.jsx("p",{className:"max-w-3xl whitespace-pre-wrap text-sm leading-7",children:t.context})}),e.jsx(P,{title:"Options at a glance",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:t.options.map(i=>e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsx("h3",{className:"font-semibold",children:i.name}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.summary})]},i.id))})})]})}),t.options.map(i=>e.jsx(U,{value:`option-${i.id}`,className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Bt,{option:i,onOpen:n})},i.id)),e.jsx(U,{value:"compare",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Ft,{document:t})}),e.jsx(U,{value:"recommendation",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-8 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs(V,{variant:"secondary",className:"gap-1.5",children:[e.jsx(wt,{className:"size-3.5"})," ",r]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.recommendation.summary}),e.jsxs(V,{variant:"outline",className:"capitalize",children:[t.recommendation.confidence," confidence"]})]}),e.jsx(P,{title:"Rationale",children:e.jsx(q,{items:t.recommendation.rationale,empty:"No rationale recorded."})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(P,{title:"Assumptions",children:e.jsx(q,{items:t.recommendation.assumptions,empty:"No assumptions recorded."})}),e.jsx(P,{title:"What would change this",children:e.jsx(q,{items:t.recommendation.changeConditions,empty:"No change conditions recorded."})})]}),e.jsx(ae,{references:t.recommendation.references,onOpen:n}),t.decision===void 0?null:e.jsxs("section",{className:"space-y-4 rounded-xl border border-primary/30 bg-primary/5 p-5 sm:p-6",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[e.jsx(gt,{className:"size-5"})," Recorded final decision"]}),e.jsx("p",{className:"text-base leading-7",children:t.decision.summary}),e.jsx(q,{items:t.decision.rationale,empty:"No additional rationale recorded."}),e.jsx(ae,{references:t.decision.references,onOpen:n})]})]})})]})}function Ce(t,a){return t===null?null:`${t}/${a.split("/").map(encodeURIComponent).join("/")}`}function Ut({references:t,onOpen:a}){return t.length===0?null:e.jsxs("fieldset",{className:"flex flex-wrap gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Code references"}),t.map(s=>{const n=s.startLine===void 0?"":s.endLine===void 0||s.endLine===s.startLine?`:${s.startLine}`:`:${s.startLine}-${s.endLine}`;return e.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-auto min-h-8 max-w-full justify-start gap-2 py-1.5 font-mono text-xs",onClick:()=>a(s),children:[e.jsx(Me,{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"truncate",children:[s.label??s.path,n]})]},`${s.path}:${s.startLine??""}:${s.endLine??""}`)})]})}function Wt({section:t,onOpen:a,onComment:s}){return e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-6 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.title}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Comment on this section"}),e.jsx(Ut,{references:t.references,onOpen:a})]}),t.prose===""?null:e.jsx(Te,{content:t.prose,compact:!0,className:"overflow-visible"}),t.svg===void 0?null:e.jsx("div",{className:"overflow-hidden rounded-xl border bg-card",style:{height:t.htmlHeight??448},children:e.jsx(ye,{html:t.svg,title:`${t.title} diagram`})}),t.html===void 0?null:e.jsx("div",{className:"overflow-hidden rounded-xl border bg-card",style:{height:t.htmlHeight??448},children:e.jsx(ye,{html:t.html,title:`${t.title} visual`})})]})}function qt({asset:t,baseUrl:a}){if(t.kind==="link")return e.jsxs("a",{className:"flex items-center gap-3 rounded-xl border bg-card p-4 text-sm hover:bg-muted/40",href:t.href,target:"_blank",rel:"noreferrer",children:[e.jsx(yt,{className:"size-4 shrink-0"}),e.jsx("span",{className:"font-medium",children:t.label})]});const s=Ce(a,t.path);return s===null?e.jsxs("div",{className:"rounded-xl border bg-card p-4 text-sm",children:[e.jsx("p",{className:"font-medium",children:t.label}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Attachment is unavailable."})]}):t.kind==="image"?e.jsxs("figure",{className:"overflow-hidden rounded-xl border bg-card",children:[e.jsx("img",{src:s,alt:t.label,className:"max-h-[36rem] w-full object-contain"}),e.jsx("figcaption",{className:"border-t px-4 py-3 text-sm font-medium",children:t.label})]}):t.kind==="video"?e.jsxs("figure",{className:"overflow-hidden rounded-xl border bg-card",children:[e.jsxs("video",{className:"max-h-[36rem] w-full bg-black",controls:!0,preload:"metadata",children:[e.jsx("source",{src:s,type:t.mime}),t.captions===void 0?null:e.jsx("track",{kind:"captions",src:Ce(a,t.captions)??void 0,srcLang:"en",label:"Captions",default:!0}),"Your browser cannot play this video."]}),e.jsxs("figcaption",{className:"flex items-center gap-2 border-t px-4 py-3 text-sm font-medium",children:[e.jsx(zt,{className:"size-4 shrink-0"}),t.label]})]}):e.jsxs("a",{className:"flex items-center gap-3 rounded-xl border bg-card p-4 text-sm hover:bg-muted/40",href:s,target:"_blank",rel:"noreferrer",children:[e.jsx(ot,{className:"size-4 shrink-0"}),e.jsx("span",{className:"font-medium",children:t.label})]})}const Yt={pass:rt,fail:it,skip:bt};function Jt({document:t,assetBaseUrl:a}){const s=t.evidence;return s===void 0?null:e.jsxs("article",{className:"mx-auto w-full max-w-5xl space-y-7 p-5 sm:p-8",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx(V,{variant:"secondary",children:"Evidence"}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:s.title})]}),s.checks.length===0?null:e.jsx("section",{className:"grid gap-3 md:grid-cols-2",children:s.checks.map(n=>{const r=Yt[n.status];return e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"size-4 shrink-0"}),e.jsx("p",{className:"font-medium",children:n.label}),e.jsx(V,{variant:"outline",className:"ml-auto capitalize",children:n.status})]}),n.detail===void 0?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n.detail})]},n.label)})}),s.assets.length===0?null:e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Attachments"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:s.assets.map(n=>e.jsx(qt,{asset:n,baseUrl:a},n.kind==="link"?n.href:n.path))})]})]})}function Kt({canvasId:t}){const s=lt().filter(n=>n.anchor?.kind==="changeset"||n.anchor?.kind==="canvas"&&n.anchor.canvasId===t);return s.length===0?null:e.jsxs("section",{className:"mx-auto w-full max-w-5xl space-y-3 border-t p-5 sm:p-8",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Review comments"}),s.map(n=>e.jsxs("article",{className:"rounded-lg border bg-card p-3 text-sm",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n.anchor?.kind==="changeset"?"Whole changeset":n.anchor?.kind!=="canvas"||n.anchor.section===void 0?"Review Canvas":n.anchor.section}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap",children:n.body}),n.agentReply===void 0?null:e.jsxs("div",{className:"mt-3 border-l-2 border-border pl-3","data-testid":`canvas-comment-agent-${n.id}`,children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Agent"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-foreground",children:n.agentReply.body})]})]},n.id))]})}function Xt({document:t,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:r}){const i=Re(d=>d.openTab),{add:c}=Qe(),[u,h]=o.useState(null),[b,p]=o.useState(""),y=d=>{h(d),p("")},T=d=>{if(a===void 0)return;const l=d.startLine;if(r?.type==="working"||r?.type==="range"){i(te("diff",d.path,{title:ue(d.path),...r.type==="range"?{base:r.base}:{},...l===void 0?{}:{line:l}},se()));return}if(r?.type==="commit"){i(te("commit",r.hash,{title:r.hash.slice(0,12),reviewFilePath:d.path,...l===void 0?{}:{line:l}},se()));return}i(te("file",`${a}/${d.path}`,{title:ue(d.path),...l===void 0?{}:{line:l}},se()))};return e.jsxs(e.Fragment,{children:[e.jsxs($e,{defaultValue:"section-0",className:"flex h-full min-h-0 flex-col gap-0",children:[e.jsx("div",{className:"shrink-0 overflow-x-auto border-b px-3 py-2 sm:px-5",children:e.jsxs(Se,{variant:"line","aria-label":"Review Canvas sections",className:"w-max min-w-full justify-start",children:[t.sections.map((d,l)=>e.jsx(H,{value:`section-${l}`,children:d.title},d.title)),t.evidence===void 0?null:e.jsx(H,{value:"evidence",children:"Evidence"}),e.jsx(H,{value:"discussion",children:"Discussion"}),e.jsx(G,{type:"button",variant:"ghost",size:"sm",onClick:()=>y("changeset"),children:"Comment on change"})]})}),t.sections.map((d,l)=>e.jsxs(U,{value:`section-${l}`,className:"min-h-0 flex-1 overflow-y-auto",children:[l!==0||t.summary===void 0?null:e.jsx("p",{className:"mx-auto max-w-5xl px-5 pt-5 text-base leading-7 text-muted-foreground sm:px-8",children:t.summary}),e.jsx(Wt,{section:d,onOpen:T,onComment:()=>y(d.title)})]},d.title)),e.jsx(U,{value:"evidence",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Jt,{document:t,assetBaseUrl:s})}),e.jsx(U,{value:"discussion",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Kt,{canvasId:n??t.title})})]}),e.jsx(Ze,{open:u!==null,onOpenChange:d=>!d&&h(null),children:e.jsxs(et,{children:[e.jsx(tt,{children:e.jsx(st,{children:"Review comment"})}),e.jsx(at,{value:b,onChange:d=>p(d.target.value),placeholder:"What should the reviewer know?"}),e.jsx(nt,{children:e.jsx(G,{type:"button",onClick:()=>{u===null||b.trim()===""||c({body:b.trim(),anchor:u==="changeset"?{kind:"changeset"}:{kind:"canvas",canvasId:n??t.title,section:u}}).then(()=>h(null))},children:"Add comment"})})]})})]})}function Gt({content:t,repoPath:a,assetBaseUrl:s=null,canvasId:n,reviewTarget:r}){let i;try{i=JSON.parse(t)}catch(u){return e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",u instanceof Error?u.message:"invalid JSON"]})}const c=ct.safeParse(i);return c.success?c.data.template==="review"?e.jsx("div",{"data-testid":X.structuredCanvas,className:"h-full min-h-0",children:e.jsx(Xt,{document:c.data,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:r})}):e.jsx("div",{"data-testid":X.structuredCanvas,className:"h-full min-h-0",children:e.jsx(Ht,{document:c.data,repoPath:a})}):e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",dt(c.error)]})}function Qt(t){if(typeof t!="object"||t===null)return null;const a=t;return a.source!=="porcelain-canvas"?null:typeof a.href=="string"&&/^https?:\/\//i.test(a.href)?a.href:null}function he({projectId:t,canvasId:a,worktreePath:s,environmentId:n,revision:r}){const{mint:i}=mt(),u=xt(n??null)?.session.baseUrl()??ft(),[h,b]=o.useState(null),[p,y]=o.useState(null);return o.useEffect(()=>{let T=!1;b(null),y(null);const E={projectId:t,canvasId:a,...s===void 0?{}:{worktreePath:s},...n===void 0?{}:{environmentId:n}};return ht((async()=>{try{const d=await i(E);T||b(`${u}/canvas/${d}`)}catch(d){T||y(d instanceof Error&&d.message.length>0?d.message:"Could not open this Canvas.")}})(),"fallback"),()=>{T=!0}},[t,a,s,n,u,i,r]),{src:h,error:p}}function Zt({projectId:t,canvasId:a,title:s,worktreePath:n,environmentId:r,revision:i}){const{src:c,error:u}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i}),h=o.useRef(null);return o.useEffect(()=>{function b(p){if(p.source!==h.current?.contentWindow)return;const y=Qt(p.data);y!==null&&window.open(y,"_blank","noopener,noreferrer")}return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[]),u!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:u}):c===null?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("iframe",{ref:h,"data-testid":X.canvasIframe,title:s,src:c,sandbox:"allow-scripts",className:"h-full w-full flex-1 border-0 bg-background"})}function es({projectId:t,canvasId:a,content:s,worktreePath:n,environmentId:r,revision:i,reviewTarget:c}){const{src:u}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i});return e.jsx(Gt,{content:s,canvasId:a,repoPath:n,assetBaseUrl:u===null?null:`${u}/assets`,reviewTarget:c})}function is({projectId:t,canvasId:a,worktreePath:s,environmentId:n,reviewTarget:r}){const{canvas:i,isLoading:c,loadError:u}=ut(t,a,s??null,n??null);return u!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:u}):c||i===void 0?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):i.record.kind==="markdown"?e.jsx(ts,{projectId:t,canvasId:a,content:i.content,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`}):i.record.kind==="structured"?e.jsx(es,{projectId:t,canvasId:a,content:i.content,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`,reviewTarget:r}):e.jsx(Zt,{projectId:t,canvasId:a,title:i.record.title,worktreePath:s,environmentId:n,revision:`${i.record.updatedAt}\0${i.content}`})}function ts({projectId:t,canvasId:a,content:s,worktreePath:n,environmentId:r,revision:i}){const{src:c}=he({projectId:t,canvasId:a,worktreePath:n,environmentId:r,revision:i});return e.jsx(Te,{content:s,assetBaseUrl:c===null?null:`${c}/assets`})}export{is as CanvasView};
@@ -1 +1 @@
1
- import{U as J,V as Q,W as ee,r as h,X as G,h as se,j as e,Y as te,T as E,n as q,v as ne,x as ae,c as oe,u as re,N as le,e as ie,f as ce,g as de,i as he,D as pe,B as m,Z as xe,_ as ue,k as N,l as w,S as K,m as _,o as y,M as U,F as me,p as ge,C as fe,q as je,s as ve,t as D,w as be,y as Ce,z as ke,A as Ne,E as we,G as ye,H as Se,I as Te}from"./index-BG75F5tP.js";import{L as qe}from"./index-BG75F5tP.js";import{a as Fe}from"./line-selection-CDQurM1g.js";import{H as Re}from"./hunks-view-DW93fMKk.js";import{U as Le,F as Ee}from"./unfold-vertical-C146gwHO.js";import"./virtual-rows-BdkQ29uq.js";function X(s,o,t,l){const r=new Set(s[o]??[]);return l?r.add(t):r.delete(t),{...s,[o]:[...r]}}const V=J(s=>({collapsedByScope:{},toggle:(o,t)=>s(l=>{const r=!(l.collapsedByScope[o]??[]).includes(t);return{collapsedByScope:X(l.collapsedByScope,o,t,r)}}),collapse:(o,t)=>s(l=>({collapsedByScope:X(l.collapsedByScope,o,t,!0)})),clear:()=>s({collapsedByScope:{}})}));function Me(s,o){if(!s||s.path!==o||s.startLine===void 0)return;const t=new Set,l=s.endLine??s.startLine;for(let r=s.startLine;r<=l;r++)t.add(r);return t}function ze({file:s,collapseScope:o,reviewable:t,commentAnchor:l,onComment:r,onSelectFile:g,reviewScope:d}){const p=V(n=>(n.collapsedByScope[o]??[]).includes(s.path)),M=V(n=>n.toggle),f=V(n=>n.collapse),[x,c]=h.useState(null),j=G(n=>n.project),z=oe(n=>n.openTab),S=re(n=>n.setSidebarTab),T=le(n=>n.reveal),F=d?.type==="commit"?void 0:d,a=ie(F),{mark:R,unmark:v}=ce(F),W=de(s.path,d),i=a.has(s.path),u=s.status!=="deleted",B=h.useMemo(()=>Me(l,s.path),[l,s.path]),[L,A]=h.useState([]),O=h.useMemo(()=>he(s.hunks??[],{context:pe,revealed:L}),[s.hunks,L]),$=O.gaps.some(n=>n.expandable),P=$||L.length>0,Y=(n,b)=>{const C=b==="up"?we(n):b==="down"?ye(n):Se(n);A(k=>Te(k,C))},Z=()=>{if(!j||!u)return;const n=`${j.path}/${s.path}`;z(Ce("file",n,{title:Ne(s.path),preview:!0},ke())),S("files"),T(n)},H=()=>{if(i){v(s.path);return}R(s.path),f(o,s.path)};return e.jsxs("div",{"data-testid":E.changesetCard(s.path),"data-review-file-path":s.path,className:q(be,"flex flex-col"),onPointerEnter:()=>g(s.path),children:[e.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b px-3",children:[e.jsx(m,{variant:"ghost",size:"icon-2xs",className:"shrink-0 text-muted-foreground hover:text-foreground",onClick:()=>M(o,s.path),"aria-expanded":!p,"aria-label":p?"Expand diff":"Collapse diff","data-testid":E.diffCollapse(s.path),children:p?e.jsx(xe,{}):e.jsx(ue,{})}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs font-medium",children:s.path}),s.additions?e.jsxs("span",{className:"font-mono text-2xs text-success",children:["+",s.additions]}):null,s.deletions?e.jsxs("span",{className:"font-mono text-2xs text-destructive",children:["−",s.deletions]}):null,t&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:H,className:q("shrink-0",i?"text-success":"text-muted-foreground hover:text-foreground"),"aria-label":i?"Unmark reviewed":"Mark reviewed","data-testid":E.diffReviewed(s.path),children:i?e.jsx(K,{className:"size-3.5"}):e.jsx(_,{className:"size-3.5"})})}),e.jsx(y,{children:i?"Unmark reviewed":"Mark reviewed"})]}),e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>r({path:s.path,scope:d}),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Comment on file",children:e.jsx(U,{className:"size-3.5"})})}),e.jsx(y,{children:"Comment on file"})]}),u&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:Z,className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open file",children:e.jsx(me,{className:"size-3.5"})})}),e.jsx(y,{children:"Open file"})]}),$&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>A(ge()),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Expand all context",children:e.jsx(Le,{className:"size-3.5"})})}),e.jsx(y,{children:"Expand all context"})]}),L.length>0&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>A([]),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Collapse context",children:e.jsx(Ee,{className:"size-3.5"})})}),e.jsx(y,{children:"Collapse context"})]})]}),!p&&s.hunks&&s.hunks.length>0&&e.jsxs(fe,{onOpenChange:n=>{n||c(null)},children:[e.jsx(je,{className:"block select-text",onContextMenu:n=>{const b=Fe(s.path);if(b){c(b);return}const C=n.target.closest("[data-line]"),k=C?Number.parseInt(C.getAttribute("data-line")??"",10):Number.NaN,I=C?.getAttribute("data-side");c(Number.isFinite(k)?{startLine:k,endLine:k,text:"",...I==="old"||I==="new"?{side:I}:{}}:null)},children:e.jsx(Re,{hunks:P?O.hunks:s.hunks??[],gaps:P?O.gaps:void 0,onExpand:P?Y:void 0,filePath:s.path,diffMode:"unified",layout:"content",commentIndex:W,pendingLines:B})}),e.jsxs(ve,{className:"w-52",children:[x?e.jsxs(D,{onClick:()=>r({path:s.path,startLine:x.startLine,endLine:x.endLine,anchorText:x.text.slice(0,2e3),scope:d,side:x.side}),children:[e.jsx(U,{})," Add comment"]}):e.jsxs(D,{onClick:()=>r({path:s.path,scope:d}),children:[e.jsx(U,{})," Comment on file"]}),t&&e.jsxs(D,{onClick:H,children:[i?e.jsx(_,{}):e.jsx(K,{}),i?"Unmark reviewed":"Mark reviewed"]})]})]})]})}function Ue({path:s,paneIndex:o=0}){const t=Q(s),{reading:l,error:r}=ee(t),[g,d]=h.useState(null),p=h.useRef(null),M=G(a=>a.project?.path??""),f=se(a=>a.setPath),x=`${M}\0${s}`,c=l?.groups.flatMap(a=>a.files)??[],j=c.map(a=>a.path).join("\0"),[z,S]=h.useState(null),T=z??c[0]?.path??null;if(h.useEffect(()=>(f(o,T),()=>f(o,null)),[o,f,T]),h.useEffect(()=>{const a=p.current;if(a===null||j===""||typeof IntersectionObserver>"u")return;const R=new IntersectionObserver(v=>{const i=v.filter(u=>u.isIntersecting).sort((u,B)=>u.boundingClientRect.top-B.boundingClientRect.top)[0]?.target.getAttribute("data-review-file-path");i!=null&&S(i)},{root:a,threshold:.5});for(const v of a.querySelectorAll("[data-review-file-path]"))R.observe(v);return()=>R.disconnect()},[j]),r)return e.jsx("p",{className:"p-4 text-sm text-destructive",children:r.message});if(l===void 0)return e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});if(c.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.type==="commit"?"Empty commit":"No changes to review"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.type==="commit"?"This commit doesn’t touch any files.":"Nothing to walk through in this range yet."})]})});const F=t.type==="working"?"Working tree":t.type==="branch"?"Branch range":`Commit ${t.hash.slice(0,7)}`;return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2 text-2xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"All changes"}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{children:F}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsxs("span",{className:"tabular-nums",children:[c.length," file",c.length===1?"":"s"]}),e.jsx(te,{className:"ml-auto",scope:t.type==="working"?{type:"working"}:t.type==="branch"?{type:"range",...t.base===void 0?{}:{base:t.base}}:{type:"commit",hash:t.hash}})]}),e.jsx("div",{ref:p,"data-testid":E.codeWell,className:q(ne,"overflow-auto"),children:e.jsx("div",{className:"flex flex-col gap-3",children:c.map(a=>e.jsx(ze,{file:a,collapseScope:x,reviewable:t.type!=="commit",reviewScope:t.type==="commit"?{type:"commit",hash:t.hash}:t.type==="working"?{type:"working"}:t.base===void 0?void 0:{type:"branch",base:t.base},commentAnchor:g,onComment:d,onSelectFile:S},a.path))})}),e.jsx(ae,{anchor:g,open:g!==null,onOpenChange:a=>{a||d(null)}})]})}export{Ue as ChangesetView,qe as changesetTabKey,Q as parseChangesetTabKey};
1
+ import{U as J,V as Q,W as ee,r as h,X as G,h as se,j as e,Y as te,T as E,n as q,v as ne,x as ae,c as oe,u as re,N as le,e as ie,f as ce,g as de,i as he,D as pe,B as m,Z as xe,_ as ue,k as N,l as w,S as K,m as _,o as y,M as U,F as me,p as ge,C as fe,q as je,s as ve,t as D,w as be,y as Ce,z as ke,A as Ne,E as we,G as ye,H as Se,I as Te}from"./index-CuWbxCsX.js";import{L as qe}from"./index-CuWbxCsX.js";import{a as Fe}from"./line-selection-CDQurM1g.js";import{H as Re}from"./hunks-view-CXQMQon9.js";import{U as Le,F as Ee}from"./unfold-vertical-CIpACs4g.js";import"./virtual-rows-CsZNdhfp.js";function X(s,o,t,l){const r=new Set(s[o]??[]);return l?r.add(t):r.delete(t),{...s,[o]:[...r]}}const V=J(s=>({collapsedByScope:{},toggle:(o,t)=>s(l=>{const r=!(l.collapsedByScope[o]??[]).includes(t);return{collapsedByScope:X(l.collapsedByScope,o,t,r)}}),collapse:(o,t)=>s(l=>({collapsedByScope:X(l.collapsedByScope,o,t,!0)})),clear:()=>s({collapsedByScope:{}})}));function Me(s,o){if(!s||s.path!==o||s.startLine===void 0)return;const t=new Set,l=s.endLine??s.startLine;for(let r=s.startLine;r<=l;r++)t.add(r);return t}function ze({file:s,collapseScope:o,reviewable:t,commentAnchor:l,onComment:r,onSelectFile:g,reviewScope:d}){const p=V(n=>(n.collapsedByScope[o]??[]).includes(s.path)),M=V(n=>n.toggle),f=V(n=>n.collapse),[x,c]=h.useState(null),j=G(n=>n.project),z=oe(n=>n.openTab),S=re(n=>n.setSidebarTab),T=le(n=>n.reveal),F=d?.type==="commit"?void 0:d,a=ie(F),{mark:R,unmark:v}=ce(F),W=de(s.path,d),i=a.has(s.path),u=s.status!=="deleted",B=h.useMemo(()=>Me(l,s.path),[l,s.path]),[L,A]=h.useState([]),O=h.useMemo(()=>he(s.hunks??[],{context:pe,revealed:L}),[s.hunks,L]),$=O.gaps.some(n=>n.expandable),P=$||L.length>0,Y=(n,b)=>{const C=b==="up"?we(n):b==="down"?ye(n):Se(n);A(k=>Te(k,C))},Z=()=>{if(!j||!u)return;const n=`${j.path}/${s.path}`;z(Ce("file",n,{title:Ne(s.path),preview:!0},ke())),S("files"),T(n)},H=()=>{if(i){v(s.path);return}R(s.path),f(o,s.path)};return e.jsxs("div",{"data-testid":E.changesetCard(s.path),"data-review-file-path":s.path,className:q(be,"flex flex-col"),onPointerEnter:()=>g(s.path),children:[e.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b px-3",children:[e.jsx(m,{variant:"ghost",size:"icon-2xs",className:"shrink-0 text-muted-foreground hover:text-foreground",onClick:()=>M(o,s.path),"aria-expanded":!p,"aria-label":p?"Expand diff":"Collapse diff","data-testid":E.diffCollapse(s.path),children:p?e.jsx(xe,{}):e.jsx(ue,{})}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs font-medium",children:s.path}),s.additions?e.jsxs("span",{className:"font-mono text-2xs text-success",children:["+",s.additions]}):null,s.deletions?e.jsxs("span",{className:"font-mono text-2xs text-destructive",children:["−",s.deletions]}):null,t&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:H,className:q("shrink-0",i?"text-success":"text-muted-foreground hover:text-foreground"),"aria-label":i?"Unmark reviewed":"Mark reviewed","data-testid":E.diffReviewed(s.path),children:i?e.jsx(K,{className:"size-3.5"}):e.jsx(_,{className:"size-3.5"})})}),e.jsx(y,{children:i?"Unmark reviewed":"Mark reviewed"})]}),e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>r({path:s.path,scope:d}),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Comment on file",children:e.jsx(U,{className:"size-3.5"})})}),e.jsx(y,{children:"Comment on file"})]}),u&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:Z,className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open file",children:e.jsx(me,{className:"size-3.5"})})}),e.jsx(y,{children:"Open file"})]}),$&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>A(ge()),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Expand all context",children:e.jsx(Le,{className:"size-3.5"})})}),e.jsx(y,{children:"Expand all context"})]}),L.length>0&&e.jsxs(N,{children:[e.jsx(w,{render:e.jsx(m,{variant:"ghost",size:"icon-2xs",onClick:()=>A([]),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Collapse context",children:e.jsx(Ee,{className:"size-3.5"})})}),e.jsx(y,{children:"Collapse context"})]})]}),!p&&s.hunks&&s.hunks.length>0&&e.jsxs(fe,{onOpenChange:n=>{n||c(null)},children:[e.jsx(je,{className:"block select-text",onContextMenu:n=>{const b=Fe(s.path);if(b){c(b);return}const C=n.target.closest("[data-line]"),k=C?Number.parseInt(C.getAttribute("data-line")??"",10):Number.NaN,I=C?.getAttribute("data-side");c(Number.isFinite(k)?{startLine:k,endLine:k,text:"",...I==="old"||I==="new"?{side:I}:{}}:null)},children:e.jsx(Re,{hunks:P?O.hunks:s.hunks??[],gaps:P?O.gaps:void 0,onExpand:P?Y:void 0,filePath:s.path,diffMode:"unified",layout:"content",commentIndex:W,pendingLines:B})}),e.jsxs(ve,{className:"w-52",children:[x?e.jsxs(D,{onClick:()=>r({path:s.path,startLine:x.startLine,endLine:x.endLine,anchorText:x.text.slice(0,2e3),scope:d,side:x.side}),children:[e.jsx(U,{})," Add comment"]}):e.jsxs(D,{onClick:()=>r({path:s.path,scope:d}),children:[e.jsx(U,{})," Comment on file"]}),t&&e.jsxs(D,{onClick:H,children:[i?e.jsx(_,{}):e.jsx(K,{}),i?"Unmark reviewed":"Mark reviewed"]})]})]})]})}function Ue({path:s,paneIndex:o=0}){const t=Q(s),{reading:l,error:r}=ee(t),[g,d]=h.useState(null),p=h.useRef(null),M=G(a=>a.project?.path??""),f=se(a=>a.setPath),x=`${M}\0${s}`,c=l?.groups.flatMap(a=>a.files)??[],j=c.map(a=>a.path).join("\0"),[z,S]=h.useState(null),T=z??c[0]?.path??null;if(h.useEffect(()=>(f(o,T),()=>f(o,null)),[o,f,T]),h.useEffect(()=>{const a=p.current;if(a===null||j===""||typeof IntersectionObserver>"u")return;const R=new IntersectionObserver(v=>{const i=v.filter(u=>u.isIntersecting).sort((u,B)=>u.boundingClientRect.top-B.boundingClientRect.top)[0]?.target.getAttribute("data-review-file-path");i!=null&&S(i)},{root:a,threshold:.5});for(const v of a.querySelectorAll("[data-review-file-path]"))R.observe(v);return()=>R.disconnect()},[j]),r)return e.jsx("p",{className:"p-4 text-sm text-destructive",children:r.message});if(l===void 0)return e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});if(c.length===0)return e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.type==="commit"?"Empty commit":"No changes to review"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.type==="commit"?"This commit doesn’t touch any files.":"Nothing to walk through in this range yet."})]})});const F=t.type==="working"?"Working tree":t.type==="branch"?"Branch range":`Commit ${t.hash.slice(0,7)}`;return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2 text-2xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"All changes"}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{children:F}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsxs("span",{className:"tabular-nums",children:[c.length," file",c.length===1?"":"s"]}),e.jsx(te,{className:"ml-auto",scope:t.type==="working"?{type:"working"}:t.type==="branch"?{type:"range",...t.base===void 0?{}:{base:t.base}}:{type:"commit",hash:t.hash}})]}),e.jsx("div",{ref:p,"data-testid":E.codeWell,className:q(ne,"overflow-auto"),children:e.jsx("div",{className:"flex flex-col gap-3",children:c.map(a=>e.jsx(ze,{file:a,collapseScope:x,reviewable:t.type!=="commit",reviewScope:t.type==="commit"?{type:"commit",hash:t.hash}:t.type==="working"?{type:"working"}:t.base===void 0?void 0:{type:"branch",base:t.base},commentAnchor:g,onComment:d,onSelectFile:S},a.path))})}),e.jsx(ae,{anchor:g,open:g!==null,onOpenChange:a=>{a||d(null)}})]})}export{Ue as ChangesetView,qe as changesetTabKey,Q as parseChangesetTabKey};
@@ -1,2 +1,2 @@
1
- import{r as j,J as E,K as L,b as V,c as y,h as $,j as e,T as h,k as C,l as v,B as N,R as z,o as w,n as f,w as T,F as S,v as H,L as q,y as g,z as b,u as F,N as B,A as M,C as O,q as R,s as K,t as k,M as W,x as J,O as G}from"./index-BG75F5tP.js";import{D as I}from"./diff-mode-toggle-D41-9y4s.js";import{H as Q}from"./hunks-view-DW93fMKk.js";import"./virtual-rows-BdkQ29uq.js";function U({file:n,repoPath:a,selected:l,onSelect:i}){const c=y(s=>s.openTab),o=F(s=>s.setSidebarTab),p=B(s=>s.reveal),d=M(n.path),[m,x]=j.useState(null),r=()=>{const s=`${a}/${n.path}`;c(g("file",s,{title:d},b())),o("files"),p(s)};return e.jsxs(O,{children:[e.jsx(R,{render:e.jsx("button",{type:"button",onClick:()=>i(n.path),className:f("block w-full truncate px-3 py-1 text-left font-mono text-xs",l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50")}),children:d}),e.jsxs(K,{children:[e.jsxs(k,{onClick:()=>x({path:n.path}),children:[e.jsx(W,{}),"Comment on file"]}),n.status!=="deleted"&&e.jsxs(k,{onClick:r,children:[e.jsx(S,{}),"Open file"]})]}),e.jsx(J,{anchor:m,open:m!==null,onOpenChange:s=>{s||x(null)}})]})}function X({hash:n,filePath:a}){const l=F(o=>o.diffMode),{hunks:i,error:c}=G(n,a);return c?e.jsx("p",{className:"p-4 text-sm text-destructive",children:c.message}):i===void 0?e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("div",{className:"flex h-full flex-col",children:e.jsx(O,{children:e.jsx(R,{className:"block min-h-0 flex-1 select-text",children:e.jsx(Q,{hunks:i,filePath:a,diffMode:l})})})})}function se({hash:n,filePath:a,paneIndex:l=0}){const[i,c]=j.useState(null),{groups:o}=E(n),p=L(n),d=V(),m=y(t=>t.openTab),x=$(t=>t.setPath),r=o?.flatMap(t=>t.files)??[],s=i??(r.some(t=>t.path===a)?a:void 0)??r[0]?.path??null,A=r.find(t=>t.path===s)?.status;if(j.useEffect(()=>(x(l,s),()=>x(l,null)),[l,s,x]),d===null||o===void 0)return e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});const P=()=>{if(!s)return;const t=`${d}/${s}`;m(g("file",t,{title:M(s),preview:!0},b()))},D=()=>{const t=q({type:"commit",hash:n}),u=(p??n.slice(0,12)).split(`
1
+ import{r as j,J as E,K as L,b as V,c as y,h as $,j as e,T as h,k as C,l as v,B as N,R as z,o as w,n as f,w as T,F as S,v as H,L as q,y as g,z as b,u as F,N as B,A as M,C as O,q as R,s as K,t as k,M as W,x as J,O as G}from"./index-CuWbxCsX.js";import{D as I}from"./diff-mode-toggle-DTeqhuLC.js";import{H as Q}from"./hunks-view-CXQMQon9.js";import"./virtual-rows-CsZNdhfp.js";function U({file:n,repoPath:a,selected:l,onSelect:i}){const c=y(s=>s.openTab),o=F(s=>s.setSidebarTab),p=B(s=>s.reveal),d=M(n.path),[m,x]=j.useState(null),r=()=>{const s=`${a}/${n.path}`;c(g("file",s,{title:d},b())),o("files"),p(s)};return e.jsxs(O,{children:[e.jsx(R,{render:e.jsx("button",{type:"button",onClick:()=>i(n.path),className:f("block w-full truncate px-3 py-1 text-left font-mono text-xs",l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50")}),children:d}),e.jsxs(K,{children:[e.jsxs(k,{onClick:()=>x({path:n.path}),children:[e.jsx(W,{}),"Comment on file"]}),n.status!=="deleted"&&e.jsxs(k,{onClick:r,children:[e.jsx(S,{}),"Open file"]})]}),e.jsx(J,{anchor:m,open:m!==null,onOpenChange:s=>{s||x(null)}})]})}function X({hash:n,filePath:a}){const l=F(o=>o.diffMode),{hunks:i,error:c}=G(n,a);return c?e.jsx("p",{className:"p-4 text-sm text-destructive",children:c.message}):i===void 0?e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("div",{className:"flex h-full flex-col",children:e.jsx(O,{children:e.jsx(R,{className:"block min-h-0 flex-1 select-text",children:e.jsx(Q,{hunks:i,filePath:a,diffMode:l})})})})}function se({hash:n,filePath:a,paneIndex:l=0}){const[i,c]=j.useState(null),{groups:o}=E(n),p=L(n),d=V(),m=y(t=>t.openTab),x=$(t=>t.setPath),r=o?.flatMap(t=>t.files)??[],s=i??(r.some(t=>t.path===a)?a:void 0)??r[0]?.path??null,A=r.find(t=>t.path===s)?.status;if(j.useEffect(()=>(x(l,s),()=>x(l,null)),[l,s,x]),d===null||o===void 0)return e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});const P=()=>{if(!s)return;const t=`${d}/${s}`;m(g("file",t,{title:M(s),preview:!0},b()))},D=()=>{const t=q({type:"commit",hash:n}),u=(p??n.slice(0,12)).split(`
2
2
  `)[0]?.trim()||n.slice(0,12);m(g("changeset",t,{title:u},b()))};return e.jsxs("div",{"data-testid":h.codeWell,className:f(H,"flex gap-3"),children:[e.jsxs("div",{"data-testid":h.commitListCard,className:f(T,"flex w-64 shrink-0 flex-col overflow-y-auto"),children:[e.jsxs("div",{className:"border-b px-3 py-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words text-sm-minus text-foreground",children:p??"…"}),r.length>0&&e.jsxs(C,{children:[e.jsx(v,{render:e.jsx(N,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground",onClick:D,"aria-label":"All changes",children:e.jsx(z,{})})}),e.jsx(w,{children:"All changes"})]})]}),e.jsx("p",{className:"mt-1 font-mono text-xs-minus text-muted-foreground",children:n.slice(0,12)})]}),o.map(t=>e.jsxs("div",{children:[e.jsx("p",{className:"flex h-6 items-center px-3 text-2xs font-bold uppercase tracking-[0.08em] text-muted-foreground",children:t.layer}),t.files.map(u=>e.jsx(U,{file:u,repoPath:d,selected:u.path===s,onSelect:c},u.path))]},t.layer)),r.length===0&&e.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No files changed"})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex-1",children:e.jsxs("div",{"data-testid":h.codeCard,className:f(T,"flex h-full min-h-0 flex-col"),children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b px-3 py-1",children:[e.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&A!=="deleted"&&e.jsxs(C,{children:[e.jsx(v,{render:e.jsx(N,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground",onClick:P,"aria-label":"Open file",children:e.jsx(S,{})})}),e.jsx(w,{children:"Open file"})]}),e.jsx(I,{})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:s?e.jsx(X,{hash:n,filePath:s}):e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Empty commit"})})]})})]})}export{se as CommitView};