@fabiofiorita/porcelain 0.63.0 → 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/main/daemon/server.js +22 -3
- package/package.json +1 -1
- package/renderer/assets/{browser-AwtRrWrw.js → browser-DCOMFJnY.js} +1 -1
- package/renderer/assets/{canvas-view-CKpskfX3.js → canvas-view-CUlkViu8.js} +1 -1
- package/renderer/assets/{changeset-view-DjzEENSv.js → changeset-view-ZsUdMIp6.js} +1 -1
- package/renderer/assets/{commit-view-CJkfvhlK.js → commit-view-V8xwXKLG.js} +1 -1
- package/renderer/assets/{diff-mode-toggle-BqSmXXnV.js → diff-mode-toggle-CXE1Skh5.js} +1 -1
- package/renderer/assets/{diff-view-DKZvicFe.js → diff-view-Dl2p6z-q.js} +1 -1
- package/renderer/assets/{file-content-Bf5p-6q5.js → file-content-DJJjf8Yp.js} +1 -1
- package/renderer/assets/{html-view-CmZBBeH6.js → html-view-Do0NJIhn.js} +1 -1
- package/renderer/assets/{hunks-view-CAJ8e6MK.js → hunks-view-DbHtk643.js} +1 -1
- package/renderer/assets/{index-CP7fIj7H.js → index-BydNjdTq.js} +5 -5
- package/renderer/assets/{search-view-C6YNmxjb.js → search-view-DR2FA1F1.js} +1 -1
- package/renderer/assets/{surface-CbowZ3N8.js → surface-BXI3sKKH.js} +1 -1
- package/renderer/assets/{unfold-vertical-Bu-duMXm.js → unfold-vertical-D7QLv5cD.js} +1 -1
- package/renderer/assets/{virtual-rows-A5iZeaqW.js → virtual-rows-D1EsaG9G.js} +1 -1
- package/renderer/index.html +1 -1
package/README.md
CHANGED
package/main/daemon/server.js
CHANGED
|
@@ -1024,7 +1024,20 @@ var import_zod8 = require("zod");
|
|
|
1024
1024
|
|
|
1025
1025
|
// ../../packages/contracts/src/worktree-profile.ts
|
|
1026
1026
|
var import_zod7 = require("zod");
|
|
1027
|
-
var profileLayerSchema = import_zod7.z.object({
|
|
1027
|
+
var profileLayerSchema = import_zod7.z.object({
|
|
1028
|
+
label: import_zod7.z.string().min(1),
|
|
1029
|
+
pattern: import_zod7.z.string().min(1).refine(
|
|
1030
|
+
(pattern) => {
|
|
1031
|
+
try {
|
|
1032
|
+
new RegExp(pattern);
|
|
1033
|
+
return true;
|
|
1034
|
+
} catch {
|
|
1035
|
+
return false;
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
{ message: "Layer pattern must be a valid JavaScript regular expression." }
|
|
1039
|
+
)
|
|
1040
|
+
}).strict();
|
|
1028
1041
|
var worktreeProfileSchema = import_zod7.z.object({
|
|
1029
1042
|
layers: import_zod7.z.array(profileLayerSchema).nullable().default(null)
|
|
1030
1043
|
}).strict();
|
|
@@ -14619,7 +14632,7 @@ function daemonIdentity(host = process.env.PORCELAIN_DAEMON_HOST?.trim() || (0,
|
|
|
14619
14632
|
|
|
14620
14633
|
// ../daemon/src/net/daemon-version.ts
|
|
14621
14634
|
function daemonVersion() {
|
|
14622
|
-
return "0.63.
|
|
14635
|
+
return "0.63.1";
|
|
14623
14636
|
}
|
|
14624
14637
|
|
|
14625
14638
|
// ../daemon/src/daemon-composition/daemon-operations.ts
|
|
@@ -15822,7 +15835,13 @@ var CANVAS_FILE = {
|
|
|
15822
15835
|
};
|
|
15823
15836
|
var PROFILE_LAYER = {
|
|
15824
15837
|
type: "object",
|
|
15825
|
-
properties: {
|
|
15838
|
+
properties: {
|
|
15839
|
+
label: { type: "string" },
|
|
15840
|
+
pattern: {
|
|
15841
|
+
type: "string",
|
|
15842
|
+
description: "JavaScript regular-expression source matched against repository-relative paths. This is not glob syntax: use .* instead of **."
|
|
15843
|
+
}
|
|
15844
|
+
},
|
|
15826
15845
|
required: ["label", "pattern"],
|
|
15827
15846
|
additionalProperties: false
|
|
15828
15847
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabiofiorita/porcelain",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.1",
|
|
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-
|
|
1
|
+
import{bm as re}from"./index-BydNjdTq.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 A,r as o,aE as Ce,aF as $e,aG as ne,aH as F,aI as de,aJ as he,aK as pe,aL as me,j as e,aM as De,aN as Ie,aO as we,aP as Ae,aQ as _e,aR as ge,aS as Oe,aT as Be,aU as Pe,aV as ve,aW as be,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 ke,aj as $,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-CP7fIj7H.js";import{M as Re,b as je}from"./html-view-CmZBBeH6.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=A("circle-alert",pt);const vt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],bt=A("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=A("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"}]],Te=A("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=A("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=A("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=A("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=A("video",Et),Me=o.createContext(void 0);function xe(){const t=o.useContext(Me);if(t===void 0)throw new Error(Ce(64));return t}let St=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const fe={tabActivationDirection:t=>({[St.activationDirection]:t})},Lt=o.forwardRef(function(a,s){const{className:n,defaultValue:i=0,onValueChange:r,orientation:c="horizontal",render:m,value:h,style:j,...p}=a,C=a.defaultValue!==void 0,E=o.useRef([]),[y,d]=o.useState(()=>new Map),[l,T]=$e({controlled:h,default:i,name:"Tabs",state:"value"}),L=h!==void 0,[f,w]=o.useState(()=>new Map),k=o.useCallback(u=>{if(u===void 0)return null;for(const[v,N]of f.entries())if(N!=null&&u===(N.value??N.index))return v;return null},[f]),[D,V]=o.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:R,tabActivationDirection:M}=D;let g=M,z=!1;R!==l&&(g=ye(R,l,c,f),z=R!=null&&l!=null&&k(l)==null);const x=z?R:l,S=R!==x||M!==g;ne(()=>{S&&V({previousValue:x,tabActivationDirection:g})},[x,S,g]);const Q=F((u,v)=>{const N=ye(l,u,c,f);v.activationDirection=N,r?.(u,v),!v.isCanceled&&T(u)}),Y=F((u,v)=>{r?.(u,de(v,void 0,void 0,{activationDirection:"none"}))}),_=F((u,v)=>{d(N=>{if(N.get(u)===v)return N;const I=new Map(N);return I.set(u,v),I})}),W=F((u,v)=>{d(N=>{if(!N.has(u)||N.get(u)!==v)return N;const I=new Map(N);return I.delete(u),I})}),Z=o.useCallback(u=>y.get(u),[y]),ee=o.useCallback(u=>{for(const v of f.values())if(u===v?.value)return v?.id},[f]),re=o.useMemo(()=>({getTabElementBySelectedValue:k,getTabIdByPanelValue:ee,getTabPanelIdByValue:Z,onValueChange:Q,orientation:c,registerMountedTabPanel:_,setTabMap:w,unregisterMountedTabPanel:W,tabActivationDirection:g,value:l}),[k,ee,Z,Q,c,_,w,W,g,l]),J=o.useMemo(()=>{for(const u of f.values())if(u!=null&&u.value===l)return u},[f,l]),le=o.useMemo(()=>{for(const u of f.values())if(u!=null&&!u.disabled)return u.value},[f]),b=o.useRef(!C),O=o.useRef(C),oe=o.useRef(!1);ne(()=>{if(L)return;function u(B,K){T(B),V(ce=>ce.previousValue===B&&ce.tabActivationDirection==="none"?ce:{previousValue:B,tabActivationDirection:"none"}),Y(B,K),b.current=!1}if(f.size===0){if(!oe.current||l===null)return;u(null,pe);return}oe.current=!0;const v=J?.disabled,N=J==null&&l!==null;if(!v&&l===i&&(O.current=!1),O.current&&v&&l===i)return;const I=b.current;if(v||N){const B=le??null;if(l===B){b.current=!1;return}let K=pe;I?K=he:v&&(K=Ie),u(B,K);return}I&&J!=null&&(Y(l,he),b.current=!1)},[i,le,L,Y,J,T,f,l]);const Ve=me("div",a,{state:{orientation:c,tabActivationDirection:g},ref:s,props:p,stateAttributesMapping:fe});return e.jsx(Me.Provider,{value:re,children:e.jsx(De,{elementsRef:E,children:Ve})})});function ye(t,a,s,n){if(t==null||a==null)return"none";let i=null,r=null;for(const[h,j]of n.entries()){if(j==null)continue;const p=j.value??j.index;if(t===p&&(i=h),a===p&&(r=h),i!=null&&r!=null)break}if(i==null||r==null)return i!==r&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof a?s==="horizontal"?a>t?"right":"left":a>t?"down":"up":"none";const c=i.getBoundingClientRect(),m=r.getBoundingClientRect();if(s==="horizontal"){if(m.left<c.left)return"left";if(m.left>c.left)return"right"}else{if(m.top<c.top)return"up";if(m.top>c.top)return"down"}return"none"}const Ee=o.createContext(void 0);function Vt(){const t=o.useContext(Ee);if(t===void 0)throw new Error(Ce(65));return t}const $t=o.forwardRef(function(a,s){const{className:n,disabled:i=!1,render:r,value:c,id:m,nativeButton:h=!0,style:j,...p}=a,{value:C,getTabPanelIdByValue:E,orientation:y}=xe(),{activateOnFocus:d,highlightedTabIndex:l,onTabActivation:T,registerTabResizeObserverElement:L,setHighlightedTabIndex:f,tabsListElement:w}=Vt(),k=we(m),D=o.useMemo(()=>({disabled:i,id:k,value:c}),[i,k,c]),{compositeProps:V,compositeRef:R,index:M}=Ae({metadata:D}),g=c===C,z=o.useRef(!1),x=o.useRef(null);o.useEffect(()=>{const b=x.current;if(b)return L(b)},[L]),ne(()=>{if(z.current){z.current=!1;return}if(!(g&&M>-1&&l!==M))return;const b=w;if(b!=null){const O=_e(ge(b));if(O&&Oe(b,O))return}i||f(M)},[g,M,l,f,i,w]);const{getButtonProps:S,buttonRef:Q}=Be({disabled:i,native:h,focusableWhenDisabled:!0}),Y=E(c),_=o.useRef(!1),W=o.useRef(!1);function Z(b){g||i||T(c,de(ve,b.nativeEvent,void 0,{activationDirection:"none"}))}function ee(b){g||(M>-1&&!i&&f(M),!i&&d&&(!_.current||_.current&&W.current)&&T(c,de(ve,b.nativeEvent,void 0,{activationDirection:"none"})))}function re(b){if(g||i)return;_.current=!0;function O(){_.current=!1,W.current=!1}(!b.button||b.button===0)&&(W.current=!0,ge(b.currentTarget).addEventListener("pointerup",O,{once:!0}))}return me("button",a,{state:{disabled:i,active:g,orientation:y},ref:[s,Q,R,x],props:[V,{role:"tab","aria-controls":Y,"aria-selected":g,id:k,onClick:Z,onFocus:ee,onPointerDown:re,[Pe]:g?"":void 0,onKeyDownCapture(){z.current=!0}},p,S]})});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=be.startingStyle]="startingStyle",t[t.endingStyle=be.endingStyle]="endingStyle",t})({});const It={...fe,...qe},At=o.forwardRef(function(a,s){const{className:n,value:i,render:r,keepMounted:c=!1,style:m,...h}=a,{value:j,getTabIdByPanelValue:p,orientation:C,tabActivationDirection:E,registerMountedTabPanel:y,unregisterMountedTabPanel:d}=xe(),l=we(),T=o.useMemo(()=>({id:l,value:i}),[l,i]),{ref:L,index:f}=Fe({metadata:T}),w=i===j,{mounted:k,transitionStatus:D,setMounted:V}=He(w),R=!k,M=p(i),g={hidden:R,orientation:C,tabActivationDirection:E,transitionStatus:D},z=o.useRef(null),x=me("div",a,{state:g,ref:[s,L,z],props:[{"aria-labelledby":M,hidden:R,id:l,role:"tabpanel",tabIndex:w?0:-1,inert:Ue(!w),[Dt.index]:f},h],stateAttributesMapping:It});return We({open:w,ref:z,onComplete(){w||V(!1)}}),ne(()=>{if(!(R&&!c)&&l!=null)return y(i,l),()=>{d(i,l)}},[R,c,i,l,y,d]),c||k?x:null}),_t=o.forwardRef(function(a,s){const{activateOnFocus:n=!1,className:i,loopFocus:r=!0,render:c,style:m,...h}=a,{onValueChange:j,orientation:p,value:C,setTabMap:E,tabActivationDirection:y}=xe(),[d,l]=o.useState(0),[T,L]=o.useState(null),f=o.useRef(new Set),w=o.useRef(new Set),k=o.useRef(null);o.useEffect(()=>{if(typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f.current.forEach(S=>{S()})});return k.current=x,T&&x.observe(T),w.current.forEach(S=>{x.observe(S)}),()=>{x.disconnect(),k.current=null}},[T]);const D=F(x=>(f.current.add(x),()=>{f.current.delete(x)})),V=F(x=>(w.current.add(x),k.current?.observe(x),()=>{w.current.delete(x),k.current?.unobserve(x)})),R=F((x,S)=>{x!==C&&j(x,S)}),M={orientation:p,tabActivationDirection:y},g={"aria-orientation":p==="vertical"?"vertical":void 0,role:"tablist"},z=o.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:d,registerIndicatorUpdateListener:D,registerTabResizeObserverElement:V,onTabActivation:R,setHighlightedTabIndex:l,tabsListElement:T}),[n,d,D,V,R,l,T]);return e.jsx(Ee.Provider,{value:z,children:e.jsx(Ye,{render:c,className:i,style:m,state:M,refs:[s,L],props:[g,h],stateAttributesMapping:fe,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:r,orientation:p,onHighlightedIndexChange:l,onMapChange:E,disabledIndices:Je})})});function ze({className:t,orientation:a="horizontal",...s}){return e.jsx(Lt,{"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($t,{"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(At,{"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(Te,{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($,{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($,{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($,{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(i=>i.optionId===s.id&&i.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($,{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=ke(r=>r.openTab),n=r=>{a!==void 0&&s(te("file",`${a}/${r.path}`,{title:ue(r.path),...r.line===void 0?{}:{line:r.line}},se()))},i=t.decision===void 0?"Recommendation":"Decision";return e.jsxs(ze,{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(r=>e.jsx(H,{value:`option-${r.id}`,children:r.name},r.id)),e.jsx(H,{value:"compare",children:"Compare"}),e.jsx(H,{value:"recommendation",children:i})]})}),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($,{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(r=>e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsx("h3",{className:"font-semibold",children:r.name}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:r.summary})]},r.id))})})]})}),t.options.map(r=>e.jsx(U,{value:`option-${r.id}`,className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Bt,{option:r,onOpen:n})},r.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($,{variant:"secondary",className:"gap-1.5",children:[e.jsx(wt,{className:"size-3.5"})," ",i]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.recommendation.summary}),e.jsxs($,{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 Ne(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(Te,{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(Re,{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(je,{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(je,{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=Ne(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:Ne(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($,{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 i=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(i,{className:"size-4 shrink-0"}),e.jsx("p",{className:"font-medium",children:n.label}),e.jsx($,{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.id))]})}function Xt({document:t,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:i}){const r=ke(d=>d.openTab),{add:c}=Qe(),[m,h]=o.useState(null),[j,p]=o.useState(""),C=d=>{h(d),p("")},E=d=>{if(a===void 0)return;const l=d.startLine;if(i?.type==="working"||i?.type==="range"){r(te("diff",d.path,{title:ue(d.path),...i.type==="range"?{base:i.base}:{},...l===void 0?{}:{line:l}},se()));return}if(i?.type==="commit"){r(te("commit",i.hash,{title:i.hash.slice(0,12),reviewFilePath:d.path,...l===void 0?{}:{line:l}},se()));return}r(te("file",`${a}/${d.path}`,{title:ue(d.path),...l===void 0?{}:{line:l}},se()))};return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{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:()=>C("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:E,onComment:()=>C(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:m!==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:j,onChange:d=>p(d.target.value),placeholder:"What should the reviewer know?"}),e.jsx(nt,{children:e.jsx(G,{type:"button",onClick:()=>{m===null||j.trim()===""||c({body:j.trim(),anchor:m==="changeset"?{kind:"changeset"}:{kind:"canvas",canvasId:n??t.title,section:m}}).then(()=>h(null))},children:"Add comment"})})]})})]})}function Gt({content:t,repoPath:a,assetBaseUrl:s=null,canvasId:n,reviewTarget:i}){let r;try{r=JSON.parse(t)}catch(m){return e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",m instanceof Error?m.message:"invalid JSON"]})}const c=ct.safeParse(r);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:i})}):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 Le({projectId:t,canvasId:a,worktreePath:s,environmentId:n}){const{mint:i}=mt(),c=xt(n??null)?.session.baseUrl()??ft(),[m,h]=o.useState(null),[j,p]=o.useState(null);return o.useEffect(()=>{let C=!1;h(null),p(null);const E={projectId:t,canvasId:a,...s===void 0?{}:{worktreePath:s},...n===void 0?{}:{environmentId:n}};return ht((async()=>{try{const y=await i(E);C||h(`${c}/canvas/${y}`)}catch(y){C||p(y instanceof Error&&y.message.length>0?y.message:"Could not open this Canvas.")}})(),"fallback"),()=>{C=!0}},[t,a,s,n,c,i]),{src:m,error:j}}function Zt({projectId:t,canvasId:a,title:s,worktreePath:n,environmentId:i}){const{src:r,error:c}=Le({projectId:t,canvasId:a,worktreePath:n,environmentId:i}),m=o.useRef(null);return o.useEffect(()=>{function h(j){if(j.source!==m.current?.contentWindow)return;const p=Qt(j.data);p!==null&&window.open(p,"_blank","noopener,noreferrer")}return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[]),c!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:c}):r===null?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("iframe",{ref:m,"data-testid":X.canvasIframe,title:s,src:r,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:i,reviewTarget:r}){const{src:c}=Le({projectId:t,canvasId:a,worktreePath:n,environmentId:i});return e.jsx(Gt,{content:s,canvasId:a,repoPath:n,assetBaseUrl:c===null?null:`${c}/assets`,reviewTarget:r})}function ns({projectId:t,canvasId:a,worktreePath:s,environmentId:n,reviewTarget:i}){const{canvas:r,isLoading:c,loadError:m}=ut(t,a,s??null,n??null);return m!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:m}):c||r===void 0?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):r.record.kind==="markdown"?e.jsx(Re,{content:r.content}):r.record.kind==="structured"?e.jsx(es,{projectId:t,canvasId:a,content:r.content,worktreePath:s,environmentId:n,reviewTarget:i}):e.jsx(Zt,{projectId:t,canvasId:a,title:r.record.title,worktreePath:s,environmentId:n})}export{ns as CanvasView};
|
|
1
|
+
import{$ as A,r as o,aE as Ce,aF as $e,aG as ne,aH as F,aI as de,aJ as he,aK as pe,aL as me,j as e,aM as De,aN as Ie,aO as we,aP as Ae,aQ as _e,aR as ge,aS as Oe,aT as Be,aU as Pe,aV as ve,aW as be,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 ke,aj as $,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-BydNjdTq.js";import{M as Re,b as je}from"./html-view-Do0NJIhn.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=A("circle-alert",pt);const vt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],bt=A("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=A("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"}]],Te=A("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=A("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=A("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=A("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=A("video",Et),Me=o.createContext(void 0);function xe(){const t=o.useContext(Me);if(t===void 0)throw new Error(Ce(64));return t}let St=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const fe={tabActivationDirection:t=>({[St.activationDirection]:t})},Lt=o.forwardRef(function(a,s){const{className:n,defaultValue:i=0,onValueChange:r,orientation:c="horizontal",render:m,value:h,style:j,...p}=a,C=a.defaultValue!==void 0,E=o.useRef([]),[y,d]=o.useState(()=>new Map),[l,T]=$e({controlled:h,default:i,name:"Tabs",state:"value"}),L=h!==void 0,[f,w]=o.useState(()=>new Map),k=o.useCallback(u=>{if(u===void 0)return null;for(const[v,N]of f.entries())if(N!=null&&u===(N.value??N.index))return v;return null},[f]),[D,V]=o.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:R,tabActivationDirection:M}=D;let g=M,z=!1;R!==l&&(g=ye(R,l,c,f),z=R!=null&&l!=null&&k(l)==null);const x=z?R:l,S=R!==x||M!==g;ne(()=>{S&&V({previousValue:x,tabActivationDirection:g})},[x,S,g]);const Q=F((u,v)=>{const N=ye(l,u,c,f);v.activationDirection=N,r?.(u,v),!v.isCanceled&&T(u)}),Y=F((u,v)=>{r?.(u,de(v,void 0,void 0,{activationDirection:"none"}))}),_=F((u,v)=>{d(N=>{if(N.get(u)===v)return N;const I=new Map(N);return I.set(u,v),I})}),W=F((u,v)=>{d(N=>{if(!N.has(u)||N.get(u)!==v)return N;const I=new Map(N);return I.delete(u),I})}),Z=o.useCallback(u=>y.get(u),[y]),ee=o.useCallback(u=>{for(const v of f.values())if(u===v?.value)return v?.id},[f]),re=o.useMemo(()=>({getTabElementBySelectedValue:k,getTabIdByPanelValue:ee,getTabPanelIdByValue:Z,onValueChange:Q,orientation:c,registerMountedTabPanel:_,setTabMap:w,unregisterMountedTabPanel:W,tabActivationDirection:g,value:l}),[k,ee,Z,Q,c,_,w,W,g,l]),J=o.useMemo(()=>{for(const u of f.values())if(u!=null&&u.value===l)return u},[f,l]),le=o.useMemo(()=>{for(const u of f.values())if(u!=null&&!u.disabled)return u.value},[f]),b=o.useRef(!C),O=o.useRef(C),oe=o.useRef(!1);ne(()=>{if(L)return;function u(B,K){T(B),V(ce=>ce.previousValue===B&&ce.tabActivationDirection==="none"?ce:{previousValue:B,tabActivationDirection:"none"}),Y(B,K),b.current=!1}if(f.size===0){if(!oe.current||l===null)return;u(null,pe);return}oe.current=!0;const v=J?.disabled,N=J==null&&l!==null;if(!v&&l===i&&(O.current=!1),O.current&&v&&l===i)return;const I=b.current;if(v||N){const B=le??null;if(l===B){b.current=!1;return}let K=pe;I?K=he:v&&(K=Ie),u(B,K);return}I&&J!=null&&(Y(l,he),b.current=!1)},[i,le,L,Y,J,T,f,l]);const Ve=me("div",a,{state:{orientation:c,tabActivationDirection:g},ref:s,props:p,stateAttributesMapping:fe});return e.jsx(Me.Provider,{value:re,children:e.jsx(De,{elementsRef:E,children:Ve})})});function ye(t,a,s,n){if(t==null||a==null)return"none";let i=null,r=null;for(const[h,j]of n.entries()){if(j==null)continue;const p=j.value??j.index;if(t===p&&(i=h),a===p&&(r=h),i!=null&&r!=null)break}if(i==null||r==null)return i!==r&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof a?s==="horizontal"?a>t?"right":"left":a>t?"down":"up":"none";const c=i.getBoundingClientRect(),m=r.getBoundingClientRect();if(s==="horizontal"){if(m.left<c.left)return"left";if(m.left>c.left)return"right"}else{if(m.top<c.top)return"up";if(m.top>c.top)return"down"}return"none"}const Ee=o.createContext(void 0);function Vt(){const t=o.useContext(Ee);if(t===void 0)throw new Error(Ce(65));return t}const $t=o.forwardRef(function(a,s){const{className:n,disabled:i=!1,render:r,value:c,id:m,nativeButton:h=!0,style:j,...p}=a,{value:C,getTabPanelIdByValue:E,orientation:y}=xe(),{activateOnFocus:d,highlightedTabIndex:l,onTabActivation:T,registerTabResizeObserverElement:L,setHighlightedTabIndex:f,tabsListElement:w}=Vt(),k=we(m),D=o.useMemo(()=>({disabled:i,id:k,value:c}),[i,k,c]),{compositeProps:V,compositeRef:R,index:M}=Ae({metadata:D}),g=c===C,z=o.useRef(!1),x=o.useRef(null);o.useEffect(()=>{const b=x.current;if(b)return L(b)},[L]),ne(()=>{if(z.current){z.current=!1;return}if(!(g&&M>-1&&l!==M))return;const b=w;if(b!=null){const O=_e(ge(b));if(O&&Oe(b,O))return}i||f(M)},[g,M,l,f,i,w]);const{getButtonProps:S,buttonRef:Q}=Be({disabled:i,native:h,focusableWhenDisabled:!0}),Y=E(c),_=o.useRef(!1),W=o.useRef(!1);function Z(b){g||i||T(c,de(ve,b.nativeEvent,void 0,{activationDirection:"none"}))}function ee(b){g||(M>-1&&!i&&f(M),!i&&d&&(!_.current||_.current&&W.current)&&T(c,de(ve,b.nativeEvent,void 0,{activationDirection:"none"})))}function re(b){if(g||i)return;_.current=!0;function O(){_.current=!1,W.current=!1}(!b.button||b.button===0)&&(W.current=!0,ge(b.currentTarget).addEventListener("pointerup",O,{once:!0}))}return me("button",a,{state:{disabled:i,active:g,orientation:y},ref:[s,Q,R,x],props:[V,{role:"tab","aria-controls":Y,"aria-selected":g,id:k,onClick:Z,onFocus:ee,onPointerDown:re,[Pe]:g?"":void 0,onKeyDownCapture(){z.current=!0}},p,S]})});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=be.startingStyle]="startingStyle",t[t.endingStyle=be.endingStyle]="endingStyle",t})({});const It={...fe,...qe},At=o.forwardRef(function(a,s){const{className:n,value:i,render:r,keepMounted:c=!1,style:m,...h}=a,{value:j,getTabIdByPanelValue:p,orientation:C,tabActivationDirection:E,registerMountedTabPanel:y,unregisterMountedTabPanel:d}=xe(),l=we(),T=o.useMemo(()=>({id:l,value:i}),[l,i]),{ref:L,index:f}=Fe({metadata:T}),w=i===j,{mounted:k,transitionStatus:D,setMounted:V}=He(w),R=!k,M=p(i),g={hidden:R,orientation:C,tabActivationDirection:E,transitionStatus:D},z=o.useRef(null),x=me("div",a,{state:g,ref:[s,L,z],props:[{"aria-labelledby":M,hidden:R,id:l,role:"tabpanel",tabIndex:w?0:-1,inert:Ue(!w),[Dt.index]:f},h],stateAttributesMapping:It});return We({open:w,ref:z,onComplete(){w||V(!1)}}),ne(()=>{if(!(R&&!c)&&l!=null)return y(i,l),()=>{d(i,l)}},[R,c,i,l,y,d]),c||k?x:null}),_t=o.forwardRef(function(a,s){const{activateOnFocus:n=!1,className:i,loopFocus:r=!0,render:c,style:m,...h}=a,{onValueChange:j,orientation:p,value:C,setTabMap:E,tabActivationDirection:y}=xe(),[d,l]=o.useState(0),[T,L]=o.useState(null),f=o.useRef(new Set),w=o.useRef(new Set),k=o.useRef(null);o.useEffect(()=>{if(typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f.current.forEach(S=>{S()})});return k.current=x,T&&x.observe(T),w.current.forEach(S=>{x.observe(S)}),()=>{x.disconnect(),k.current=null}},[T]);const D=F(x=>(f.current.add(x),()=>{f.current.delete(x)})),V=F(x=>(w.current.add(x),k.current?.observe(x),()=>{w.current.delete(x),k.current?.unobserve(x)})),R=F((x,S)=>{x!==C&&j(x,S)}),M={orientation:p,tabActivationDirection:y},g={"aria-orientation":p==="vertical"?"vertical":void 0,role:"tablist"},z=o.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:d,registerIndicatorUpdateListener:D,registerTabResizeObserverElement:V,onTabActivation:R,setHighlightedTabIndex:l,tabsListElement:T}),[n,d,D,V,R,l,T]);return e.jsx(Ee.Provider,{value:z,children:e.jsx(Ye,{render:c,className:i,style:m,state:M,refs:[s,L],props:[g,h],stateAttributesMapping:fe,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:r,orientation:p,onHighlightedIndexChange:l,onMapChange:E,disabledIndices:Je})})});function ze({className:t,orientation:a="horizontal",...s}){return e.jsx(Lt,{"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($t,{"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(At,{"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(Te,{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($,{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($,{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($,{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(i=>i.optionId===s.id&&i.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($,{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=ke(r=>r.openTab),n=r=>{a!==void 0&&s(te("file",`${a}/${r.path}`,{title:ue(r.path),...r.line===void 0?{}:{line:r.line}},se()))},i=t.decision===void 0?"Recommendation":"Decision";return e.jsxs(ze,{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(r=>e.jsx(H,{value:`option-${r.id}`,children:r.name},r.id)),e.jsx(H,{value:"compare",children:"Compare"}),e.jsx(H,{value:"recommendation",children:i})]})}),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($,{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(r=>e.jsxs("div",{className:"rounded-xl border bg-card p-4",children:[e.jsx("h3",{className:"font-semibold",children:r.name}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:r.summary})]},r.id))})})]})}),t.options.map(r=>e.jsx(U,{value:`option-${r.id}`,className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Bt,{option:r,onOpen:n})},r.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($,{variant:"secondary",className:"gap-1.5",children:[e.jsx(wt,{className:"size-3.5"})," ",i]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:t.recommendation.summary}),e.jsxs($,{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 Ne(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(Te,{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(Re,{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(je,{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(je,{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=Ne(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:Ne(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($,{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 i=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(i,{className:"size-4 shrink-0"}),e.jsx("p",{className:"font-medium",children:n.label}),e.jsx($,{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.id))]})}function Xt({document:t,repoPath:a,assetBaseUrl:s,canvasId:n,reviewTarget:i}){const r=ke(d=>d.openTab),{add:c}=Qe(),[m,h]=o.useState(null),[j,p]=o.useState(""),C=d=>{h(d),p("")},E=d=>{if(a===void 0)return;const l=d.startLine;if(i?.type==="working"||i?.type==="range"){r(te("diff",d.path,{title:ue(d.path),...i.type==="range"?{base:i.base}:{},...l===void 0?{}:{line:l}},se()));return}if(i?.type==="commit"){r(te("commit",i.hash,{title:i.hash.slice(0,12),reviewFilePath:d.path,...l===void 0?{}:{line:l}},se()));return}r(te("file",`${a}/${d.path}`,{title:ue(d.path),...l===void 0?{}:{line:l}},se()))};return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{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:()=>C("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:E,onComment:()=>C(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:m!==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:j,onChange:d=>p(d.target.value),placeholder:"What should the reviewer know?"}),e.jsx(nt,{children:e.jsx(G,{type:"button",onClick:()=>{m===null||j.trim()===""||c({body:j.trim(),anchor:m==="changeset"?{kind:"changeset"}:{kind:"canvas",canvasId:n??t.title,section:m}}).then(()=>h(null))},children:"Add comment"})})]})})]})}function Gt({content:t,repoPath:a,assetBaseUrl:s=null,canvasId:n,reviewTarget:i}){let r;try{r=JSON.parse(t)}catch(m){return e.jsxs("div",{"data-testid":X.structuredCanvasInvalid,className:"p-6 text-sm text-destructive",children:["Invalid structured Canvas: ",m instanceof Error?m.message:"invalid JSON"]})}const c=ct.safeParse(r);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:i})}):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 Le({projectId:t,canvasId:a,worktreePath:s,environmentId:n}){const{mint:i}=mt(),c=xt(n??null)?.session.baseUrl()??ft(),[m,h]=o.useState(null),[j,p]=o.useState(null);return o.useEffect(()=>{let C=!1;h(null),p(null);const E={projectId:t,canvasId:a,...s===void 0?{}:{worktreePath:s},...n===void 0?{}:{environmentId:n}};return ht((async()=>{try{const y=await i(E);C||h(`${c}/canvas/${y}`)}catch(y){C||p(y instanceof Error&&y.message.length>0?y.message:"Could not open this Canvas.")}})(),"fallback"),()=>{C=!0}},[t,a,s,n,c,i]),{src:m,error:j}}function Zt({projectId:t,canvasId:a,title:s,worktreePath:n,environmentId:i}){const{src:r,error:c}=Le({projectId:t,canvasId:a,worktreePath:n,environmentId:i}),m=o.useRef(null);return o.useEffect(()=>{function h(j){if(j.source!==m.current?.contentWindow)return;const p=Qt(j.data);p!==null&&window.open(p,"_blank","noopener,noreferrer")}return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[]),c!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:c}):r===null?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):e.jsx("iframe",{ref:m,"data-testid":X.canvasIframe,title:s,src:r,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:i,reviewTarget:r}){const{src:c}=Le({projectId:t,canvasId:a,worktreePath:n,environmentId:i});return e.jsx(Gt,{content:s,canvasId:a,repoPath:n,assetBaseUrl:c===null?null:`${c}/assets`,reviewTarget:r})}function ns({projectId:t,canvasId:a,worktreePath:s,environmentId:n,reviewTarget:i}){const{canvas:r,isLoading:c,loadError:m}=ut(t,a,s??null,n??null);return m!==null?e.jsx("div",{className:"p-4 text-sm text-destructive",children:m}):c||r===void 0?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"}):r.record.kind==="markdown"?e.jsx(Re,{content:r.content}):r.record.kind==="structured"?e.jsx(es,{projectId:t,canvasId:a,content:r.content,worktreePath:s,environmentId:n,reviewTarget:i}):e.jsx(Zt,{projectId:t,canvasId:a,title:r.record.title,worktreePath:s,environmentId:n})}export{ns as CanvasView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as G,V as Y,W as Z,r as d,X as K,h as J,j as e,Y as Q,T as L,n as D,v as ee,x as se,c as te,u as ne,N as ae,e as oe,f as re,g as le,i as ie,D as ce,B as u,Z as de,_ as he,k as b,l as N,S as W,m as $,o as k,M as A,F as xe,p as pe,C as ue,q as me,s as ge,t as I,w as fe,y as je,z as ve,A as Ce,E as be,G as Ne,H as ke,I as we}from"./index-
|
|
1
|
+
import{U as G,V as Y,W as Z,r as d,X as K,h as J,j as e,Y as Q,T as L,n as D,v as ee,x as se,c as te,u as ne,N as ae,e as oe,f as re,g as le,i as ie,D as ce,B as u,Z as de,_ as he,k as b,l as N,S as W,m as $,o as k,M as A,F as xe,p as pe,C as ue,q as me,s as ge,t as I,w as fe,y as je,z as ve,A as Ce,E as be,G as Ne,H as ke,I as we}from"./index-BydNjdTq.js";import{L as Ue}from"./index-BydNjdTq.js";import{a as Se}from"./line-selection-XRkDh5Ju.js";import{H as ye}from"./hunks-view-DbHtk643.js";import{U as Te,F as Fe}from"./unfold-vertical-D7QLv5cD.js";import"./virtual-rows-D1EsaG9G.js";function H(s,o,t,l){const r=new Set(s[o]??[]);return l?r.add(t):r.delete(t),{...s,[o]:[...r]}}const U=G(s=>({collapsedByScope:{},toggle:(o,t)=>s(l=>{const r=!(l.collapsedByScope[o]??[]).includes(t);return{collapsedByScope:H(l.collapsedByScope,o,t,r)}}),collapse:(o,t)=>s(l=>({collapsedByScope:H(l.collapsedByScope,o,t,!0)})),clear:()=>s({collapsedByScope:{}})}));function Re(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 Le({file:s,collapseScope:o,reviewable:t,commentAnchor:l,onComment:r,onSelectFile:m}){const p=U(n=>(n.collapsedByScope[o]??[]).includes(s.path)),w=U(n=>n.toggle),E=U(n=>n.collapse),[h,g]=d.useState(null),c=K(n=>n.project),S=te(n=>n.openTab),M=ne(n=>n.setSidebarTab),y=ae(n=>n.reveal),T=oe(),{mark:z,unmark:a}=re(),F=le(s.path),i=T.has(s.path),B=s.status!=="deleted",f=d.useMemo(()=>Re(l,s.path),[l,s.path]),[x,j]=d.useState([]),O=d.useMemo(()=>ie(s.hunks??[],{context:ce,revealed:x}),[s.hunks,x]),V=O.gaps.some(n=>n.expandable),P=V||x.length>0,_=(n,v)=>{const R=v==="up"?be(n):v==="down"?Ne(n):ke(n);j(C=>we(C,R))},X=()=>{if(!c||!B)return;const n=`${c.path}/${s.path}`;S(je("file",n,{title:Ce(s.path),preview:!0},ve())),M("files"),y(n)},q=()=>{if(i){a(s.path);return}z(s.path),E(o,s.path)};return e.jsxs("div",{"data-testid":L.changesetCard(s.path),"data-review-file-path":s.path,className:D(fe,"flex flex-col"),onPointerEnter:()=>m(s.path),children:[e.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b px-3",children:[e.jsx(u,{variant:"ghost",size:"icon-2xs",className:"shrink-0 text-muted-foreground hover:text-foreground",onClick:()=>w(o,s.path),"aria-expanded":!p,"aria-label":p?"Expand diff":"Collapse diff","data-testid":L.diffCollapse(s.path),children:p?e.jsx(de,{}):e.jsx(he,{})}),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(b,{children:[e.jsx(N,{render:e.jsx(u,{variant:"ghost",size:"icon-2xs",onClick:q,className:D("shrink-0",i?"text-success":"text-muted-foreground hover:text-foreground"),"aria-label":i?"Unmark reviewed":"Mark reviewed","data-testid":L.diffReviewed(s.path),children:i?e.jsx(W,{className:"size-3.5"}):e.jsx($,{className:"size-3.5"})})}),e.jsx(k,{children:i?"Unmark reviewed":"Mark reviewed"})]}),e.jsxs(b,{children:[e.jsx(N,{render:e.jsx(u,{variant:"ghost",size:"icon-2xs",onClick:()=>r({path:s.path}),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Comment on file",children:e.jsx(A,{className:"size-3.5"})})}),e.jsx(k,{children:"Comment on file"})]}),B&&e.jsxs(b,{children:[e.jsx(N,{render:e.jsx(u,{variant:"ghost",size:"icon-2xs",onClick:X,className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open file",children:e.jsx(xe,{className:"size-3.5"})})}),e.jsx(k,{children:"Open file"})]}),V&&e.jsxs(b,{children:[e.jsx(N,{render:e.jsx(u,{variant:"ghost",size:"icon-2xs",onClick:()=>j(pe()),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Expand all context",children:e.jsx(Te,{className:"size-3.5"})})}),e.jsx(k,{children:"Expand all context"})]}),x.length>0&&e.jsxs(b,{children:[e.jsx(N,{render:e.jsx(u,{variant:"ghost",size:"icon-2xs",onClick:()=>j([]),className:"shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Collapse context",children:e.jsx(Fe,{className:"size-3.5"})})}),e.jsx(k,{children:"Collapse context"})]})]}),!p&&s.hunks&&s.hunks.length>0&&e.jsxs(ue,{onOpenChange:n=>{n||g(null)},children:[e.jsx(me,{className:"block select-text",onContextMenu:n=>{const v=Se(s.path);if(v){g(v);return}const R=n.target.closest("[data-line]"),C=R?Number.parseInt(R.getAttribute("data-line")??"",10):Number.NaN;g(Number.isFinite(C)?{startLine:C,endLine:C,text:""}:null)},children:e.jsx(ye,{hunks:P?O.hunks:s.hunks??[],gaps:P?O.gaps:void 0,onExpand:P?_:void 0,filePath:s.path,diffMode:"unified",layout:"content",commentIndex:F,pendingLines:f})}),e.jsxs(ge,{className:"w-52",children:[h?e.jsxs(I,{onClick:()=>r({path:s.path,startLine:h.startLine,endLine:h.endLine,anchorText:h.text.slice(0,2e3)}),children:[e.jsx(A,{})," Add comment"]}):e.jsxs(I,{onClick:()=>r({path:s.path}),children:[e.jsx(A,{})," Comment on file"]}),t&&e.jsxs(I,{onClick:q,children:[i?e.jsx($,{}):e.jsx(W,{}),i?"Unmark reviewed":"Mark reviewed"]})]})]})]})}function Pe({path:s,paneIndex:o=0}){const t=Y(s),{reading:l,error:r}=Z(t),[m,p]=d.useState(null),w=d.useRef(null),E=K(a=>a.project?.path??""),h=J(a=>a.setPath),g=`${E}\0${s}`,c=l?.groups.flatMap(a=>a.files)??[],S=c.map(a=>a.path).join("\0"),[M,y]=d.useState(null),T=M??c[0]?.path??null;if(d.useEffect(()=>(h(o,T),()=>h(o,null)),[o,h,T]),d.useEffect(()=>{const a=w.current;if(a===null||S===""||typeof IntersectionObserver>"u")return;const F=new IntersectionObserver(i=>{const f=i.filter(x=>x.isIntersecting).sort((x,j)=>x.boundingClientRect.top-j.boundingClientRect.top)[0]?.target.getAttribute("data-review-file-path");f!=null&&y(f)},{root:a,threshold:.5});for(const i of a.querySelectorAll("[data-review-file-path]"))F.observe(i);return()=>F.disconnect()},[S]),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 z=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:z}),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(Q,{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:w,"data-testid":L.codeWell,className:D(ee,"overflow-auto"),children:e.jsx("div",{className:"flex flex-col gap-3",children:c.map(a=>e.jsx(Le,{file:a,collapseScope:g,reviewable:t.type!=="commit",commentAnchor:m,onComment:p,onSelectFile:y},a.path))})}),e.jsx(se,{anchor:m,open:m!==null,onOpenChange:a=>{a||p(null)}})]})}export{Pe as ChangesetView,Ue as changesetTabKey,Y 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-
|
|
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-BydNjdTq.js";import{D as I}from"./diff-mode-toggle-CXE1Skh5.js";import{H as Q}from"./hunks-view-DbHtk643.js";import"./virtual-rows-D1EsaG9G.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,a as t,j as i,P as r,Q as n}from"./index-
|
|
1
|
+
import{u as o,a as t,j as i,P as r,Q as n}from"./index-BydNjdTq.js";function a(){const f=o(e=>e.diffMode),l=o(e=>e.setDiffMode);return t()?null:i.jsxs(r,{value:[f],onValueChange:e=>{const s=e[0];(s==="unified"||s==="split")&&l(s)},children:[i.jsx(n,{value:"unified",size:"sm",children:"Unified"}),i.jsx(n,{value:"split",size:"sm",children:"Split"})]})}export{a as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as K,a as X,b as J,c as Q,d as Y,e as Z,f as P,r as o,g as ee,h as se,i as ne,j as e,v as te,T as F,k as d,l as c,B as x,S as ae,m as re,n as R,o as u,M as S,F as oe,p as ie,C as le,q as de,s as ce,t as y,w as xe,x as ue,D as me,y as fe,z as he,A as pe,E as je,G as ge,H as ve,I as Ce}from"./index-
|
|
1
|
+
import{u as K,a as X,b as J,c as Q,d as Y,e as Z,f as P,r as o,g as ee,h as se,i as ne,j as e,v as te,T as F,k as d,l as c,B as x,S as ae,m as re,n as R,o as u,M as S,F as oe,p as ie,C as le,q as de,s as ce,t as y,w as xe,x as ue,D as me,y as fe,z as he,A as pe,E as je,G as ge,H as ve,I as Ce}from"./index-BydNjdTq.js";import{l as be}from"./line-selection-XRkDh5Ju.js";import{D as Ne}from"./diff-mode-toggle-CXE1Skh5.js";import{H as we}from"./hunks-view-DbHtk643.js";import{U as ke,F as Te}from"./unfold-vertical-D7QLv5cD.js";import"./virtual-rows-D1EsaG9G.js";function ye({filePath:n,base:L,paneIndex:j=0}){const I=K(s=>s.diffMode),U=X()?"unified":I,E=J(),z=Q(s=>s.openTab),{hunks:g,status:v,image:m,binary:C,error:D}=Y(n,L),A=Z(),{mark:O,unmark:V}=P(),i=A.has(n),[f,b]=o.useState(null),[t,h]=o.useState(null),H=ee(n),N=se(s=>s.setPath);o.useEffect(()=>(N(j,n),()=>N(j,null)),[n,j,N]);const[w,p]=o.useState([]),k=`${n}\0${L??""}`,[q,$]=o.useState(k);q!==k&&($(k),p([]));const T=o.useMemo(()=>ne(g??[],{context:me,revealed:w}),[g,w]),B=(s,r)=>{const a=r==="up"?je(s):r==="down"?ge(s):ve(s);p(l=>Ce(l,a))},W=T.gaps.some(s=>s.expandable),_=o.useMemo(()=>{if(!t||t.path!==n||t.startLine===void 0)return;const s=new Set,r=t.endLine??t.startLine;for(let a=t.startLine;a<=r;a++)s.add(a);return s},[t,n]),G=()=>{if(E===null)return;const s=`${E}/${n}`;z(fe("file",s,{title:pe(n),preview:!0},he()))};if(D)return e.jsx("p",{className:"p-4 text-sm text-destructive",children:D.message});if(g===void 0&&m===void 0&&!C)return e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"});const M=m!==void 0||C;return e.jsxs("div",{"data-testid":F.codeWell,className:te,children:[e.jsxs("div",{"data-testid":F.codeCard,className:R(xe,"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:n}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsxs(d,{children:[e.jsx(c,{render:e.jsx(x,{variant:"ghost",size:"icon-xs",className:R(i?"text-success":"text-muted-foreground hover:text-foreground"),onClick:()=>{i?V(n):O(n)},"aria-label":i?"Unmark reviewed":"Mark reviewed","data-testid":F.diffReviewed(n),children:i?e.jsx(ae,{}):e.jsx(re,{})})}),e.jsx(u,{children:i?"Unmark reviewed":"Mark reviewed"})]}),e.jsxs(d,{children:[e.jsx(c,{render:e.jsx(x,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground",onClick:()=>h({path:n}),"aria-label":"Comment on file",children:e.jsx(S,{})})}),e.jsx(u,{children:"Comment on file"})]}),v!=="deleted"&&e.jsxs(d,{children:[e.jsx(c,{render:e.jsx(x,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground",onClick:G,"aria-label":"Open file",children:e.jsx(oe,{})})}),e.jsx(u,{children:"Open file"})]}),!M&&W&&e.jsxs(d,{children:[e.jsx(c,{render:e.jsx(x,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground",onClick:()=>p(ie()),"aria-label":"Expand all context",children:e.jsx(ke,{})})}),e.jsx(u,{children:"Expand all context"})]}),!M&&w.length>0&&e.jsxs(d,{children:[e.jsx(c,{render:e.jsx(x,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground",onClick:()=>p([]),"aria-label":"Collapse context",children:e.jsx(Te,{})})}),e.jsx(u,{children:"Collapse context"})]}),!M&&e.jsx(Ne,{})]})]}),m!==void 0?e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 overflow-auto p-8",children:[e.jsx("img",{src:m.dataUrl,alt:n,className:"max-h-full max-w-full object-contain"}),e.jsxs("p",{className:"text-2xs text-muted-foreground",children:[v==="untracked"||v==="added"?"New image":"Image changed"," · binary diff"]})]}):C?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Binary file"}):e.jsxs(le,{onOpenChange:s=>{s||b(null)},children:[e.jsx(de,{className:"block min-h-0 flex-1 select-text",onContextMenu:s=>{const r=be();if(r){b(r);return}const a=s.target.closest("[data-line]"),l=a?Number.parseInt(a.getAttribute("data-line")??"",10):Number.NaN;b(Number.isFinite(l)?{startLine:l,endLine:l,text:""}:null)},children:e.jsx(we,{hunks:T.hunks,gaps:T.gaps,onExpand:B,filePath:n,diffMode:U,commentIndex:H,pendingLines:_})}),e.jsx(ce,{className:"w-52",children:f?e.jsxs(y,{onClick:()=>h({path:n,startLine:f.startLine,endLine:f.endLine,anchorText:f.text.slice(0,2e3)}),children:[e.jsx(S,{})," Add comment"]}):e.jsxs(y,{onClick:()=>h({path:n}),children:[e.jsx(S,{})," Comment on file"]})})]})]}),e.jsx(ue,{anchor:t,open:t!==null,onOpenChange:s=>{s||h(null)}})]})}export{ye as DiffView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as Re,r as o,a1 as ue,ad as xe,ae as me,af as Pe,ag as fe,b as te,ah as ne,j as e,C as he,q as pe,a6 as je,n as F,ai as Ae,T as J,aj as Q,ak as H,s as ge,t as j,al as _,am as B,an as Z,ao as ve,ap as ze,aq as re,M as E,ar as ee,as as Ce,at as we,au as ke,x as oe,a8 as be,c as se,av as Ie,aw as q,ax as He,B as D,ab as De,_ as Oe,ay as Ke,a7 as Ve,u as R,g as _e,az as Be,aA as qe,v as Ue,k as Ge,l as We,o as $e,w as Xe,P as ye,Q as U,aB as Qe,aC as Ye}from"./index-
|
|
1
|
+
import{$ as Re,r as o,a1 as ue,ad as xe,ae as me,af as Pe,ag as fe,b as te,ah as ne,j as e,C as he,q as pe,a6 as je,n as F,ai as Ae,T as J,aj as Q,ak as H,s as ge,t as j,al as _,am as B,an as Z,ao as ve,ap as ze,aq as re,M as E,ar as ee,as as Ce,at as we,au as ke,x as oe,a8 as be,c as se,av as Ie,aw as q,ax as He,B as D,ab as De,_ as Oe,ay as Ke,a7 as Ve,u as R,g as _e,az as Be,aA as qe,v as Ue,k as Ge,l as We,o as $e,w as Xe,P as ye,Q as U,aB as Qe,aC as Ye}from"./index-BydNjdTq.js";import{i as Je,a as Ze,M as es,H as ss}from"./html-view-Do0NJIhn.js";import{b as ts,l as ns,c as rs}from"./line-selection-XRkDh5Ju.js";import{R as os,V as as}from"./virtual-rows-D1EsaG9G.js";const is=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],ls=Re("scissors",is);function Se(t,r){return!r||r.length===0?!1:r.some(n=>t>=n.start&&t<=n.end)}const cs=5e3,ds=800,Y="pointer-events-none absolute bottom-2 right-3 rounded-md border-transparent bg-muted/80 text-2xs",us=o.memo(be),xs=8;function ms({path:t,initialContent:r,highlightLine:n,highlightRanges:i,commentsByLine:a}){const[d,p]=o.useState(r),[g,x]=o.useState(r),[u,C]=o.useState(""),[c,w]=o.useState(!1),[m,k]=o.useState(null),[f,N]=o.useState(null),b=o.useRef(null),L=o.useRef(null),S=o.useRef(null),T=ue(t),M=o.useDeferredValue(d),P=xe(M,T),{findReferences:O,copyPath:K,copyRelativePath:V,reveal:G}=me(t),{save:A,isSaving:W,error:z}=Pe(t),v=fe(),y=te()??void 0,ae=ne(y,t),Ne=o.useMemo(()=>{if(!m||m.startLine===void 0)return null;const s=new Set,l=m.endLine??m.startLine;for(let h=m.startLine;h<=l;h++)s.add(h);return s},[m]),Le=o.useMemo(()=>{if(!c||u===""||!f)return null;const s=new Set;for(let l=f.startLine;l<=f.endLine;l++)s.add(l);return s},[c,u,f]),$=o.useEffectEvent(()=>{if(S.current&&clearTimeout(S.current),d===g)return;const s=d;A(s,()=>x(s))}),ie=s=>{p(s);const l=se.getState().panes.flatMap(h=>h.tabs).find(h=>h.kind==="file"&&h.path===t);se.getState().pinTab(l?.id??Ie("file",t)),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>$(),ds)};o.useEffect(()=>()=>{S.current&&clearTimeout(S.current),$()},[]);const le=o.useRef(r);o.useEffect(()=>{r!==le.current&&d===g&&(le.current=r,p(r),x(r))},[r,d,g]),o.useEffect(()=>{const s=L.current;!s||n===void 0||(s.scrollTop=Math.max(0,(n-1)*20-s.clientHeight/2+10))},[n]);const ce=s=>{const l=b.current;if(!l)return;const{selectionStart:h,selectionEnd:X,value:I}=l;ie(I.slice(0,h)+s+I.slice(X)),requestAnimationFrame(()=>{l.focus(),l.selectionStart=l.selectionEnd=h+s.length})},Me=()=>{const s=b.current;return s?s.value.slice(s.selectionStart,s.selectionEnd):""},Te=()=>{navigator.clipboard?.readText&&B(async()=>{ce(await navigator.clipboard.readText())},s=>{q("Paste",s)})},Ee=d!==g;return e.jsxs(e.Fragment,{children:[e.jsxs(he,{onOpenChange:s=>{if(w(s),s){C(Me());const l=b.current;N(l?ts(l.value,l.selectionStart,l.selectionEnd):null)}},children:[e.jsxs(pe,{className:"relative block h-full select-text overflow-hidden",children:[e.jsx("div",{ref:L,className:"h-full overflow-auto",children:e.jsxs("div",{className:"relative min-h-full w-max min-w-full",children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-0 px-4 py-2 font-mono text-xs leading-5",children:e.jsx("div",{className:"w-max min-w-full",children:d.split(`
|
|
2
2
|
`).map((s,l)=>{const h=l+1,X=(Ne?.has(h)??!1)||(Le?.has(h)??!1),I=je(a?.get(h),X)??(h===n?"bg-primary/15":void 0),Fe=!I&&Se(h,i);return e.jsxs("div",{className:F("flex",I,Fe&&"border-l-2 border-l-diff-add bg-diff-add/10"),children:[e.jsx("span",{className:"w-10 shrink-0 select-none pr-3 text-right text-muted-foreground/50",children:h}),e.jsx(us,{tokens:P?.[l]??null,text:s})]},l)})})}),a&&a.size>0&&e.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 font-mono text-xs leading-5",children:[...a.entries()].map(([s,l])=>e.jsx("div",{className:"pointer-events-auto absolute left-1 flex h-5 items-center",style:{top:xs+(s-1)*os},children:e.jsx(Ae,{comments:l})},s))}),e.jsx("textarea",{ref:b,value:d,onChange:s=>ie(s.target.value),onKeyDown:s=>{s.key==="s"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),$())},spellCheck:!1,wrap:"off","aria-label":`Edit ${t}`,"data-testid":J.fileEditor,className:"relative z-10 block min-h-full min-w-full resize-none whitespace-pre bg-transparent py-2 pl-14 pr-4 font-mono text-xs leading-5 text-transparent caret-foreground outline-none field-sizing-content"})]})}),z?e.jsx(Q,{variant:"outline",className:F(Y,"text-destructive"),children:z.message}):W?e.jsx(Q,{variant:"outline",className:F(Y,"text-muted-foreground"),children:"Saving…"}):Ee?e.jsxs(Q,{variant:"outline",className:F(Y,"text-muted-foreground"),children:["Unsaved ",e.jsx(H,{className:"[@media(hover:none)]:hidden",tokens:["mod","S"]})]}):null]}),e.jsxs(ge,{className:"w-60",children:[e.jsxs(j,{disabled:u==="",onClick:()=>{B(async()=>{await Z(u),ce("")},s=>{q("Cut",s)})},children:[e.jsx(ls,{})," Cut",e.jsx(_,{children:e.jsx(H,{tokens:["mod","X"]})})]}),e.jsxs(j,{disabled:u==="",onClick:()=>{B(()=>Z(u),s=>{q("Copy",s)})},children:[e.jsx(ve,{})," Copy",e.jsx(_,{children:e.jsx(H,{tokens:["mod","C"]})})]}),e.jsxs(j,{onClick:()=>Te(),children:[e.jsx(ze,{})," Paste",e.jsx(_,{children:e.jsx(H,{tokens:["mod","V"]})})]}),e.jsxs(j,{disabled:u.trim()==="",onClick:()=>O(u),children:[e.jsx(re,{})," Find references"]}),e.jsxs(j,{disabled:u==="",onClick:()=>{f&&k({path:ae,startLine:f.startLine,endLine:f.endLine,anchorText:u.slice(0,2e3)})},children:[e.jsx(E,{})," Add comment"]}),e.jsx(ee,{}),e.jsxs(j,{onClick:()=>k({path:ae}),children:[e.jsx(E,{})," Comment on file"]}),e.jsxs(j,{onClick:()=>{K()},children:[e.jsx(Ce,{})," Copy path"]}),e.jsxs(j,{onClick:()=>{V()},children:[e.jsx(we,{})," Copy relative path"]}),v&&e.jsxs(j,{onClick:()=>{G()},children:[e.jsx(ke,{})," Reveal in Finder"]})]})]}),e.jsx(oe,{anchor:m,open:m!==null,onOpenChange:s=>{s||k(null)}})]})}function fs({content:t,onClose:r,onMatchLine:n}){const[i,a]=o.useState(""),[d,p]=o.useState(0),g=o.useRef(null),x=o.useMemo(()=>{const c=i.toLowerCase();if(c==="")return[];const w=[];return t.split(`
|
|
3
3
|
`).forEach((m,k)=>{m.toLowerCase().includes(c)&&w.push(k+1)}),w},[t,i]),u=x.length===0?0:(d%x.length+x.length)%x.length,C=x.length===0?void 0:x[u];return o.useEffect(()=>{n(C)},[C,n]),o.useEffect(()=>{g.current?.focus()},[]),e.jsxs("div",{className:"absolute right-3 top-3 z-30 flex items-center gap-1 rounded-lg border bg-popover px-2 py-1 shadow-lg",children:[e.jsx(re,{className:"size-3.5 shrink-0 text-muted-foreground"}),e.jsx(He,{ref:g,value:i,onChange:c=>{a(c.target.value),p(0)},onKeyDown:c=>{c.key==="Escape"&&r(),c.key==="Enter"&&p(w=>w+(c.shiftKey?-1:1))},placeholder:"Find in file…","aria-label":"Find in file",className:"h-6 max-w-64 border-none bg-transparent text-xs shadow-none focus-visible:ring-0"}),e.jsx("span",{className:"shrink-0 text-2xs text-muted-foreground tabular-nums",children:i===""?"":x.length===0?"No results":`${u+1}/${x.length}`}),e.jsx(D,{variant:"ghost",size:"icon-xs",disabled:x.length===0,onClick:()=>p(c=>c-1),"aria-label":"Previous match",children:e.jsx(De,{})}),e.jsx(D,{variant:"ghost",size:"icon-xs",disabled:x.length===0,onClick:()=>p(c=>c+1),"aria-label":"Next match",children:e.jsx(Oe,{})}),e.jsx(D,{variant:"ghost",size:"icon-xs",onClick:r,"aria-label":"Close find bar",children:e.jsx(Ke,{})})]})}function de({path:t,children:r}){const[n,i]=o.useState(""),[a,d]=o.useState(null),[p,g]=o.useState(null),x=te()??void 0,{copyPath:u,copyRelativePath:C,reveal:c,findReferences:w}=me(t),m=fe(),k=ne(x,t);return e.jsxs(e.Fragment,{children:[e.jsxs(he,{onOpenChange:f=>{if(!f){d(null);return}i(window.getSelection()?.toString()??"")},children:[e.jsx(pe,{className:"block h-full select-text",onContextMenu:f=>{const N=ns();if(N){d(N);return}const b=f.target.closest("[data-line]"),L=b?Number.parseInt(b.getAttribute("data-line")??"",10):Number.NaN;d(Number.isFinite(L)?{startLine:L,endLine:L,text:""}:null)},children:r}),e.jsx(ge,{className:"w-56",children:n!==""?e.jsxs(e.Fragment,{children:[e.jsxs(j,{onClick:()=>{B(()=>Z(n),f=>{q("Copy",f)})},children:[e.jsx(ve,{})," Copy",e.jsx(_,{children:e.jsx(H,{tokens:["mod","C"]})})]}),e.jsxs(j,{disabled:n.trim()==="",onClick:()=>w(n),children:[e.jsx(re,{})," Find references"]}),a&&e.jsxs(j,{onClick:()=>g({path:k,startLine:a.startLine,endLine:a.endLine,anchorText:a.text.slice(0,2e3)}),children:[e.jsx(E,{})," Add comment"]})]}):e.jsxs(e.Fragment,{children:[a?e.jsxs(j,{onClick:()=>g({path:k,startLine:a.startLine,endLine:a.endLine}),children:[e.jsx(E,{})," Add comment"]}):e.jsxs(j,{onClick:()=>g({path:k}),children:[e.jsx(E,{})," Comment on file"]}),e.jsx(ee,{}),e.jsxs(j,{onClick:()=>{u()},children:[e.jsx(Ce,{})," Copy path"]}),e.jsxs(j,{onClick:()=>{C()},children:[e.jsx(we,{})," Copy relative path"]}),m&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{}),e.jsxs(j,{onClick:()=>{c()},children:[e.jsx(ke,{})," Reveal in Finder"]})]})]})})]}),e.jsx(oe,{anchor:p,open:p!==null,onOpenChange:f=>{f||g(null)}})]})}function hs({path:t,content:r,highlightLine:n,highlightRanges:i,commentsByLine:a}){const d=ue(t),p=r.split(`
|
|
4
4
|
`),g=xe(r,d);return e.jsx(as,{rows:p,className:"px-4 py-2 leading-5",scrollToLine:n,renderRow:(x,u)=>{const C=u+1,c=a?.get(C),w=je(c),m=!w&&Se(C,i);return e.jsxs("div",{"data-line":C,className:F("relative flex",!w&&C===n&&"bg-primary/15",w,m&&"border-l-2 border-l-diff-add bg-diff-add/10"),children:[e.jsx(Ve,{comments:c}),e.jsx("span",{className:"w-10 shrink-0 select-none pr-3 text-right text-muted-foreground/50",children:C}),e.jsx(be,{tokens:g?.[u]??null,text:x})]})}})}function ps(){const t=R(n=>n.markdownMode),r=R(n=>n.setMarkdownMode);return e.jsxs(ye,{value:[t],onValueChange:n=>{const i=n[0];(i==="reader"||i==="source")&&r(i)},children:[e.jsx(U,{value:"reader",size:"sm",children:"Reader"}),e.jsx(U,{value:"source",size:"sm",children:"Source"})]})}function js(){const t=R(n=>n.htmlMode)??"preview",r=R(n=>n.setHtmlMode);return e.jsxs(ye,{value:[t],onValueChange:n=>{const i=n[0];(i==="preview"||i==="source")&&r(i)},children:[e.jsx(U,{value:"preview",size:"sm",children:"Preview"}),e.jsx(U,{value:"source",size:"sm",children:"Source"})]})}function gs({path:t,content:r,line:n,highlightRanges:i,paneIndex:a}){const d=te()??void 0,p=R(v=>v.markdownMode),g=R(v=>v.htmlMode)??"preview",[x,u]=o.useState(!1),[C,c]=o.useState(void 0),[w,m]=o.useState(null),[k,f]=o.useState(null),N=ne(d,t),b=_e(N),L=Je(t),S=Ze(t),T=L&&p==="reader",M=S&&g==="preview",{html:P,error:O}=Be(t,M),K=qe(t,M&&P!==null),V=r.split(`
|