@manojkmfsi/monodog 1.1.48 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/setup.js CHANGED
File without changes
@@ -0,0 +1,58 @@
1
+ # Monodog: Monorepo Health Dashboard (Frontend)
2
+
3
+ ## 🎯 Overview
4
+
5
+ This is the **client-side application** designed to consume data from the **Monorepo Analytics and Health API** backend service.
6
+ It provides a **real-time, visual dashboard** for tracking the health, dependencies, and overall status of all packages within the monorepo.
7
+
8
+ ---
9
+
10
+ ## 🛠 Technology Stack
11
+
12
+ | Component | Technology | Description |
13
+ | ----------------- | ----------------------------- | --------------------------------------------------------------------- |
14
+ | **Framework** | React (Functional Components) | Core library for building the user interface. |
15
+ | **Styling** | Tailwind CSS | Utility-first framework for responsive, modern, and aesthetic design. |
16
+ | **Data Fetching** | Fetch API (Native JavaScript) | Handles communication with the backend Express API. |
17
+ | **Icons** | Lucide React | Simple, clean vector icons for visualization. |
18
+
19
+ ---
20
+
21
+ ## ⚙️ Prerequisites
22
+
23
+ To run this application, ensure the following:
24
+
25
+ - **Node.js** and a package manager (`npm`, `yarn`, or `pnpm`) are installed.
26
+ - The **Monorepo Analytics API** backend service is running and accessible.
27
+ - Default backend URL: **http://localhost:8999**
28
+
29
+ ---
30
+
31
+ ## API Connection Details
32
+
33
+ The dashboard connects to the backend API using the following base URL:
34
+
35
+ ```javascript
36
+ const API_BASE_URL = 'http://localhost:8999/api';
37
+ ```
38
+
39
+ ## Getting Started
40
+
41
+ ### Installation
42
+
43
+ Clone the repository and install the dependencies:
44
+
45
+ ```bash
46
+ # Clone the repository
47
+ git clone https://github.com/mindfiredigital/MonoDog.git
48
+ cd packages/monoapp/monodog-dashboard
49
+
50
+ # Install dependencies
51
+ npm install
52
+
53
+ # build
54
+ npm run build
55
+
56
+ # run dashboard
57
+ npm run dev
58
+ ```
@@ -14,7 +14,7 @@ Error generating stack: `+f.message+`
14
14
 
15
15
  `+r.mark.snippet),i+" "+l):i}function Ea(r,s){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=s,this.message=bh(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ea.prototype=Object.create(Error.prototype);Ea.prototype.constructor=Ea;Ea.prototype.toString=function(s){return this.name+": "+bh(this,s)};var Ir=Ea,V1=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],W1=["scalar","sequence","mapping"];function G1(r){var s={};return r!==null&&Object.keys(r).forEach(function(l){r[l].forEach(function(i){s[String(i)]=l})}),s}function K1(r,s){if(s=s||{},Object.keys(s).forEach(function(l){if(V1.indexOf(l)===-1)throw new Ir('Unknown option "'+l+'" is met in definition of "'+r+'" YAML type.')}),this.options=s,this.tag=r,this.kind=s.kind||null,this.resolve=s.resolve||function(){return!0},this.construct=s.construct||function(l){return l},this.instanceOf=s.instanceOf||null,this.predicate=s.predicate||null,this.represent=s.represent||null,this.representName=s.representName||null,this.defaultStyle=s.defaultStyle||null,this.multi=s.multi||!1,this.styleAliases=G1(s.styleAliases||null),W1.indexOf(this.kind)===-1)throw new Ir('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}var xt=K1;function uf(r,s){var l=[];return r[s].forEach(function(i){var c=l.length;l.forEach(function(d,m){d.tag===i.tag&&d.kind===i.kind&&d.multi===i.multi&&(c=m)}),l[c]=i}),l}function q1(){var r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},s,l;function i(c){c.multi?(r.multi[c.kind].push(c),r.multi.fallback.push(c)):r[c.kind][c.tag]=r.fallback[c.tag]=c}for(s=0,l=arguments.length;s<l;s+=1)arguments[s].forEach(i);return r}function wc(r){return this.extend(r)}wc.prototype.extend=function(s){var l=[],i=[];if(s instanceof xt)i.push(s);else if(Array.isArray(s))i=i.concat(s);else if(s&&(Array.isArray(s.implicit)||Array.isArray(s.explicit)))s.implicit&&(l=l.concat(s.implicit)),s.explicit&&(i=i.concat(s.explicit));else throw new Ir("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");l.forEach(function(d){if(!(d instanceof xt))throw new Ir("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(d.loadKind&&d.loadKind!=="scalar")throw new Ir("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(d.multi)throw new Ir("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(d){if(!(d instanceof xt))throw new Ir("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var c=Object.create(wc.prototype);return c.implicit=(this.implicit||[]).concat(l),c.explicit=(this.explicit||[]).concat(i),c.compiledImplicit=uf(c,"implicit"),c.compiledExplicit=uf(c,"explicit"),c.compiledTypeMap=q1(c.compiledImplicit,c.compiledExplicit),c};var Y1=wc,Q1=new xt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}}),J1=new xt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}}),X1=new xt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}}),Z1=new Y1({explicit:[Q1,J1,X1]});function ej(r){if(r===null)return!0;var s=r.length;return s===1&&r==="~"||s===4&&(r==="null"||r==="Null"||r==="NULL")}function tj(){return null}function nj(r){return r===null}var rj=new xt("tag:yaml.org,2002:null",{kind:"scalar",resolve:ej,construct:tj,predicate:nj,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function sj(r){if(r===null)return!1;var s=r.length;return s===4&&(r==="true"||r==="True"||r==="TRUE")||s===5&&(r==="false"||r==="False"||r==="FALSE")}function aj(r){return r==="true"||r==="True"||r==="TRUE"}function lj(r){return Object.prototype.toString.call(r)==="[object Boolean]"}var ij=new xt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:sj,construct:aj,predicate:lj,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"});function oj(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function cj(r){return 48<=r&&r<=55}function uj(r){return 48<=r&&r<=57}function dj(r){if(r===null)return!1;var s=r.length,l=0,i=!1,c;if(!s)return!1;if(c=r[l],(c==="-"||c==="+")&&(c=r[++l]),c==="0"){if(l+1===s)return!0;if(c=r[++l],c==="b"){for(l++;l<s;l++)if(c=r[l],c!=="_"){if(c!=="0"&&c!=="1")return!1;i=!0}return i&&c!=="_"}if(c==="x"){for(l++;l<s;l++)if(c=r[l],c!=="_"){if(!oj(r.charCodeAt(l)))return!1;i=!0}return i&&c!=="_"}if(c==="o"){for(l++;l<s;l++)if(c=r[l],c!=="_"){if(!cj(r.charCodeAt(l)))return!1;i=!0}return i&&c!=="_"}}if(c==="_")return!1;for(;l<s;l++)if(c=r[l],c!=="_"){if(!uj(r.charCodeAt(l)))return!1;i=!0}return!(!i||c==="_")}function mj(r){var s=r,l=1,i;if(s.indexOf("_")!==-1&&(s=s.replace(/_/g,"")),i=s[0],(i==="-"||i==="+")&&(i==="-"&&(l=-1),s=s.slice(1),i=s[0]),s==="0")return 0;if(i==="0"){if(s[1]==="b")return l*parseInt(s.slice(2),2);if(s[1]==="x")return l*parseInt(s.slice(2),16);if(s[1]==="o")return l*parseInt(s.slice(2),8)}return l*parseInt(s,10)}function fj(r){return Object.prototype.toString.call(r)==="[object Number]"&&r%1===0&&!Wc.isNegativeZero(r)}var hj=new xt("tag:yaml.org,2002:int",{kind:"scalar",resolve:dj,construct:mj,predicate:fj,represent:{binary:function(r){return r>=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0o"+r.toString(8):"-0o"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),pj=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function xj(r){return!(r===null||!pj.test(r)||r[r.length-1]==="_")}function gj(r){var s,l;return s=r.replace(/_/g,"").toLowerCase(),l=s[0]==="-"?-1:1,"+-".indexOf(s[0])>=0&&(s=s.slice(1)),s===".inf"?l===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:s===".nan"?NaN:l*parseFloat(s,10)}var yj=/^[-+]?[0-9]+e/;function vj(r,s){var l;if(isNaN(r))switch(s){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(s){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(s){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Wc.isNegativeZero(r))return"-0.0";return l=r.toString(10),yj.test(l)?l.replace("e",".e"):l}function jj(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||Wc.isNegativeZero(r))}var wj=new xt("tag:yaml.org,2002:float",{kind:"scalar",resolve:xj,construct:gj,predicate:jj,represent:vj,defaultStyle:"lowercase"}),Nj=Z1.extend({implicit:[rj,ij,hj,wj]}),bj=Nj,Sh=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),kh=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Sj(r){return r===null?!1:Sh.exec(r)!==null||kh.exec(r)!==null}function kj(r){var s,l,i,c,d,m,p,h=0,g=null,v,y,C;if(s=Sh.exec(r),s===null&&(s=kh.exec(r)),s===null)throw new Error("Date resolve error");if(l=+s[1],i=+s[2]-1,c=+s[3],!s[4])return new Date(Date.UTC(l,i,c));if(d=+s[4],m=+s[5],p=+s[6],s[7]){for(h=s[7].slice(0,3);h.length<3;)h+="0";h=+h}return s[9]&&(v=+s[10],y=+(s[11]||0),g=(v*60+y)*6e4,s[9]==="-"&&(g=-g)),C=new Date(Date.UTC(l,i,c,d,m,p,h)),g&&C.setTime(C.getTime()-g),C}function Ej(r){return r.toISOString()}var Cj=new xt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Sj,construct:kj,instanceOf:Date,represent:Ej});function _j(r){return r==="<<"||r===null}var Tj=new xt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:_j}),Gc=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
16
16
  \r`;function Rj(r){if(r===null)return!1;var s,l,i=0,c=r.length,d=Gc;for(l=0;l<c;l++)if(s=d.indexOf(r.charAt(l)),!(s>64)){if(s<0)return!1;i+=6}return i%8===0}function Aj(r){var s,l,i=r.replace(/[\r\n=]/g,""),c=i.length,d=Gc,m=0,p=[];for(s=0;s<c;s++)s%4===0&&s&&(p.push(m>>16&255),p.push(m>>8&255),p.push(m&255)),m=m<<6|d.indexOf(i.charAt(s));return l=c%4*6,l===0?(p.push(m>>16&255),p.push(m>>8&255),p.push(m&255)):l===18?(p.push(m>>10&255),p.push(m>>2&255)):l===12&&p.push(m>>4&255),new Uint8Array(p)}function Pj(r){var s="",l=0,i,c,d=r.length,m=Gc;for(i=0;i<d;i++)i%3===0&&i&&(s+=m[l>>18&63],s+=m[l>>12&63],s+=m[l>>6&63],s+=m[l&63]),l=(l<<8)+r[i];return c=d%3,c===0?(s+=m[l>>18&63],s+=m[l>>12&63],s+=m[l>>6&63],s+=m[l&63]):c===2?(s+=m[l>>10&63],s+=m[l>>4&63],s+=m[l<<2&63],s+=m[64]):c===1&&(s+=m[l>>2&63],s+=m[l<<4&63],s+=m[64],s+=m[64]),s}function Lj(r){return Object.prototype.toString.call(r)==="[object Uint8Array]"}var Oj=new xt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Rj,construct:Aj,predicate:Lj,represent:Pj}),Ij=Object.prototype.hasOwnProperty,Mj=Object.prototype.toString;function Dj(r){if(r===null)return!0;var s=[],l,i,c,d,m,p=r;for(l=0,i=p.length;l<i;l+=1){if(c=p[l],m=!1,Mj.call(c)!=="[object Object]")return!1;for(d in c)if(Ij.call(c,d))if(!m)m=!0;else return!1;if(!m)return!1;if(s.indexOf(d)===-1)s.push(d);else return!1}return!0}function Fj(r){return r!==null?r:[]}var Uj=new xt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Dj,construct:Fj}),Bj=Object.prototype.toString;function zj(r){if(r===null)return!0;var s,l,i,c,d,m=r;for(d=new Array(m.length),s=0,l=m.length;s<l;s+=1){if(i=m[s],Bj.call(i)!=="[object Object]"||(c=Object.keys(i),c.length!==1))return!1;d[s]=[c[0],i[c[0]]]}return!0}function Hj(r){if(r===null)return[];var s,l,i,c,d,m=r;for(d=new Array(m.length),s=0,l=m.length;s<l;s+=1)i=m[s],c=Object.keys(i),d[s]=[c[0],i[c[0]]];return d}var $j=new xt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:zj,construct:Hj}),Vj=Object.prototype.hasOwnProperty;function Wj(r){if(r===null)return!0;var s,l=r;for(s in l)if(Vj.call(l,s)&&l[s]!==null)return!1;return!0}function Gj(r){return r!==null?r:{}}var Kj=new xt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Wj,construct:Gj});bj.extend({implicit:[Cj,Tj],explicit:[Oj,Uj,$j,Kj]});function df(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?`
17
- `:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"…":r===95?" ":r===76?"\u2028":r===80?"\u2029":""}var qj=new Array(256),Yj=new Array(256);for(var gs=0;gs<256;gs++)qj[gs]=df(gs)?1:0,Yj[gs]=df(gs);const Qj=r=>{switch(r){case"workspace":return"bg-blue-100 text-blue-800";case"package":return"bg-green-100 text-green-800";case"environment":return"bg-purple-100 text-purple-800";case"tool":return"bg-orange-100 text-orange-800";default:return"bg-gray-100 text-gray-800"}},mf=r=>{switch(r){case"valid":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"error":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},Jj=(r,s)=>r.filter(l=>{const i=s.section==="all"||l.id===s.section,c=s.type==="all"||l.type===s.type,d=s.status==="all"||s.status==="secrets"&&l.hasSecrets||s.status==="standard"&&!l.hasSecrets,m=!s.search||l.name.toLowerCase().includes(s.search.toLowerCase())||l.path.toLowerCase().includes(s.search.toLowerCase());return i&&c&&d&&m}),Xj=r=>[...new Set(r.map(s=>s.type))],Zj=r=>{if(r===0)return"0 Bytes";const s=1024,l=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(r)/Math.log(s));return parseFloat((r/Math.pow(s,i)).toFixed(2))+" "+l[i]},e2=r=>new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Eh=r=>{const s=r.split(".").pop()?.toLowerCase(),l={json:"json",yaml:"yaml",yml:"yaml",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",env:"env",config:"text",rc:"text",lock:"text",md:"markdown",txt:"text"};return r==="package.json"?"json":r==="docker-compose.yml"||r==="docker-compose.yaml"?"yaml":r===".eslintrc.js"||r===".prettierrc.js"?"javascript":r==="tsconfig.json"?"json":l[s||""]||"text"},t2=r=>{const s=[/^([A-Z_]+(?:PASSWORD|SECRET|KEY|TOKEN|AUTH)[A-Z_]*)\s*=\s*(.+)$/gim,/"([^"]*(?:password|secret|key|token|auth)[^"]*)"\s*:\s*"([^"]+)"/gi,/^(\s*[^:\s]*(?:password|secret|key|token|auth)[^:\s]*)\s*:\s*(.+)$/gim];let l=r;return s.forEach(i=>{l=l.replace(i,(c,d,m)=>{const p="*".repeat(Math.min(m.length,8));return c.replace(m,p)})}),l},n2=r=>{switch(Eh(r)){case"json":return t.jsx(Zl,{className:"w-6 h-6 text-primary-600"});case"yaml":return t.jsx(Zl,{className:"w-6 h-6 text-primary-600"});case"javascript":case"typescript":return t.jsx(Ur,{className:"w-6 h-6 text-primary-600"});case"env":return"🔐";case"markdown":return"📝";default:return t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}};function r2({configs:r,selectedConfig:s,onConfigSelect:l,filters:i,onFiltersChange:c}){const d=Xj(r);return t.jsxs("div",{className:"bg-white rounded-lg shadow border h-full flex flex-col max-h-[calc(100vh-180px)]",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Configuration Files"}),t.jsxs("div",{className:"relative mb-4",children:[t.jsx(Dc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),t.jsx("input",{type:"text",placeholder:"Search config files...",value:i.search,onChange:m=>c({...i,search:m.target.value}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(ci,{className:"h-4 w-4 text-gray-400"}),t.jsxs("select",{value:i.type,onChange:m=>c({...i,type:m.target.value}),className:"flex-1 border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[t.jsx("option",{value:"all",children:"All Types"}),d.map(m=>t.jsx("option",{value:m,children:m.charAt(0).toUpperCase()+m.slice(1)},m))]})]}),t.jsxs("select",{value:i.status,onChange:m=>c({...i,status:m.target.value}),className:"w-full border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[t.jsx("option",{value:"all",children:"All Files"}),t.jsx("option",{value:"standard",children:"Standard Files"}),t.jsx("option",{value:"secrets",children:"Files with Secrets"})]})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:r.length===0?t.jsxs("div",{className:"p-4 text-center text-gray-500",children:[t.jsx("div",{className:"text-4xl mb-2",children:t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}),t.jsx("p",{className:"text-sm",children:"No configuration files found"})]}):t.jsx("div",{className:"p-2",children:r.map(m=>t.jsx("button",{onClick:()=>l(m.id),className:`w-full text-left p-3 rounded-lg mb-2 transition-colors ${s===m.id?"bg-blue-50 border border-blue-200":"hover:bg-gray-50 border border-transparent"}`,children:t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"text-2xl",children:n2(m.name)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:m.name}),m.hasSecrets&&t.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"🔒"})]}),t.jsx("p",{className:"text-xs text-gray-500 truncate mb-1",children:m.path}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:`inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${Qj(m.type)}`,children:m.type}),t.jsx("span",{className:"text-xs text-gray-400",children:Zj(m.size)})]}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:e2(m.lastModified)})]})]})},m.id))})}),t.jsx("div",{className:"p-4 border-t border-gray-200",children:t.jsxs("div",{className:"text-xs text-gray-500",children:[r.length," file",r.length!==1?"s":""," found"]})})]})}function s2({isEditing:r,canEdit:s,hasSecrets:l,showSecrets:i,saving:c,onStartEdit:d,onSaveEdit:m,onCancelEdit:p,onToggleSecrets:h,onRefresh:g,content:v}){const[y,C]=w.useState(!1),F=async()=>{try{const N=v||"No content available";await navigator.clipboard.writeText(N),C(!0),setTimeout(()=>{C(!1)},4e3)}catch(N){console.error("Failed to copy to clipboard:",N),C(!0),setTimeout(()=>C(!1),2e3)}};return c?t.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 border-b border-gray-200",children:[t.jsx("div",{className:"flex items-center space-x-2",children:t.jsxs("div",{className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-orange-600 bg-white border border-gray-300 rounded-lg",children:[t.jsx(fr,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]})}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsxs("button",{onClick:g,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(fr,{className:"w-4 h-4 mr-1"}),"Refresh"]})})]}):t.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 border-b border-gray-200",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[r?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:m,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700 transition-colors",children:[t.jsx(ai,{className:"w-4 h-4 mr-1"}),"Save"]}),t.jsxs("button",{onClick:p,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(Ss,{className:"w-4 h-4 mr-1"}),"Cancel"]})]}):s&&t.jsxs("button",{onClick:d,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(Ox,{className:"w-4 h-4 mr-1"}),"Edit"]}),l&&t.jsx("button",{onClick:h,className:`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${i?"text-red-700 bg-red-100 hover:bg-red-200":"text-yellow-700 bg-yellow-100 hover:bg-yellow-200"}`,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Lx,{className:"w-4 h-4 mr-1"}),"Hide Secrets"]}):t.jsxs(t.Fragment,{children:[t.jsx(Px,{className:"w-4 h-4 mr-1"}),"Show Secrets"]})})]}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsx("button",{onClick:F,className:`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${y?"text-green-700 bg-green-100 border border-green-300":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50"}`,children:y?t.jsxs(t.Fragment,{children:[t.jsx(Fx,{className:"w-4 h-4 mr-1"}),"Copied!"]}):t.jsxs(t.Fragment,{children:[t.jsx(Ux,{className:"w-4 h-4 mr-1"}),"Copy"]})})})]})}function a2({config:r,isEditing:s,editValue:l,onStartEdit:i,onSaveEdit:c,onCancelEdit:d,onValueChange:m,showSecrets:p,onToggleSecrets:h}){if(!r)return t.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 rounded-lg",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:t.jsx(Zl,{className:"w-6 h-6 text-primary-600"})}),t.jsx("p",{className:"text-gray-500",children:"Select a configuration file to view or edit"})]})});const g=Eh(r.name),v=p?r.content:t2(r.content);return t.jsxs("div",{className:"bg-white rounded-lg shadow border h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200",children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"text-2xl",children:t.jsx(Zl,{className:"w-6 h-6 text-primary-600"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900",children:r.name}),t.jsx("p",{className:"text-sm text-gray-500",children:r.path})]})]})}),t.jsx("div",{className:"flex-1 p-4",children:s?t.jsx("div",{className:"h-full",children:t.jsx("textarea",{value:l,onChange:y=>m(y.target.value),className:"w-full h-full font-mono text-sm border border-gray-300 rounded-lg p-4 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",placeholder:"Enter configuration content...",spellCheck:!1})}):t.jsx("div",{className:"h-full",children:t.jsx("pre",{className:"w-full h-full font-mono text-sm bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto whitespace-pre-wrap",children:t.jsx("code",{className:`language-${g}`,children:v})})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500",children:[t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("span",{children:["Language: ",g.toUpperCase()]}),t.jsxs("span",{children:["Size: ",r.content.length," characters"]}),r.hasSecrets&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:"🔒 Contains secrets"})]}),t.jsx("div",{children:s?t.jsx("span",{className:"text-blue-600 font-medium",children:"Editing mode"}):r.isEditable?t.jsx("span",{className:"text-green-600",children:"Editable"}):t.jsx("span",{className:"text-gray-400",children:"Read-only"})})]})})]})}function l2({validation:r,configName:s}){const l=h=>{switch(h){case"valid":return t.jsx(At,{className:"w-5 h-5 text-green-500"});case"warning":return t.jsx(lt,{className:"w-5 h-5 text-yellow-500"});case"error":return t.jsx(Dt,{className:"w-5 h-5 text-red-500"});default:return t.jsx(vs,{className:"w-5 h-5 text-gray-500"})}},c=r.some(h=>h.status==="error")?"error":r.some(h=>h.status==="warning")?"warning":"valid",d=r.filter(h=>h.status==="error").length,m=r.filter(h=>h.status==="warning").length,p=r.filter(h=>h.status==="valid").length;return r.length===0?t.jsx("div",{className:"bg-white rounded-lg shadow border p-6",children:t.jsxs("div",{className:"text-center",children:[t.jsx(vs,{className:"w-8 h-8 text-gray-400 mx-auto mb-2"}),t.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Validation Results"}),t.jsx("p",{className:"text-sm text-gray-500",children:"Select a configuration file to see validation results."})]})}):t.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Validation Results"}),t.jsxs("div",{className:"flex items-center space-x-2",children:[l(c),t.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${mf(c)}`,children:c.toUpperCase()})]})]}),t.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Validation results for ",s]})]}),t.jsx("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-green-600",children:p}),t.jsx("div",{className:"text-xs text-gray-600",children:"Valid"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-yellow-600",children:m}),t.jsx("div",{className:"text-xs text-gray-600",children:"Warnings"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-red-600",children:d}),t.jsx("div",{className:"text-xs text-gray-600",children:"Errors"})]})]})}),t.jsx("div",{className:"p-4",children:t.jsx("div",{className:"space-y-3",children:r.map((h,g)=>t.jsx("div",{className:`p-3 rounded-lg border ${h.status==="error"?"border-red-200 bg-red-50":h.status==="warning"?"border-yellow-200 bg-yellow-50":"border-green-200 bg-green-50"}`,children:t.jsxs("div",{className:"flex items-start space-x-3",children:[l(h.status),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900",children:h.field}),t.jsx("span",{className:`inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${mf(h.status)}`,children:h.status})]}),t.jsx("p",{className:"text-sm text-gray-600",children:h.message})]})]})},g))})}),(d>0||m>0)&&t.jsx("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"text-sm text-gray-600",children:[d>0&&t.jsxs("span",{className:"text-red-600 font-medium",children:[d," error",d>1?"s":""," need attention"]}),m>0&&d===0&&t.jsxs("span",{className:"text-yellow-600 font-medium",children:[m," warning",m>1?"s":""," to review"]})]}),t.jsx("button",{className:"text-blue-600 hover:text-blue-500 text-sm font-medium",children:"View Details"})]})})]})}function i2(){const[r,s]=w.useState(!0),[l,i]=w.useState(!1),[c,d]=w.useState(null),[m,p]=w.useState([]),[h,g]=w.useState(null),[v,y]=w.useState(!1),[C,F]=w.useState(""),[N,_]=w.useState(!1),[b,U]=w.useState({section:"all",type:"all",status:"all",search:""});w.useEffect(()=>{(async()=>{try{s(!0);const me=(await Ft.getConfigurationFiles()).map(ve=>({id:ve.id||ve.name,name:ve.name,path:ve.path||ve.name,type:ve.type||"text",content:ve.content||"",size:ve.content?.length||0,lastModified:ve.lastModified||new Date().toISOString(),hasSecrets:ve.hasSecrets||!1,isEditable:ve.isEditable!==!1,validation:ve.validation||[]}));p(me),d(null)}catch(ye){d(Ce.FAILED_TO_FETCH_PACKAGES),console.error("Error fetching config files:",ye)}finally{s(!1)}})()},[]);const R=Jj(m,b),M=h&&m.find(te=>te.id===h)||null,P=()=>{window.location.reload()},W=te=>{g(te),y(!1),F("")},ae=()=>{M&&(y(!0),F(M.content))},z=async()=>{if(M&&!l)try{i(!0),d(null);const te=await Ft.saveConfigurationFile(M.id,C);p(ye=>ye.map(me=>me.id===h?{...te,isEditable:me.isEditable}:me)),h===M.id&&g(M.id),y(!1),F("")}catch(te){console.error("Error saving config file:",te),d(`${Ce.FAILED_TO_SAVE_CONFIG}: ${te.message}`)}finally{i(!1)}},oe=()=>{y(!1),F("")},xe=()=>{_(!N)},Ne=()=>{window.location.reload()};return r?t.jsx(R1,{}):c?t.jsx(A1,{error:c,onRetry:Ne}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(P1,{onRefresh:P,loading:r}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-[800px]",children:[t.jsx("div",{className:"lg:col-span-1",children:t.jsx(r2,{configs:R,selectedConfig:h,onConfigSelect:W,filters:b,onFiltersChange:U})}),t.jsxs("div",{className:"lg:col-span-2 flex flex-col",children:[M&&t.jsx("div",{className:"mb-4",children:t.jsx(s2,{isEditing:v,canEdit:M.isEditable,hasSecrets:M.hasSecrets,showSecrets:N,saving:l,onStartEdit:ae,onSaveEdit:z,onCancelEdit:oe,onToggleSecrets:xe,onRefresh:P,content:v?C:M?.content})}),t.jsx("div",{className:"flex-1",children:t.jsx(a2,{config:M,isEditing:v,editValue:C,saving:l,onStartEdit:ae,onSaveEdit:z,onCancelEdit:oe,onValueChange:F,showSecrets:N,onToggleSecrets:xe})})]}),t.jsx("div",{className:"lg:col-span-1 space-y-6",children:t.jsx(l2,{validation:M?.validation||[],configName:M?.name||"No file selected"})})]}),R.length===0&&!r&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx("div",{className:"flex justify-center text-gray-400 text-6xl mb-4",children:t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No configuration files found"}),t.jsx("p",{className:"text-gray-600 mb-4",children:b.search||b.type!=="all"||b.status!=="all"?"Try adjusting your filters to see more results.":"No configuration files are available to inspect."}),(b.search||b.type!=="all"||b.status!=="all")&&t.jsx("button",{onClick:()=>U({section:"all",type:"all",status:"all",search:""}),className:"text-blue-600 hover:text-blue-500",children:"Clear Filters"})]})]})}const Fr={async getPackages(){return we.get("/releases/packages")},async analyzeChanges(r,s){return we.post("/releases/analyze",{packageNames:r,packagePaths:s})},async checkReadiness(r,s){return we.post("/releases/check-readiness",{packageNames:r,packagePaths:s})},async prepare(r,s,l=!1){return we.post("/releases/prepare",{packageNames:r,packagePaths:s,dryRun:l})},async startPublish(r,s,l){return we.post("/releases/start",{packageNames:r,packagePaths:s,...l})},async getPipelineStatus(r){return we.get(`/releases/status/${r}`)},async getPipelineDetails(r){return we.get(`/releases/details/${r}`)},async getPipelines(r,s){const l=new URLSearchParams;r&&l.append("status",r),s&&l.append("limit",String(s));const i=l.toString();return we.get(`/releases/pipelines?${i}`)},async cancelPipeline(r){return we.post(`/releases/cancel/${r}`)},async getPackageVersions(r){return we.get(`/releases/npm/${r}/versions`)},async isVersionAvailable(r,s){return we.get(`/releases/npm/${r}/${s}/available`)},async getHealth(){return we.get("/releases/health")}};function o2({packages:r,onConfirm:s,loading:l}){const[i,c]=w.useState(new Set),[d,m]=w.useState(""),p=w.useMemo(()=>r.filter(y=>!y.private&&y.name.toLowerCase().includes(d.toLowerCase())),[r,d]),h=y=>{const C=new Set(i);C.has(y)?C.delete(y):C.add(y),c(C)},g=()=>{i.size===p.length?c(new Set):c(new Set(p.map(y=>y.name)))},v=()=>{const y=r.filter(C=>i.has(C.name));s(y)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 1: Select Packages"}),t.jsx("p",{className:"text-gray-600",children:"Choose which packages you want to release. You can select multiple packages."})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Search Packages"}),t.jsx("input",{type:"text",value:d,onChange:y=>m(y.target.value),placeholder:"Search by package name...",className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Available Packages (",p.length,")"]}),p.length>0&&t.jsx("button",{onClick:g,className:"text-sm text-primary-600 hover:text-primary-700 font-medium",children:i.size===p.length?"Deselect All":"Select All"})]}),t.jsx("div",{className:"border border-gray-200 rounded-lg divide-y max-h-96 overflow-y-auto",children:p.length===0?t.jsx("div",{className:"p-4 text-center text-gray-500",children:"No packages found"}):p.map(y=>t.jsx("div",{className:"p-4 hover:bg-gray-50 cursor-pointer transition",onClick:()=>h(y.name),children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("input",{type:"checkbox",checked:i.has(y.name),onChange:()=>h(y.name),className:"w-4 h-4 text-primary-600 rounded focus:ring-2 focus:ring-primary-500"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"font-medium text-gray-900",children:y.name}),t.jsxs("p",{className:"text-sm text-gray-500",children:["Current: v",y.version]})]}),y.dependencies&&y.dependencies.length>0&&t.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:[y.dependencies.length," deps"]})]})},y.name))})]}),t.jsx("div",{className:"flex gap-3 justify-end",children:t.jsxs("button",{onClick:v,disabled:i.size===0||l,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:["Continue (",i.size," selected)"]})})]})}const c2={major:"Breaking changes, incompatible API changes",minor:"New features, backward compatible",patch:"Bug fixes, patches, backward compatible"};function u2({packages:r,onConfirm:s,onBack:l}){const[i,c]=w.useState(r.reduce((h,g)=>({...h,[g.name]:g.bumpType}),{})),d=(h,g)=>{const v=h.split(".").map(Number);return g==="major"?`${v[0]+1}.0.0`:g==="minor"?`${v[0]}.${v[1]+1}.0`:`${v[0]}.${v[1]}.${v[2]+1}`},m=(h,g)=>{c(v=>({...v,[h]:g}))},p=()=>{const h=r.map(g=>({...g,bumpType:i[g.name],newVersion:d(g.currentVersion,i[g.name])}));s(h)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 2: Select Version Bumps"}),t.jsx("p",{className:"text-gray-600",children:"Choose the version bump type for each package. This determines the new version number."})]}),t.jsx("div",{className:"grid grid-cols-3 gap-4",children:Object.entries(c2).map(([h,g])=>t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[t.jsx("p",{className:"font-medium text-gray-900 capitalize mb-1",children:h}),t.jsx("p",{className:"text-sm text-gray-600",children:g})]},h))}),t.jsx("div",{className:"space-y-4",children:r.map(h=>t.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:h.name}),t.jsxs("p",{className:"text-sm text-gray-500",children:["Current: v",h.currentVersion]})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-sm text-gray-500",children:"New Version:"}),t.jsxs("p",{className:"text-lg font-bold text-primary-600",children:["v",d(h.currentVersion,i[h.name])]})]})]}),t.jsx("div",{className:"grid grid-cols-3 gap-3",children:["major","minor","patch"].map(g=>t.jsx("button",{onClick:()=>m(h.name,g),className:`p-3 rounded-lg border-2 transition font-medium text-sm ${i[h.name]===g?"border-primary-600 bg-primary-50 text-primary-700":"border-gray-200 bg-white text-gray-700 hover:border-gray-300"}`,children:t.jsx("span",{className:"capitalize",children:g})},g))}),h.affectedDependencies.length>0&&t.jsxs("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:[t.jsxs("p",{className:"text-sm font-medium text-blue-900",children:["ℹ️ ",h.affectedDependencies.length," dependent package(s)"]}),t.jsx("p",{className:"text-xs text-blue-700 mt-1",children:"Will be auto-bumped when this package is released"})]})]},h.name))}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:l,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",children:"Back"}),t.jsx("button",{onClick:p,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition",children:"Continue"})]})]})}function d2({packages:r,existingChangesets:s,onConfirm:l,onBack:i,loading:c}){const[d,m]=w.useState(""),[p,h]=w.useState([]),g=()=>{const y=[];return d.trim()||y.push("Please enter a changelog summary"),d.trim().length<10&&y.push(Jx),h(y),y.length===0},v=()=>{g()&&l(d)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 3: Preview Changeset"}),t.jsx("p",{className:"text-gray-600",children:"Review the changeset that will be created. Enter a summary of the changes."})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Changelog Summary"}),t.jsx("textarea",{value:d,onChange:y=>{m(y.target.value),g()},placeholder:Qx,rows:4,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent font-mono text-sm"}),p.length>0&&t.jsx("div",{className:"mt-2 space-y-1",children:p.map((y,C)=>t.jsx("p",{className:"text-sm text-red-600",children:y},C))})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Packages to Release"}),t.jsx("div",{className:"space-y-3",children:r.map(y=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:y.name}),t.jsxs("p",{className:"flex items-center gap-2 text-sm text-gray-500",children:[y.currentVersion," ",t.jsx(wa,{})," ",y.newVersion]})]}),t.jsx("div",{className:"text-right",children:t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-primary-100 text-primary-800",children:y.bumpType.charAt(0).toUpperCase()+y.bumpType.slice(1)})})]},y.name))})]}),s.length>0&&t.jsxs("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[t.jsx("p",{className:"text-yellow-800 font-medium",children:"Unpublished Changesets"}),t.jsxs("p",{className:"text-yellow-700 text-sm mt-1",children:["There are ",s.length," existing unpublished changeset(s). Creating new ones will accumulate until published."]})]}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:i,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",disabled:c,children:"Back"}),t.jsx("button",{onClick:v,disabled:c||p.length>0,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:c?"Processing...":"Continue to Validation"})]})]})}function m2({validation:r,packages:s,onConfirm:l,onBack:i,loading:c}){const d=[{name:"User Permissions",passed:r.checks.permissions},{name:"Working Tree Clean",passed:r.checks.workingTreeClean},{name:"CI Tests Passing",passed:r.checks.ciPassing},{name:"Version Available on npm",passed:r.checks.versionAvailable}];return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 4: Validate Release"}),t.jsx("p",{className:"text-gray-600",children:"Checking if the release is safe to proceed. All checks must pass."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:`p-4 rounded-lg ${r.isValid?"bg-green-50":"bg-red-50"}`,children:[t.jsx("p",{className:`font-medium ${r.isValid?"text-green-900":"text-red-900"}`,children:r.isValid?"Ready to Release":"Not Ready"}),t.jsx("p",{className:`text-sm mt-1 ${r.isValid?"text-green-700":"text-red-700"}`,children:r.isValid?"All checks passed. Safe to proceed.":`${r.errors.length} error(s) need resolution`})]}),t.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[t.jsx("p",{className:"font-medium text-blue-900",children:"Release Summary"}),t.jsxs("p",{className:"text-sm text-blue-700 mt-1",children:[s.length," package(s) will be released"]})]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Pre-release Checks"}),t.jsx("div",{className:"space-y-3",children:d.map((m,p)=>t.jsxs("div",{className:`flex items-center space-x-3 p-3 rounded-lg ${m.passed?"bg-green-50":"bg-red-50"}`,children:[t.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center font-bold text-white p-1 ${m.passed?"bg-green-500":"bg-red-500"}`,children:m.passed?t.jsx(ai,{}):t.jsx(Ss,{})}),t.jsx("span",{className:`font-medium ${m.passed?"text-green-900":"text-red-900"}`,children:m.name})]},p))})]}),r.errors.length>0&&t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-red-900 mb-4",children:"Errors"}),t.jsx("div",{className:"space-y-2",children:r.errors.map((m,p)=>t.jsxs("p",{className:"text-red-700 text-sm",children:["• ",m]},p))})]}),r.warnings.length>0&&t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-yellow-900 mb-4",children:"Warnings"}),t.jsx("div",{className:"space-y-2",children:r.warnings.map((m,p)=>t.jsx("p",{className:"text-yellow-700 text-sm",children:m},p))})]}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:i,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",disabled:c,children:"Back"}),t.jsx("button",{onClick:l,disabled:!r.isValid||c,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:c?"Publishing...":"Confirm & Publish"})]})]})}function f2({packages:r,summary:s,onReset:l}){const i=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),t.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Release Initiated!"}),t.jsxs("p",{className:"text-gray-600 text-lg mb-4",children:["Changeset created and publishing workflow started for ",r.length," package(s)"]}),t.jsxs("p",{className:"text-gray-500 text-sm",children:["Initiated on ",i]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"What Happens Next"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"1. Changeset Created"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"A changeset has been created with your release information"})]})]}),t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"2. Publishing Workflow Started"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"GitHub Actions workflow has been triggered to publish your packages"})]})]}),t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsxs("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:[t.jsx("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),t.jsx("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"3. Monitor Progress"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"Check GitHub Actions for the workflow status and npm registry for package updates"})]})]})]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Packages Released"}),t.jsx("div",{className:"space-y-2",children:r.map(c=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:c.name}),t.jsxs("p",{className:"flex items-center gap-2 text-sm text-gray-500",children:["v",c.currentVersion," ",t.jsx(wa,{})," v",c.newVersion]})]}),t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-primary-100 text-primary-800",children:c.bumpType.charAt(0).toUpperCase()+c.bumpType.slice(1)})]},c.name))})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Changelog Summary"}),t.jsx("div",{className:"p-4 bg-gray-50 rounded-lg",children:t.jsx("p",{className:"text-gray-700 whitespace-pre-wrap",children:s})})]}),t.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Next Steps"}),t.jsxs("ul",{className:"text-sm text-blue-700 space-y-2",children:[t.jsx("li",{children:"Changeset created and committed"}),t.jsx("li",{children:"Package versions updated"}),t.jsx("li",{children:"Release pipeline triggered"}),t.jsx("li",{children:"GitHub release created (in progress)"}),t.jsx("li",{children:"npm registry will be updated shortly"})]})]}),t.jsx("div",{className:"flex gap-3 justify-center",children:t.jsx("button",{onClick:l,className:"px-8 py-3 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition",children:"Release Another Package"})}),t.jsxs("div",{className:"border-t pt-6 flex gap-4 justify-center",children:[t.jsxs("a",{href:"#",className:"flex items-center gap-2 gap-2 text-primary-600 hover:text-primary-700 font-medium text-sm",children:["View Release on GitHub ",t.jsx(wa,{})]}),t.jsxs("a",{href:"#",className:"flex items-center gap-2 gap-2 text-primary-600 hover:text-primary-700 font-medium text-sm",children:["View on npm ",t.jsx(wa,{})]})]})]})}function h2({message:r="Loading..."}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin mb-4"}),t.jsx("p",{className:"text-gray-600",children:r})]})}function p2({error:r,onRetry:s}){return t.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-6 h-6 text-red-600",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsx("h3",{className:"text-lg font-medium text-red-800",children:"Error"}),t.jsx("p",{className:"mt-2 text-sm text-red-700",children:r}),t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-lg font-medium hover:bg-red-700 transition",children:"Try Again"})]})]})})}function x2(){const{isAuthenticated:r,hasPermission:s}=zr(),[l,i]=w.useState("select"),[c,d]=w.useState([]),[m,p]=w.useState(""),[h,g]=w.useState(!1),[v,y]=w.useState(null),[C,F]=w.useState(null),[N,_]=w.useState([]),[b,U]=w.useState([]);w.useEffect(()=>{R()},[]);const R=async()=>{try{g(!0);const te=await we.get(Ae.PUBLISH.PACKAGES);if(te.success)_(te.data.packages||[]);else{console.warn("Failed to fetch packages:",te.error?.message);const me=await we.get(Ae.PACKAGES.LIST);me.success&&_(me.data||[])}const ye=await we.get(Ae.PUBLISH.CHANGESETS);ye.success?U(ye.data.changesets||[]):(ye.error?.status===401||ye.error?.status===403)&&(window.location.href="/login"),y(null)}catch(te){const ye=te instanceof Error?te.message:Ce.FAILED_TO_FETCH_PACKAGES;y(ye),console.error("Error fetching workspace data:",te)}finally{g(!1)}},M=te=>{const ye=te.map(me=>({name:me.name,currentVersion:me.version,newVersion:me.version,bumpType:"patch",affectedDependencies:me.dependents||[]}));d(ye),i("bump")},P=te=>{d(te),i("preview")},W=te=>{p(te),ae(c,te)},ae=async(te,ye)=>{try{g(!0);const me=te.map(D=>D.name),ve=me.reduce((D,Y)=>{const ue=N.find(ne=>ne.name===Y);return ue&&(D[Y]=ue.path||"./packages/"+Y.split("/").pop()),D},{}),Z=await Fr.checkReadiness(me,ve);let Q=[],X=[],B=!0;if(Z.success){const D=Z.data;B=D.canProceed!==!1,D.globalBlockers&&Array.isArray(D.globalBlockers)&&Q.push(...D.globalBlockers.map(Y=>`🚨 ${Y}`)),D.checks&&Array.isArray(D.checks)&&D.checks.forEach(Y=>{Y.blockers&&Array.isArray(Y.blockers)&&Y.blockers.forEach(ue=>{Q.push(`❌ ${Y.packageName}: ${ue}`)}),Y.warnings&&Array.isArray(Y.warnings)&&Y.warnings.forEach(ue=>{X.push(`⚠️ ${Y.packageName}: ${ue}`)})})}const J=await we.post(Ae.PUBLISH.PREVIEW,{packages:me,bumps:te.map(D=>({package:D.name,bumpType:D.bumpType})),summary:ye});if(!J.success)throw new Error(Ce.VALIDATION_FAILED);const q=J.data,S={isValid:(q.isValid??!0)&&B,errors:[...Q,...q.errors??[]],warnings:[...X,...q.warnings??[]],checks:q.checks??{permissions:!0,workingTreeClean:Q.length===0,ciPassing:!0,versionAvailable:!Q.some(D=>D.includes("already exists"))}};F(S),i("validate"),y(null)}catch(me){const ve=me instanceof Error?me.message:"Validation error";y(ve),console.error("Validation error:",me)}finally{g(!1)}},z=async()=>{try{if(C&&!C.isValid){y("Cannot proceed with publishing. Please fix validation errors and re-validate."),i("validate");return}if(!s("maintain")){y(Ce.PERMISSION_ERROR);return}g(!0);const te=c.map(Z=>Z.name),ye=te.reduce((Z,Q)=>{const X=N.find(B=>B.name===Q);return X&&(Z[Q]=X.path||"./packages/"+Q.split("/").pop()),Z},{}),me={};c.forEach(Z=>{me[Z.name]=Z.newVersion});const ve=await Fr.startPublish(te,ye,{versionMap:me,method:"node",dryRun:!1,autoTag:!0,createReleases:!0});if(!ve.success)throw new Error(ve.error?.message||"Failed to start publishing");try{await we.post(Ae.PUBLISH.CHANGESETS,{packages:te,bumps:c.map(Z=>({package:Z.name,bumpType:Z.bumpType})),summary:m})}catch(Z){console.warn("Failed to create changeset record:",Z)}i("confirm"),y(null)}catch(te){const ye=te instanceof Error?te.message:"Publishing error";y(ye)}finally{g(!1)}},oe=()=>{i("select"),d([]),p(""),F(null),y(null),R()};if(!r)return t.jsx("div",{className:"p-6 bg-yellow-50 border border-yellow-200 rounded-lg",children:t.jsx("p",{className:"text-yellow-800",children:"Please log in to access release management."})});if(h&&l==="select"&&N.length===0)return t.jsx(h2,{message:"Loading workspace packages..."});if(v&&l==="select")return t.jsx(p2,{error:v,onRetry:R});const xe=s("write"),Ne=s("maintain");return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Release Manager"}),t.jsx("p",{className:"text-gray-600 mt-1",children:"Manage package versions and publish releases with the independent release engine"})]}),t.jsxs("div",{className:"text-sm text-gray-500",children:["Step ",["select","bump","preview","validate","confirm"].indexOf(l)+1," of 5"]})]}),!xe&&t.jsxs("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[t.jsx("p",{className:"text-yellow-700 font-medium",children:" Limited Access"}),t.jsx("p",{className:"text-yellow-600 text-sm mt-1",children:"You do not have write permission to create and publish changesets. Contact your repository administrator to request access."})]}),v&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Error"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:v})]}),b.length>0&&l==="select"&&t.jsxs("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[t.jsxs("p",{className:"text-blue-700 font-medium",children:[b.length," pending release(s)"]}),t.jsx("p",{className:"text-blue-600 text-sm mt-1",children:"Pull the latest changes and refresh the dashboard to see if these have been published."})]}),l==="select"&&!xe&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Access Denied"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:"You do not have write permission to create changesets. Contact your repository administrator."})]}),l==="select"&&xe&&t.jsx(o2,{packages:N,onConfirm:M,loading:h}),l==="bump"&&xe&&t.jsx(u2,{packages:c,onConfirm:P,onBack:()=>i("select")}),l==="preview"&&xe&&t.jsx(d2,{packages:c,existingChangesets:b,onConfirm:W,onBack:()=>i("bump"),loading:h}),l==="validate"&&!Ne&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Access Denied"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:"You do not have maintain permission to publish changesets. Contact your repository administrator."})]}),l==="validate"&&Ne&&C&&t.jsx(m2,{validation:C,packages:c,onConfirm:z,onBack:()=>i("preview"),loading:h}),l==="confirm"&&t.jsx(f2,{packages:c,summary:m,onReset:oe}),t.jsx("div",{className:"flex gap-2 justify-center",children:["select","bump","preview","validate","confirm"].map((te,ye)=>t.jsx("div",{className:`h-2 flex-1 rounded-full transition-colors ${["select","bump","preview","validate","confirm"].indexOf(l)>=ye?"bg-primary-500":"bg-gray-300"}`},te))})]})}const{entries:Ch,setPrototypeOf:ff,isFrozen:g2,getPrototypeOf:y2,getOwnPropertyDescriptor:v2}=Object;let{freeze:jt,seal:Yt,create:Nc}=Object,{apply:bc,construct:Sc}=typeof Reflect<"u"&&Reflect;jt||(jt=function(s){return s});Yt||(Yt=function(s){return s});bc||(bc=function(s,l){for(var i=arguments.length,c=new Array(i>2?i-2:0),d=2;d<i;d++)c[d-2]=arguments[d];return s.apply(l,c)});Sc||(Sc=function(s){for(var l=arguments.length,i=new Array(l>1?l-1:0),c=1;c<l;c++)i[c-1]=arguments[c];return new s(...i)});const Gl=wt(Array.prototype.forEach),j2=wt(Array.prototype.lastIndexOf),hf=wt(Array.prototype.pop),xa=wt(Array.prototype.push),w2=wt(Array.prototype.splice),Jl=wt(String.prototype.toLowerCase),ac=wt(String.prototype.toString),lc=wt(String.prototype.match),ga=wt(String.prototype.replace),N2=wt(String.prototype.indexOf),b2=wt(String.prototype.trim),cn=wt(Object.prototype.hasOwnProperty),vt=wt(RegExp.prototype.test),ya=S2(TypeError);function wt(r){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var l=arguments.length,i=new Array(l>1?l-1:0),c=1;c<l;c++)i[c-1]=arguments[c];return bc(r,s,i)}}function S2(r){return function(){for(var s=arguments.length,l=new Array(s),i=0;i<s;i++)l[i]=arguments[i];return Sc(r,l)}}function Ee(r,s){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Jl;ff&&ff(r,null);let i=s.length;for(;i--;){let c=s[i];if(typeof c=="string"){const d=l(c);d!==c&&(g2(s)||(s[i]=d),c=d)}r[c]=!0}return r}function k2(r){for(let s=0;s<r.length;s++)cn(r,s)||(r[s]=null);return r}function vn(r){const s=Nc(null);for(const[l,i]of Ch(r))cn(r,l)&&(Array.isArray(i)?s[l]=k2(i):i&&typeof i=="object"&&i.constructor===Object?s[l]=vn(i):s[l]=i);return s}function va(r,s){for(;r!==null;){const i=v2(r,s);if(i){if(i.get)return wt(i.get);if(typeof i.value=="function")return wt(i.value)}r=y2(r)}function l(){return null}return l}const pf=jt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ic=jt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oc=jt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),E2=jt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cc=jt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),C2=jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xf=jt(["#text"]),gf=jt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),uc=jt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),yf=jt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kl=jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_2=Yt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),T2=Yt(/<%[\w\W]*|[\w\W]*%>/gm),R2=Yt(/\$\{[\w\W]*/gm),A2=Yt(/^data-[\-\w.\u00B7-\uFFFF]+$/),P2=Yt(/^aria-[\-\w]+$/),_h=Yt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),L2=Yt(/^(?:\w+script|data):/i),O2=Yt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Th=Yt(/^html$/i),I2=Yt(/^[a-z][.\w]*(-[.\w]+)+$/i);var vf=Object.freeze({__proto__:null,ARIA_ATTR:P2,ATTR_WHITESPACE:O2,CUSTOM_ELEMENT:I2,DATA_ATTR:A2,DOCTYPE_NAME:Th,ERB_EXPR:T2,IS_ALLOWED_URI:_h,IS_SCRIPT_OR_DATA:L2,MUSTACHE_EXPR:_2,TMPLIT_EXPR:R2});const ja={element:1,text:3,progressingInstruction:7,comment:8,document:9},M2=function(){return typeof window>"u"?null:window},D2=function(s,l){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let i=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(i=l.getAttribute(c));const d="dompurify"+(i?"#"+i:"");try{return s.createPolicy(d,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},jf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M2();const s=de=>Rh(de);if(s.version="3.3.1",s.removed=[],!r||!r.document||r.document.nodeType!==ja.document||!r.Element)return s.isSupported=!1,s;let{document:l}=r;const i=l,c=i.currentScript,{DocumentFragment:d,HTMLTemplateElement:m,Node:p,Element:h,NodeFilter:g,NamedNodeMap:v=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:C,trustedTypes:F}=r,N=h.prototype,_=va(N,"cloneNode"),b=va(N,"remove"),U=va(N,"nextSibling"),R=va(N,"childNodes"),M=va(N,"parentNode");if(typeof m=="function"){const de=l.createElement("template");de.content&&de.content.ownerDocument&&(l=de.content.ownerDocument)}let P,W="";const{implementation:ae,createNodeIterator:z,createDocumentFragment:oe,getElementsByTagName:xe}=l,{importNode:Ne}=i;let te=jf();s.isSupported=typeof Ch=="function"&&typeof M=="function"&&ae&&ae.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ye,ERB_EXPR:me,TMPLIT_EXPR:ve,DATA_ATTR:Z,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:J}=vf;let{IS_ALLOWED_URI:q}=vf,S=null;const D=Ee({},[...pf,...ic,...oc,...cc,...xf]);let Y=null;const ue=Ee({},[...gf,...uc,...yf,...Kl]);let ne=Object.seal(Nc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),be=null,Te=null;const _e=Object.seal(Nc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ie=!0,it=!0,pr=!1,Es=!0,Qt=!1,Dn=!0,dn=!1,Hr=!1,xr=!1,jn=!1,Fn=!1,mn=!1,wn=!0,$r=!1;const Oa="user-content-";let Vr=!0,Un=!1,Nn={},Nt=null;const Bn=Ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Cs=null;const zn=Ee({},["audio","video","img","source","image","track"]);let bn=null;const Ia=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gr="http://www.w3.org/1998/Math/MathML",yr="http://www.w3.org/2000/svg",Jt="http://www.w3.org/1999/xhtml";let fn=Jt,vr=!1,jr=null;const _s=Ee({},[gr,yr,Jt],ac);let Hn=Ee({},["mi","mo","mn","ms","mtext"]),Xt=Ee({},["annotation-xml"]);const $n=Ee({},["title","style","font","a","script"]);let Vn=null;const Ma=["application/xhtml+xml","text/html"],Da="text/html";let We=null,Sn=null;const Ts=l.createElement("form"),Rs=function(E){return E instanceof RegExp||E instanceof Function},kn=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sn&&Sn===E)){if((!E||typeof E!="object")&&(E={}),E=vn(E),Vn=Ma.indexOf(E.PARSER_MEDIA_TYPE)===-1?Da:E.PARSER_MEDIA_TYPE,We=Vn==="application/xhtml+xml"?ac:Jl,S=cn(E,"ALLOWED_TAGS")?Ee({},E.ALLOWED_TAGS,We):D,Y=cn(E,"ALLOWED_ATTR")?Ee({},E.ALLOWED_ATTR,We):ue,jr=cn(E,"ALLOWED_NAMESPACES")?Ee({},E.ALLOWED_NAMESPACES,ac):_s,bn=cn(E,"ADD_URI_SAFE_ATTR")?Ee(vn(Ia),E.ADD_URI_SAFE_ATTR,We):Ia,Cs=cn(E,"ADD_DATA_URI_TAGS")?Ee(vn(zn),E.ADD_DATA_URI_TAGS,We):zn,Nt=cn(E,"FORBID_CONTENTS")?Ee({},E.FORBID_CONTENTS,We):Bn,be=cn(E,"FORBID_TAGS")?Ee({},E.FORBID_TAGS,We):vn({}),Te=cn(E,"FORBID_ATTR")?Ee({},E.FORBID_ATTR,We):vn({}),Nn=cn(E,"USE_PROFILES")?E.USE_PROFILES:!1,Ie=E.ALLOW_ARIA_ATTR!==!1,it=E.ALLOW_DATA_ATTR!==!1,pr=E.ALLOW_UNKNOWN_PROTOCOLS||!1,Es=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qt=E.SAFE_FOR_TEMPLATES||!1,Dn=E.SAFE_FOR_XML!==!1,dn=E.WHOLE_DOCUMENT||!1,jn=E.RETURN_DOM||!1,Fn=E.RETURN_DOM_FRAGMENT||!1,mn=E.RETURN_TRUSTED_TYPE||!1,xr=E.FORCE_BODY||!1,wn=E.SANITIZE_DOM!==!1,$r=E.SANITIZE_NAMED_PROPS||!1,Vr=E.KEEP_CONTENT!==!1,Un=E.IN_PLACE||!1,q=E.ALLOWED_URI_REGEXP||_h,fn=E.NAMESPACE||Jt,Hn=E.MATHML_TEXT_INTEGRATION_POINTS||Hn,Xt=E.HTML_INTEGRATION_POINTS||Xt,ne=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&Rs(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&Rs(E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ne.attributeNameCheck=E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),E.CUSTOM_ELEMENT_HANDLING&&typeof E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Qt&&(it=!1),Fn&&(jn=!0),Nn&&(S=Ee({},xf),Y=[],Nn.html===!0&&(Ee(S,pf),Ee(Y,gf)),Nn.svg===!0&&(Ee(S,ic),Ee(Y,uc),Ee(Y,Kl)),Nn.svgFilters===!0&&(Ee(S,oc),Ee(Y,uc),Ee(Y,Kl)),Nn.mathMl===!0&&(Ee(S,cc),Ee(Y,yf),Ee(Y,Kl))),E.ADD_TAGS&&(typeof E.ADD_TAGS=="function"?_e.tagCheck=E.ADD_TAGS:(S===D&&(S=vn(S)),Ee(S,E.ADD_TAGS,We))),E.ADD_ATTR&&(typeof E.ADD_ATTR=="function"?_e.attributeCheck=E.ADD_ATTR:(Y===ue&&(Y=vn(Y)),Ee(Y,E.ADD_ATTR,We))),E.ADD_URI_SAFE_ATTR&&Ee(bn,E.ADD_URI_SAFE_ATTR,We),E.FORBID_CONTENTS&&(Nt===Bn&&(Nt=vn(Nt)),Ee(Nt,E.FORBID_CONTENTS,We)),E.ADD_FORBID_CONTENTS&&(Nt===Bn&&(Nt=vn(Nt)),Ee(Nt,E.ADD_FORBID_CONTENTS,We)),Vr&&(S["#text"]=!0),dn&&Ee(S,["html","head","body"]),S.table&&(Ee(S,["tbody"]),delete be.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw ya('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ya('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=E.TRUSTED_TYPES_POLICY,W=P.createHTML("")}else P===void 0&&(P=D2(F,c)),P!==null&&typeof W=="string"&&(W=P.createHTML(""));jt&&jt(E),Sn=E}},Wr=Ee({},[...ic,...oc,...E2]),Wn=Ee({},[...cc,...C2]),pi=function(E){let G=M(E);(!G||!G.tagName)&&(G={namespaceURI:fn,tagName:"template"});const le=Jl(E.tagName),Me=Jl(G.tagName);return jr[E.namespaceURI]?E.namespaceURI===yr?G.namespaceURI===Jt?le==="svg":G.namespaceURI===gr?le==="svg"&&(Me==="annotation-xml"||Hn[Me]):!!Wr[le]:E.namespaceURI===gr?G.namespaceURI===Jt?le==="math":G.namespaceURI===yr?le==="math"&&Xt[Me]:!!Wn[le]:E.namespaceURI===Jt?G.namespaceURI===yr&&!Xt[Me]||G.namespaceURI===gr&&!Hn[Me]?!1:!Wn[le]&&($n[le]||!Wr[le]):!!(Vn==="application/xhtml+xml"&&jr[E.namespaceURI]):!1},ut=function(E){xa(s.removed,{element:E});try{M(E).removeChild(E)}catch{b(E)}},Bt=function(E,G){try{xa(s.removed,{attribute:G.getAttributeNode(E),from:G})}catch{xa(s.removed,{attribute:null,from:G})}if(G.removeAttribute(E),E==="is")if(jn||Fn)try{ut(G)}catch{}else try{G.setAttribute(E,"")}catch{}},wr=function(E){let G=null,le=null;if(xr)E="<remove></remove>"+E;else{const Ge=lc(E,/^[\r\n\t ]+/);le=Ge&&Ge[0]}Vn==="application/xhtml+xml"&&fn===Jt&&(E='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+E+"</body></html>");const Me=P?P.createHTML(E):E;if(fn===Jt)try{G=new C().parseFromString(Me,Vn)}catch{}if(!G||!G.documentElement){G=ae.createDocument(fn,"template",null);try{G.documentElement.innerHTML=vr?W:Me}catch{}}const Se=G.body||G.documentElement;return E&&le&&Se.insertBefore(l.createTextNode(le),Se.childNodes[0]||null),fn===Jt?xe.call(G,dn?"html":"body")[0]:dn?G.documentElement:Se},Gr=function(E){return z.call(E.ownerDocument||E,E,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},As=function(E){return E instanceof y&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof v)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},Fa=function(E){return typeof p=="function"&&E instanceof p};function Zt(de,E,G){Gl(de,le=>{le.call(s,E,G,Sn)})}const hn=function(E){let G=null;if(Zt(te.beforeSanitizeElements,E,null),As(E))return ut(E),!0;const le=We(E.nodeName);if(Zt(te.uponSanitizeElement,E,{tagName:le,allowedTags:S}),Dn&&E.hasChildNodes()&&!Fa(E.firstElementChild)&&vt(/<[/\w!]/g,E.innerHTML)&&vt(/<[/\w!]/g,E.textContent)||E.nodeType===ja.progressingInstruction||Dn&&E.nodeType===ja.comment&&vt(/<[/\w]/g,E.data))return ut(E),!0;if(!(_e.tagCheck instanceof Function&&_e.tagCheck(le))&&(!S[le]||be[le])){if(!be[le]&&Ls(le)&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,le)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(le)))return!1;if(Vr&&!Nt[le]){const Me=M(E)||E.parentNode,Se=R(E)||E.childNodes;if(Se&&Me){const Ge=Se.length;for(let tt=Ge-1;tt>=0;--tt){const zt=_(Se[tt],!0);zt.__removalCount=(E.__removalCount||0)+1,Me.insertBefore(zt,U(E))}}}return ut(E),!0}return E instanceof h&&!pi(E)||(le==="noscript"||le==="noembed"||le==="noframes")&&vt(/<\/no(script|embed|frames)/i,E.innerHTML)?(ut(E),!0):(Qt&&E.nodeType===ja.text&&(G=E.textContent,Gl([ye,me,ve],Me=>{G=ga(G,Me," ")}),E.textContent!==G&&(xa(s.removed,{element:E.cloneNode()}),E.textContent=G)),Zt(te.afterSanitizeElements,E,null),!1)},Ps=function(E,G,le){if(wn&&(G==="id"||G==="name")&&(le in l||le in Ts))return!1;if(!(it&&!Te[G]&&vt(Z,G))){if(!(Ie&&vt(Q,G))){if(!(_e.attributeCheck instanceof Function&&_e.attributeCheck(G,E))){if(!Y[G]||Te[G]){if(!(Ls(E)&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,E)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(E))&&(ne.attributeNameCheck instanceof RegExp&&vt(ne.attributeNameCheck,G)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(G,E))||G==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,le)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(le))))return!1}else if(!bn[G]){if(!vt(q,ga(le,B,""))){if(!((G==="src"||G==="xlink:href"||G==="href")&&E!=="script"&&N2(le,"data:")===0&&Cs[E])){if(!(pr&&!vt(X,ga(le,B,"")))){if(le)return!1}}}}}}}return!0},Ls=function(E){return E!=="annotation-xml"&&lc(E,J)},Ua=function(E){Zt(te.beforeSanitizeAttributes,E,null);const{attributes:G}=E;if(!G||As(E))return;const le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Me=G.length;for(;Me--;){const Se=G[Me],{name:Ge,namespaceURI:tt,value:zt}=Se,en=We(Ge),Os=zt;let Je=Ge==="value"?Os:b2(Os);if(le.attrName=en,le.attrValue=Je,le.keepAttr=!0,le.forceKeepAttr=void 0,Zt(te.uponSanitizeAttribute,E,le),Je=le.attrValue,$r&&(en==="id"||en==="name")&&(Bt(Ge,E),Je=Oa+Je),Dn&&vt(/((--!?|])>)|<\/(style|title|textarea)/i,Je)){Bt(Ge,E);continue}if(en==="attributename"&&lc(Je,"href")){Bt(Ge,E);continue}if(le.forceKeepAttr)continue;if(!le.keepAttr){Bt(Ge,E);continue}if(!Es&&vt(/\/>/i,Je)){Bt(Ge,E);continue}Qt&&Gl([ye,me,ve],Pt=>{Je=ga(Je,Pt," ")});const Nr=We(E.nodeName);if(!Ps(Nr,en,Je)){Bt(Ge,E);continue}if(P&&typeof F=="object"&&typeof F.getAttributeType=="function"&&!tt)switch(F.getAttributeType(Nr,en)){case"TrustedHTML":{Je=P.createHTML(Je);break}case"TrustedScriptURL":{Je=P.createScriptURL(Je);break}}if(Je!==Os)try{tt?E.setAttributeNS(tt,Ge,Je):E.setAttribute(Ge,Je),As(E)?ut(E):hf(s.removed)}catch{Bt(Ge,E)}}Zt(te.afterSanitizeAttributes,E,null)},Ba=function de(E){let G=null;const le=Gr(E);for(Zt(te.beforeSanitizeShadowDOM,E,null);G=le.nextNode();)Zt(te.uponSanitizeShadowNode,G,null),hn(G),Ua(G),G.content instanceof d&&de(G.content);Zt(te.afterSanitizeShadowDOM,E,null)};return s.sanitize=function(de){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=null,le=null,Me=null,Se=null;if(vr=!de,vr&&(de="<!-->"),typeof de!="string"&&!Fa(de))if(typeof de.toString=="function"){if(de=de.toString(),typeof de!="string")throw ya("dirty is not a string, aborting")}else throw ya("toString is not a function");if(!s.isSupported)return de;if(Hr||kn(E),s.removed=[],typeof de=="string"&&(Un=!1),Un){if(de.nodeName){const zt=We(de.nodeName);if(!S[zt]||be[zt])throw ya("root node is forbidden and cannot be sanitized in-place")}}else if(de instanceof p)G=wr("<!---->"),le=G.ownerDocument.importNode(de,!0),le.nodeType===ja.element&&le.nodeName==="BODY"||le.nodeName==="HTML"?G=le:G.appendChild(le);else{if(!jn&&!Qt&&!dn&&de.indexOf("<")===-1)return P&&mn?P.createHTML(de):de;if(G=wr(de),!G)return jn?null:mn?W:""}G&&xr&&ut(G.firstChild);const Ge=Gr(Un?de:G);for(;Me=Ge.nextNode();)hn(Me),Ua(Me),Me.content instanceof d&&Ba(Me.content);if(Un)return de;if(jn){if(Fn)for(Se=oe.call(G.ownerDocument);G.firstChild;)Se.appendChild(G.firstChild);else Se=G;return(Y.shadowroot||Y.shadowrootmode)&&(Se=Ne.call(i,Se,!0)),Se}let tt=dn?G.outerHTML:G.innerHTML;return dn&&S["!doctype"]&&G.ownerDocument&&G.ownerDocument.doctype&&G.ownerDocument.doctype.name&&vt(Th,G.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+G.ownerDocument.doctype.name+`>
17
+ `:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"…":r===95?" ":r===76?"\u2028":r===80?"\u2029":""}var qj=new Array(256),Yj=new Array(256);for(var gs=0;gs<256;gs++)qj[gs]=df(gs)?1:0,Yj[gs]=df(gs);const Qj=r=>{switch(r){case"workspace":return"bg-blue-100 text-blue-800";case"package":return"bg-green-100 text-green-800";case"environment":return"bg-purple-100 text-purple-800";case"tool":return"bg-orange-100 text-orange-800";default:return"bg-gray-100 text-gray-800"}},mf=r=>{switch(r){case"valid":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"error":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},Jj=(r,s)=>r.filter(l=>{const i=s.section==="all"||l.id===s.section,c=s.type==="all"||l.type===s.type,d=s.status==="all"||s.status==="secrets"&&l.hasSecrets||s.status==="standard"&&!l.hasSecrets,m=!s.search||l.name.toLowerCase().includes(s.search.toLowerCase())||l.path.toLowerCase().includes(s.search.toLowerCase());return i&&c&&d&&m}),Xj=r=>[...new Set(r.map(s=>s.type))],Zj=r=>{if(r===0)return"0 Bytes";const s=1024,l=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(r)/Math.log(s));return parseFloat((r/Math.pow(s,i)).toFixed(2))+" "+l[i]},e2=r=>new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Eh=r=>{const s=r.split(".").pop()?.toLowerCase(),l={json:"json",yaml:"yaml",yml:"yaml",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",env:"env",config:"text",rc:"text",lock:"text",md:"markdown",txt:"text"};return r==="package.json"?"json":r==="docker-compose.yml"||r==="docker-compose.yaml"?"yaml":r===".eslintrc.js"||r===".prettierrc.js"?"javascript":r==="tsconfig.json"?"json":l[s||""]||"text"},t2=r=>{const s=[/^([A-Z_]+(?:PASSWORD|SECRET|KEY|TOKEN|AUTH)[A-Z_]*)\s*=\s*(.+)$/gim,/"([^"]*(?:password|secret|key|token|auth)[^"]*)"\s*:\s*"([^"]+)"/gi,/^(\s*[^:\s]*(?:password|secret|key|token|auth)[^:\s]*)\s*:\s*(.+)$/gim];let l=r;return s.forEach(i=>{l=l.replace(i,(c,d,m)=>{const p="*".repeat(Math.min(m.length,8));return c.replace(m,p)})}),l},n2=r=>{switch(Eh(r)){case"json":return t.jsx(Zl,{className:"w-6 h-6 text-primary-600"});case"yaml":return t.jsx(Zl,{className:"w-6 h-6 text-primary-600"});case"javascript":case"typescript":return t.jsx(Ur,{className:"w-6 h-6 text-primary-600"});case"env":return"🔐";case"markdown":return"📝";default:return t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}};function r2({configs:r,selectedConfig:s,onConfigSelect:l,filters:i,onFiltersChange:c}){const d=Xj(r);return t.jsxs("div",{className:"bg-white rounded-lg shadow border h-full flex flex-col max-h-[calc(100vh-180px)]",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Configuration Files"}),t.jsxs("div",{className:"relative mb-4",children:[t.jsx(Dc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),t.jsx("input",{type:"text",placeholder:"Search config files...",value:i.search,onChange:m=>c({...i,search:m.target.value}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(ci,{className:"h-4 w-4 text-gray-400"}),t.jsxs("select",{value:i.type,onChange:m=>c({...i,type:m.target.value}),className:"flex-1 border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[t.jsx("option",{value:"all",children:"All Types"}),d.map(m=>t.jsx("option",{value:m,children:m.charAt(0).toUpperCase()+m.slice(1)},m))]})]}),t.jsxs("select",{value:i.status,onChange:m=>c({...i,status:m.target.value}),className:"w-full border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[t.jsx("option",{value:"all",children:"All Files"}),t.jsx("option",{value:"standard",children:"Standard Files"}),t.jsx("option",{value:"secrets",children:"Files with Secrets"})]})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:r.length===0?t.jsxs("div",{className:"p-4 text-center text-gray-500",children:[t.jsx("div",{className:"text-4xl mb-2",children:t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}),t.jsx("p",{className:"text-sm",children:"No configuration files found"})]}):t.jsx("div",{className:"p-2",children:r.map(m=>t.jsx("button",{onClick:()=>l(m.id),className:`w-full text-left p-3 rounded-lg mb-2 transition-colors ${s===m.id?"bg-blue-50 border border-blue-200":"hover:bg-gray-50 border border-transparent"}`,children:t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"text-2xl",children:n2(m.name)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:m.name}),m.hasSecrets&&t.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"🔒"})]}),t.jsx("p",{className:"text-xs text-gray-500 truncate mb-1",children:m.path}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:`inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${Qj(m.type)}`,children:m.type}),t.jsx("span",{className:"text-xs text-gray-400",children:Zj(m.size)})]}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:e2(m.lastModified)})]})]})},m.id))})}),t.jsx("div",{className:"p-4 border-t border-gray-200",children:t.jsxs("div",{className:"text-xs text-gray-500",children:[r.length," file",r.length!==1?"s":""," found"]})})]})}function s2({isEditing:r,canEdit:s,hasSecrets:l,showSecrets:i,saving:c,onStartEdit:d,onSaveEdit:m,onCancelEdit:p,onToggleSecrets:h,onRefresh:g,content:v}){const[y,C]=w.useState(!1),F=async()=>{try{const N=v||"No content available";await navigator.clipboard.writeText(N),C(!0),setTimeout(()=>{C(!1)},4e3)}catch(N){console.error("Failed to copy to clipboard:",N),C(!0),setTimeout(()=>C(!1),2e3)}};return c?t.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 border-b border-gray-200",children:[t.jsx("div",{className:"flex items-center space-x-2",children:t.jsxs("div",{className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-orange-600 bg-white border border-gray-300 rounded-lg",children:[t.jsx(fr,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]})}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsxs("button",{onClick:g,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(fr,{className:"w-4 h-4 mr-1"}),"Refresh"]})})]}):t.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 border-b border-gray-200",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[r?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:m,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700 transition-colors",children:[t.jsx(ai,{className:"w-4 h-4 mr-1"}),"Save"]}),t.jsxs("button",{onClick:p,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(Ss,{className:"w-4 h-4 mr-1"}),"Cancel"]})]}):s&&t.jsxs("button",{onClick:d,className:"inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[t.jsx(Ox,{className:"w-4 h-4 mr-1"}),"Edit"]}),l&&t.jsx("button",{onClick:h,className:`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${i?"text-red-700 bg-red-100 hover:bg-red-200":"text-yellow-700 bg-yellow-100 hover:bg-yellow-200"}`,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Lx,{className:"w-4 h-4 mr-1"}),"Hide Secrets"]}):t.jsxs(t.Fragment,{children:[t.jsx(Px,{className:"w-4 h-4 mr-1"}),"Show Secrets"]})})]}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsx("button",{onClick:F,className:`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${y?"text-green-700 bg-green-100 border border-green-300":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50"}`,children:y?t.jsxs(t.Fragment,{children:[t.jsx(Fx,{className:"w-4 h-4 mr-1"}),"Copied!"]}):t.jsxs(t.Fragment,{children:[t.jsx(Ux,{className:"w-4 h-4 mr-1"}),"Copy"]})})})]})}function a2({config:r,isEditing:s,editValue:l,onStartEdit:i,onSaveEdit:c,onCancelEdit:d,onValueChange:m,showSecrets:p,onToggleSecrets:h}){if(!r)return t.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 rounded-lg",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:t.jsx(Zl,{className:"w-6 h-6 text-primary-600"})}),t.jsx("p",{className:"text-gray-500",children:"Select a configuration file to view or edit"})]})});const g=Eh(r.name),v=p?r.content:t2(r.content);return t.jsxs("div",{className:"bg-white rounded-lg shadow border h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200",children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"text-2xl",children:t.jsx(Zl,{className:"w-6 h-6 text-primary-600"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900",children:r.name}),t.jsx("p",{className:"text-sm text-gray-500",children:r.path})]})]})}),t.jsx("div",{className:"flex-1 p-4",children:s?t.jsx("div",{className:"h-full",children:t.jsx("textarea",{value:l,onChange:y=>m(y.target.value),className:"w-full h-full font-mono text-sm border border-gray-300 rounded-lg p-4 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",placeholder:"Enter configuration content...",spellCheck:!1})}):t.jsx("div",{className:"h-full",children:t.jsx("pre",{className:"w-full h-full font-mono text-sm bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto whitespace-pre-wrap",children:t.jsx("code",{className:`language-${g}`,children:v})})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500",children:[t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("span",{children:["Language: ",g.toUpperCase()]}),t.jsxs("span",{children:["Size: ",r.content.length," characters"]}),r.hasSecrets&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:"🔒 Contains secrets"})]}),t.jsx("div",{children:s?t.jsx("span",{className:"text-blue-600 font-medium",children:"Editing mode"}):r.isEditable?t.jsx("span",{className:"text-green-600",children:"Editable"}):t.jsx("span",{className:"text-gray-400",children:"Read-only"})})]})})]})}function l2({validation:r,configName:s}){const l=h=>{switch(h){case"valid":return t.jsx(At,{className:"w-5 h-5 text-green-500"});case"warning":return t.jsx(lt,{className:"w-5 h-5 text-yellow-500"});case"error":return t.jsx(Dt,{className:"w-5 h-5 text-red-500"});default:return t.jsx(vs,{className:"w-5 h-5 text-gray-500"})}},c=r.some(h=>h.status==="error")?"error":r.some(h=>h.status==="warning")?"warning":"valid",d=r.filter(h=>h.status==="error").length,m=r.filter(h=>h.status==="warning").length,p=r.filter(h=>h.status==="valid").length;return r.length===0?t.jsx("div",{className:"bg-white rounded-lg shadow border p-6",children:t.jsxs("div",{className:"text-center",children:[t.jsx(vs,{className:"w-8 h-8 text-gray-400 mx-auto mb-2"}),t.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Validation Results"}),t.jsx("p",{className:"text-sm text-gray-500",children:"Select a configuration file to see validation results."})]})}):t.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[t.jsxs("div",{className:"p-4 border-b border-gray-200",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Validation Results"}),t.jsxs("div",{className:"flex items-center space-x-2",children:[l(c),t.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${mf(c)}`,children:c.toUpperCase()})]})]}),t.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Validation results for ",s]})]}),t.jsx("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-green-600",children:p}),t.jsx("div",{className:"text-xs text-gray-600",children:"Valid"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-yellow-600",children:m}),t.jsx("div",{className:"text-xs text-gray-600",children:"Warnings"})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-lg font-bold text-red-600",children:d}),t.jsx("div",{className:"text-xs text-gray-600",children:"Errors"})]})]})}),t.jsx("div",{className:"p-4",children:t.jsx("div",{className:"space-y-3",children:r.map((h,g)=>t.jsx("div",{className:`p-3 rounded-lg border ${h.status==="error"?"border-red-200 bg-red-50":h.status==="warning"?"border-yellow-200 bg-yellow-50":"border-green-200 bg-green-50"}`,children:t.jsxs("div",{className:"flex items-start space-x-3",children:[l(h.status),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-900",children:h.field}),t.jsx("span",{className:`inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${mf(h.status)}`,children:h.status})]}),t.jsx("p",{className:"text-sm text-gray-600",children:h.message})]})]})},g))})}),(d>0||m>0)&&t.jsx("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"text-sm text-gray-600",children:[d>0&&t.jsxs("span",{className:"text-red-600 font-medium",children:[d," error",d>1?"s":""," need attention"]}),m>0&&d===0&&t.jsxs("span",{className:"text-yellow-600 font-medium",children:[m," warning",m>1?"s":""," to review"]})]}),t.jsx("button",{className:"text-blue-600 hover:text-blue-500 text-sm font-medium",children:"View Details"})]})})]})}function i2(){const[r,s]=w.useState(!0),[l,i]=w.useState(!1),[c,d]=w.useState(null),[m,p]=w.useState([]),[h,g]=w.useState(null),[v,y]=w.useState(!1),[C,F]=w.useState(""),[N,_]=w.useState(!1),[b,U]=w.useState({section:"all",type:"all",status:"all",search:""});w.useEffect(()=>{(async()=>{try{s(!0);const me=(await Ft.getConfigurationFiles()).map(ve=>({id:ve.id||ve.name,name:ve.name,path:ve.path||ve.name,type:ve.type||"text",content:ve.content||"",size:ve.content?.length||0,lastModified:ve.lastModified||new Date().toISOString(),hasSecrets:ve.hasSecrets||!1,isEditable:ve.isEditable!==!1,validation:ve.validation||[]}));p(me),d(null)}catch(ye){d(Ce.FAILED_TO_FETCH_PACKAGES),console.error("Error fetching config files:",ye)}finally{s(!1)}})()},[]);const R=Jj(m,b),M=h&&m.find(te=>te.id===h)||null,P=()=>{window.location.reload()},W=te=>{g(te),y(!1),F("")},ae=()=>{M&&(y(!0),F(M.content))},z=async()=>{if(M&&!l)try{i(!0),d(null);const te=await Ft.saveConfigurationFile(M.id,C);p(ye=>ye.map(me=>me.id===h?{...te,isEditable:me.isEditable}:me)),h===M.id&&g(M.id),y(!1),F("")}catch(te){console.error("Error saving config file:",te),d(`${Ce.FAILED_TO_SAVE_CONFIG}: ${te.message}`)}finally{i(!1)}},oe=()=>{y(!1),F("")},xe=()=>{_(!N)},Ne=()=>{window.location.reload()};return r?t.jsx(R1,{}):c?t.jsx(A1,{error:c,onRetry:Ne}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(P1,{onRefresh:P,loading:r}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-[800px]",children:[t.jsx("div",{className:"lg:col-span-1",children:t.jsx(r2,{configs:R,selectedConfig:h,onConfigSelect:W,filters:b,onFiltersChange:U})}),t.jsxs("div",{className:"lg:col-span-2 flex flex-col",children:[M&&t.jsx("div",{className:"mb-4",children:t.jsx(s2,{isEditing:v,canEdit:M.isEditable,hasSecrets:M.hasSecrets,showSecrets:N,saving:l,onStartEdit:ae,onSaveEdit:z,onCancelEdit:oe,onToggleSecrets:xe,onRefresh:P,content:v?C:M?.content})}),t.jsx("div",{className:"flex-1",children:t.jsx(a2,{config:M,isEditing:v,editValue:C,saving:l,onStartEdit:ae,onSaveEdit:z,onCancelEdit:oe,onValueChange:F,showSecrets:N,onToggleSecrets:xe})})]}),t.jsx("div",{className:"lg:col-span-1 space-y-6",children:t.jsx(l2,{validation:M?.validation||[],configName:M?.name||"No file selected"})})]}),R.length===0&&!r&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx("div",{className:"flex justify-center text-gray-400 text-6xl mb-4",children:t.jsx(Oc,{className:"w-6 h-6 text-primary-600"})}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No configuration files found"}),t.jsx("p",{className:"text-gray-600 mb-4",children:b.search||b.type!=="all"||b.status!=="all"?"Try adjusting your filters to see more results.":"No configuration files are available to inspect."}),(b.search||b.type!=="all"||b.status!=="all")&&t.jsx("button",{onClick:()=>U({section:"all",type:"all",status:"all",search:""}),className:"text-blue-600 hover:text-blue-500",children:"Clear Filters"})]})]})}const Fr={async getPackages(){return we.get("/releases/packages")},async analyzeChanges(r,s){return we.post("/releases/analyze",{packageNames:r,packagePaths:s})},async checkReadiness(r,s){return we.post("/releases/check-readiness",{packageNames:r,packagePaths:s})},async prepare(r,s,l=!1){return we.post("/releases/prepare",{packageNames:r,packagePaths:s,dryRun:l})},async startPublish(r,s,l){return we.post("/releases/start",{packageNames:r,packagePaths:s,...l})},async getPipelineStatus(r){return we.get(`/releases/status/${r}`)},async getPipelineDetails(r){return we.get(`/releases/details/${r}`)},async getPipelines(r,s){const l=new URLSearchParams;r&&l.append("status",r),s&&l.append("limit",String(s));const i=l.toString();return we.get(`/releases/pipelines?${i}`)},async cancelPipeline(r){return we.post(`/releases/cancel/${r}`)},async getPackageVersions(r){return we.get(`/releases/npm/${r}/versions`)},async isVersionAvailable(r,s){return we.get(`/releases/npm/${r}/${s}/available`)},async getHealth(){return we.get("/releases/health")}};function o2({packages:r,onConfirm:s,loading:l}){const[i,c]=w.useState(new Set),[d,m]=w.useState(""),p=w.useMemo(()=>r.filter(y=>!y.private&&y.name.toLowerCase().includes(d.toLowerCase())),[r,d]),h=y=>{const C=new Set(i);C.has(y)?C.delete(y):C.add(y),c(C)},g=()=>{i.size===p.length?c(new Set):c(new Set(p.map(y=>y.name)))},v=()=>{const y=r.filter(C=>i.has(C.name));s(y)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 1: Select Packages"}),t.jsx("p",{className:"text-gray-600",children:"Choose which packages you want to release. You can select multiple packages."})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Search Packages"}),t.jsx("input",{type:"text",value:d,onChange:y=>m(y.target.value),placeholder:"Search by package name...",className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Available Packages (",p.length,")"]}),p.length>0&&t.jsx("button",{onClick:g,className:"text-sm text-primary-600 hover:text-primary-700 font-medium",children:i.size===p.length?"Deselect All":"Select All"})]}),t.jsx("div",{className:"border border-gray-200 rounded-lg divide-y max-h-96 overflow-y-auto",children:p.length===0?t.jsx("div",{className:"p-4 text-center text-gray-500",children:"No packages found"}):p.map(y=>t.jsx("div",{className:"p-4 hover:bg-gray-50 cursor-pointer transition",onClick:()=>h(y.name),children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("input",{type:"checkbox",checked:i.has(y.name),onChange:()=>h(y.name),className:"w-4 h-4 text-primary-600 rounded focus:ring-2 focus:ring-primary-500"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"font-medium text-gray-900",children:y.name}),t.jsxs("p",{className:"text-sm text-gray-500",children:["Current: v",y.version]})]}),y.dependencies&&y.dependencies.length>0&&t.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:[y.dependencies.length," deps"]})]})},y.name))})]}),t.jsx("div",{className:"flex gap-3 justify-end",children:t.jsxs("button",{onClick:v,disabled:i.size===0||l,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:["Continue (",i.size," selected)"]})})]})}const c2={major:"Breaking changes, incompatible API changes",minor:"New features, backward compatible",patch:"Bug fixes, patches, backward compatible"};function u2({packages:r,onConfirm:s,onBack:l}){const[i,c]=w.useState(r.reduce((h,g)=>({...h,[g.name]:g.bumpType}),{})),d=(h,g)=>{const v=h.split(".").map(Number);return g==="major"?`${v[0]+1}.0.0`:g==="minor"?`${v[0]}.${v[1]+1}.0`:`${v[0]}.${v[1]}.${v[2]+1}`},m=(h,g)=>{c(v=>({...v,[h]:g}))},p=()=>{const h=r.map(g=>({...g,bumpType:i[g.name],newVersion:d(g.currentVersion,i[g.name])}));s(h)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 2: Select Version Bumps"}),t.jsx("p",{className:"text-gray-600",children:"Choose the version bump type for each package. This determines the new version number."})]}),t.jsx("div",{className:"grid grid-cols-3 gap-4",children:Object.entries(c2).map(([h,g])=>t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg",children:[t.jsx("p",{className:"font-medium text-gray-900 capitalize mb-1",children:h}),t.jsx("p",{className:"text-sm text-gray-600",children:g})]},h))}),t.jsx("div",{className:"space-y-4",children:r.map(h=>t.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:h.name}),t.jsxs("p",{className:"text-sm text-gray-500",children:["Current: v",h.currentVersion]})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-sm text-gray-500",children:"New Version:"}),t.jsxs("p",{className:"text-lg font-bold text-primary-600",children:["v",d(h.currentVersion,i[h.name])]})]})]}),t.jsx("div",{className:"grid grid-cols-3 gap-3",children:["major","minor","patch"].map(g=>t.jsx("button",{onClick:()=>m(h.name,g),className:`p-3 rounded-lg border-2 transition font-medium text-sm ${i[h.name]===g?"border-primary-600 bg-primary-50 text-primary-700":"border-gray-200 bg-white text-gray-700 hover:border-gray-300"}`,children:t.jsx("span",{className:"capitalize",children:g})},g))}),h.affectedDependencies.length>0&&t.jsxs("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:[t.jsxs("p",{className:"text-sm font-medium text-blue-900",children:["ℹ️ ",h.affectedDependencies.length," dependent package(s)"]}),t.jsx("p",{className:"text-xs text-blue-700 mt-1",children:"Will be auto-bumped when this package is released"})]})]},h.name))}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:l,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",children:"Back"}),t.jsx("button",{onClick:p,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition",children:"Continue"})]})]})}function d2({packages:r,existingChangesets:s,onConfirm:l,onBack:i,loading:c}){const[d,m]=w.useState(""),[p,h]=w.useState([]),g=()=>{const y=[];return d.trim()||y.push("Please enter a changelog summary"),d.trim().length<10&&y.push(Jx),h(y),y.length===0},v=()=>{g()&&l(d)};return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 3: Preview Changeset"}),t.jsx("p",{className:"text-gray-600",children:"Review the changeset that will be created. Enter a summary of the changes."})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Changelog Summary"}),t.jsx("textarea",{value:d,onChange:y=>{m(y.target.value),g()},placeholder:Qx,rows:4,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-transparent font-mono text-sm"}),p.length>0&&t.jsx("div",{className:"mt-2 space-y-1",children:p.map((y,C)=>t.jsx("p",{className:"text-sm text-red-600",children:y},C))})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Packages to Release"}),t.jsx("div",{className:"space-y-3",children:r.map(y=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:y.name}),t.jsxs("p",{className:"flex items-center gap-2 text-sm text-gray-500",children:[y.currentVersion," ",t.jsx(wa,{})," ",y.newVersion]})]}),t.jsx("div",{className:"text-right",children:t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-primary-100 text-primary-800",children:y.bumpType.charAt(0).toUpperCase()+y.bumpType.slice(1)})})]},y.name))})]}),s.length>0&&t.jsxs("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[t.jsx("p",{className:"text-yellow-800 font-medium",children:"Unpublished Changesets"}),t.jsxs("p",{className:"text-yellow-700 text-sm mt-1",children:["There are ",s.length," existing unpublished changeset(s). Creating new ones will accumulate until published."]})]}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:i,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",disabled:c,children:"Back"}),t.jsx("button",{onClick:v,disabled:c||p.length>0,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:c?"Processing...":"Continue to Validation"})]})]})}function m2({validation:r,packages:s,onConfirm:l,onBack:i,loading:c}){const d=[{name:"User Permissions",passed:r.checks.permissions},{name:"Working Tree Clean",passed:r.checks.workingTreeClean},{name:"CI Tests Passing",passed:r.checks.ciPassing},{name:"Version Available on npm",passed:r.checks.versionAvailable}];return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Step 4: Validate Release"}),t.jsx("p",{className:"text-gray-600",children:"Checking if the release is safe to proceed. All checks must pass."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:`p-4 rounded-lg ${r.isValid?"bg-green-50":"bg-red-50"}`,children:[t.jsx("p",{className:`font-medium ${r.isValid?"text-green-900":"text-red-900"}`,children:r.isValid?"Ready to Release":"Not Ready"}),t.jsx("p",{className:`text-sm mt-1 ${r.isValid?"text-green-700":"text-red-700"}`,children:r.isValid?"All checks passed. Safe to proceed.":`${r.errors.length} error(s) need resolution`})]}),t.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[t.jsx("p",{className:"font-medium text-blue-900",children:"Release Summary"}),t.jsxs("p",{className:"text-sm text-blue-700 mt-1",children:[s.length," package(s) will be released"]})]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Pre-release Checks"}),t.jsx("div",{className:"space-y-3",children:d.map((m,p)=>t.jsxs("div",{className:`flex items-center space-x-3 p-3 rounded-lg ${m.passed?"bg-green-50":"bg-red-50"}`,children:[t.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center font-bold text-white p-1 ${m.passed?"bg-green-500":"bg-red-500"}`,children:m.passed?t.jsx(ai,{}):t.jsx(Ss,{})}),t.jsx("span",{className:`font-medium ${m.passed?"text-green-900":"text-red-900"}`,children:m.name})]},p))})]}),r.errors.length>0&&t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-red-900 mb-4",children:"Errors"}),t.jsx("div",{className:"space-y-2",children:r.errors.map((m,p)=>t.jsxs("p",{className:"text-red-700 text-sm",children:["• ",m]},p))})]}),r.warnings.length>0&&t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-yellow-900 mb-4",children:"Warnings"}),t.jsx("div",{className:"space-y-2",children:r.warnings.map((m,p)=>t.jsx("p",{className:"text-yellow-700 text-sm",children:m},p))})]}),t.jsxs("div",{className:"flex gap-3 justify-end",children:[t.jsx("button",{onClick:i,className:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg font-medium hover:bg-gray-50 transition",disabled:c,children:"Back"}),t.jsx("button",{onClick:l,disabled:!r.isValid||c,className:"px-6 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed transition",children:c?"Publishing...":"Confirm & Publish"})]})]})}function f2({packages:r,summary:s,onReset:l}){const i=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return t.jsxs("div",{className:"bg-white rounded-lg shadow p-6 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-10 h-10 text-green-600",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})}),t.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Release Initiated!"}),t.jsxs("p",{className:"text-gray-600 text-lg mb-4",children:["Changeset created and publishing workflow started for ",r.length," package(s)"]}),t.jsxs("p",{className:"text-gray-500 text-sm",children:["Initiated on ",i]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"What Happens Next"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"1. Changeset Created"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"A changeset has been created with your release information"})]})]}),t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"2. Publishing Workflow Started"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"GitHub Actions workflow has been triggered to publish your packages"})]})]}),t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 text-blue-600 mt-0.5",children:t.jsxs("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:[t.jsx("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),t.jsx("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-blue-900",children:"3. Monitor Progress"}),t.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"Check GitHub Actions for the workflow status and npm registry for package updates"})]})]})]})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Packages Released"}),t.jsx("div",{className:"space-y-2",children:r.map(c=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900",children:c.name}),t.jsxs("p",{className:"flex items-center gap-2 text-sm text-gray-500",children:["v",c.currentVersion," ",t.jsx(wa,{})," v",c.newVersion]})]}),t.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-primary-100 text-primary-800",children:c.bumpType.charAt(0).toUpperCase()+c.bumpType.slice(1)})]},c.name))})]}),t.jsxs("div",{className:"border-t pt-6",children:[t.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Changelog Summary"}),t.jsx("div",{className:"p-4 bg-gray-50 rounded-lg",children:t.jsx("p",{className:"text-gray-700 whitespace-pre-wrap",children:s})})]}),t.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Next Steps"}),t.jsxs("ul",{className:"text-sm text-blue-700 space-y-2",children:[t.jsx("li",{children:"Changeset created and committed"}),t.jsx("li",{children:"Package versions updated"}),t.jsx("li",{children:"Release pipeline triggered"}),t.jsx("li",{children:"GitHub release created (in progress)"}),t.jsx("li",{children:"npm registry will be updated shortly"})]})]}),t.jsx("div",{className:"flex gap-3 justify-center",children:t.jsx("button",{onClick:l,className:"px-8 py-3 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition",children:"Release Another Package"})}),t.jsxs("div",{className:"border-t pt-6 flex gap-4 justify-center",children:[t.jsxs("a",{href:"#",className:"flex items-center gap-2 gap-2 text-primary-600 hover:text-primary-700 font-medium text-sm",children:["View Release on GitHub ",t.jsx(wa,{})]}),t.jsxs("a",{href:"#",className:"flex items-center gap-2 gap-2 text-primary-600 hover:text-primary-700 font-medium text-sm",children:["View on npm ",t.jsx(wa,{})]})]})]})}function h2({message:r="Loading..."}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin mb-4"}),t.jsx("p",{className:"text-gray-600",children:r})]})}function p2({error:r,onRetry:s}){return t.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-6 h-6 text-red-600",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsx("h3",{className:"text-lg font-medium text-red-800",children:"Error"}),t.jsx("p",{className:"mt-2 text-sm text-red-700",children:r}),t.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-lg font-medium hover:bg-red-700 transition",children:"Try Again"})]})]})})}function x2(){const{isAuthenticated:r,hasPermission:s}=zr(),[l,i]=w.useState("select"),[c,d]=w.useState([]),[m,p]=w.useState(""),[h,g]=w.useState(!1),[v,y]=w.useState(null),[C,F]=w.useState(null),[N,_]=w.useState([]),[b,U]=w.useState([]);w.useEffect(()=>{R()},[]);const R=async()=>{try{g(!0);const te=await we.get(Ae.PUBLISH.PACKAGES);if(te.success)_(te.data.packages||[]);else{console.warn("Failed to fetch packages:",te.error?.message);const me=await we.get(Ae.PACKAGES.LIST);me.success&&_(me.data||[])}const ye=await we.get(Ae.PUBLISH.CHANGESETS);ye.success?U(ye.data.changesets||[]):(ye.error?.status===401||ye.error?.status===403)&&(window.location.href="/login"),y(null)}catch(te){const ye=te instanceof Error?te.message:Ce.FAILED_TO_FETCH_PACKAGES;y(ye),console.error("Error fetching workspace data:",te)}finally{g(!1)}},M=te=>{const ye=te.map(me=>({name:me.name,currentVersion:me.version,newVersion:me.version,bumpType:"patch",affectedDependencies:me.dependents||[]}));d(ye),i("bump")},P=te=>{d(te),i("preview")},W=te=>{p(te),ae(c,te)},ae=async(te,ye)=>{try{g(!0);const me=te.map(D=>D.name),ve=me.reduce((D,Y)=>{const ue=N.find(ne=>ne.name===Y);return ue&&(D[Y]=ue.path||"./packages/"+Y.split("/").pop()),D},{}),Z=await Fr.checkReadiness(me,ve),Q=[],X=[];let B=!0;if(Z.success){const D=Z.data;B=D.canProceed!==!1,D.globalBlockers&&Array.isArray(D.globalBlockers)&&Q.push(...D.globalBlockers.map(Y=>`🚨 ${Y}`)),D.checks&&Array.isArray(D.checks)&&D.checks.forEach(Y=>{Y.blockers&&Array.isArray(Y.blockers)&&Y.blockers.forEach(ue=>{Q.push(`❌ ${Y.packageName}: ${ue}`)}),Y.warnings&&Array.isArray(Y.warnings)&&Y.warnings.forEach(ue=>{X.push(`⚠️ ${Y.packageName}: ${ue}`)})})}const J=await we.post(Ae.PUBLISH.PREVIEW,{packages:me,bumps:te.map(D=>({package:D.name,bumpType:D.bumpType})),summary:ye});if(!J.success)throw new Error(Ce.VALIDATION_FAILED);const q=J.data,S={isValid:(q.isValid??!0)&&B,errors:[...Q,...q.errors??[]],warnings:[...X,...q.warnings??[]],checks:q.checks??{permissions:!0,workingTreeClean:Q.length===0,ciPassing:!0,versionAvailable:!Q.some(D=>D.includes("already exists"))}};F(S),i("validate"),y(null)}catch(me){const ve=me instanceof Error?me.message:"Validation error";y(ve),console.error("Validation error:",me)}finally{g(!1)}},z=async()=>{try{if(C&&!C.isValid){y("Cannot proceed with publishing. Please fix validation errors and re-validate."),i("validate");return}if(!s("maintain")){y(Ce.PERMISSION_ERROR);return}g(!0);const te=c.map(Z=>Z.name),ye=te.reduce((Z,Q)=>{const X=N.find(B=>B.name===Q);return X&&(Z[Q]=X.path||"./packages/"+Q.split("/").pop()),Z},{}),me={};c.forEach(Z=>{me[Z.name]=Z.newVersion});const ve=await Fr.startPublish(te,ye,{versionMap:me,method:"node",dryRun:!1,autoTag:!0,createReleases:!0});if(!ve.success)throw new Error(ve.error?.message||"Failed to start publishing");try{await we.post(Ae.PUBLISH.CHANGESETS,{packages:te,bumps:c.map(Z=>({package:Z.name,bumpType:Z.bumpType})),summary:m})}catch(Z){console.warn("Failed to create changeset record:",Z)}i("confirm"),y(null)}catch(te){const ye=te instanceof Error?te.message:"Publishing error";y(ye)}finally{g(!1)}},oe=()=>{i("select"),d([]),p(""),F(null),y(null),R()};if(!r)return t.jsx("div",{className:"p-6 bg-yellow-50 border border-yellow-200 rounded-lg",children:t.jsx("p",{className:"text-yellow-800",children:"Please log in to access release management."})});if(h&&l==="select"&&N.length===0)return t.jsx(h2,{message:"Loading workspace packages..."});if(v&&l==="select")return t.jsx(p2,{error:v,onRetry:R});const xe=s("write"),Ne=s("maintain");return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Release Manager"}),t.jsx("p",{className:"text-gray-600 mt-1",children:"Manage package versions and publish releases with the independent release engine"})]}),t.jsxs("div",{className:"text-sm text-gray-500",children:["Step"," ",["select","bump","preview","validate","confirm"].indexOf(l)+1," ","of 5"]})]}),!xe&&t.jsxs("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[t.jsx("p",{className:"text-yellow-700 font-medium",children:" Limited Access"}),t.jsx("p",{className:"text-yellow-600 text-sm mt-1",children:"You do not have write permission to create and publish changesets. Contact your repository administrator to request access."})]}),v&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Error"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:v})]}),b.length>0&&l==="select"&&t.jsxs("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[t.jsxs("p",{className:"text-blue-700 font-medium",children:[b.length," pending release(s)"]}),t.jsx("p",{className:"text-blue-600 text-sm mt-1",children:"Pull the latest changes and refresh the dashboard to see if these have been published."})]}),l==="select"&&!xe&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Access Denied"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:"You do not have write permission to create changesets. Contact your repository administrator."})]}),l==="select"&&xe&&t.jsx(o2,{packages:N,onConfirm:M,loading:h}),l==="bump"&&xe&&t.jsx(u2,{packages:c,onConfirm:P,onBack:()=>i("select")}),l==="preview"&&xe&&t.jsx(d2,{packages:c,existingChangesets:b,onConfirm:W,onBack:()=>i("bump"),loading:h}),l==="validate"&&!Ne&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[t.jsx("p",{className:"text-red-700 font-medium",children:"Access Denied"}),t.jsx("p",{className:"text-red-600 text-sm mt-1",children:"You do not have maintain permission to publish changesets. Contact your repository administrator."})]}),l==="validate"&&Ne&&C&&t.jsx(m2,{validation:C,packages:c,onConfirm:z,onBack:()=>i("preview"),loading:h}),l==="confirm"&&t.jsx(f2,{packages:c,summary:m,onReset:oe}),t.jsx("div",{className:"flex gap-2 justify-center",children:["select","bump","preview","validate","confirm"].map((te,ye)=>t.jsx("div",{className:`h-2 flex-1 rounded-full transition-colors ${["select","bump","preview","validate","confirm"].indexOf(l)>=ye?"bg-primary-500":"bg-gray-300"}`},te))})]})}const{entries:Ch,setPrototypeOf:ff,isFrozen:g2,getPrototypeOf:y2,getOwnPropertyDescriptor:v2}=Object;let{freeze:jt,seal:Yt,create:Nc}=Object,{apply:bc,construct:Sc}=typeof Reflect<"u"&&Reflect;jt||(jt=function(s){return s});Yt||(Yt=function(s){return s});bc||(bc=function(s,l){for(var i=arguments.length,c=new Array(i>2?i-2:0),d=2;d<i;d++)c[d-2]=arguments[d];return s.apply(l,c)});Sc||(Sc=function(s){for(var l=arguments.length,i=new Array(l>1?l-1:0),c=1;c<l;c++)i[c-1]=arguments[c];return new s(...i)});const Gl=wt(Array.prototype.forEach),j2=wt(Array.prototype.lastIndexOf),hf=wt(Array.prototype.pop),xa=wt(Array.prototype.push),w2=wt(Array.prototype.splice),Jl=wt(String.prototype.toLowerCase),ac=wt(String.prototype.toString),lc=wt(String.prototype.match),ga=wt(String.prototype.replace),N2=wt(String.prototype.indexOf),b2=wt(String.prototype.trim),cn=wt(Object.prototype.hasOwnProperty),vt=wt(RegExp.prototype.test),ya=S2(TypeError);function wt(r){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var l=arguments.length,i=new Array(l>1?l-1:0),c=1;c<l;c++)i[c-1]=arguments[c];return bc(r,s,i)}}function S2(r){return function(){for(var s=arguments.length,l=new Array(s),i=0;i<s;i++)l[i]=arguments[i];return Sc(r,l)}}function Ee(r,s){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Jl;ff&&ff(r,null);let i=s.length;for(;i--;){let c=s[i];if(typeof c=="string"){const d=l(c);d!==c&&(g2(s)||(s[i]=d),c=d)}r[c]=!0}return r}function k2(r){for(let s=0;s<r.length;s++)cn(r,s)||(r[s]=null);return r}function vn(r){const s=Nc(null);for(const[l,i]of Ch(r))cn(r,l)&&(Array.isArray(i)?s[l]=k2(i):i&&typeof i=="object"&&i.constructor===Object?s[l]=vn(i):s[l]=i);return s}function va(r,s){for(;r!==null;){const i=v2(r,s);if(i){if(i.get)return wt(i.get);if(typeof i.value=="function")return wt(i.value)}r=y2(r)}function l(){return null}return l}const pf=jt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ic=jt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oc=jt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),E2=jt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cc=jt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),C2=jt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xf=jt(["#text"]),gf=jt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),uc=jt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),yf=jt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kl=jt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_2=Yt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),T2=Yt(/<%[\w\W]*|[\w\W]*%>/gm),R2=Yt(/\$\{[\w\W]*/gm),A2=Yt(/^data-[\-\w.\u00B7-\uFFFF]+$/),P2=Yt(/^aria-[\-\w]+$/),_h=Yt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),L2=Yt(/^(?:\w+script|data):/i),O2=Yt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Th=Yt(/^html$/i),I2=Yt(/^[a-z][.\w]*(-[.\w]+)+$/i);var vf=Object.freeze({__proto__:null,ARIA_ATTR:P2,ATTR_WHITESPACE:O2,CUSTOM_ELEMENT:I2,DATA_ATTR:A2,DOCTYPE_NAME:Th,ERB_EXPR:T2,IS_ALLOWED_URI:_h,IS_SCRIPT_OR_DATA:L2,MUSTACHE_EXPR:_2,TMPLIT_EXPR:R2});const ja={element:1,text:3,progressingInstruction:7,comment:8,document:9},M2=function(){return typeof window>"u"?null:window},D2=function(s,l){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let i=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(i=l.getAttribute(c));const d="dompurify"+(i?"#"+i:"");try{return s.createPolicy(d,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},jf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M2();const s=de=>Rh(de);if(s.version="3.3.1",s.removed=[],!r||!r.document||r.document.nodeType!==ja.document||!r.Element)return s.isSupported=!1,s;let{document:l}=r;const i=l,c=i.currentScript,{DocumentFragment:d,HTMLTemplateElement:m,Node:p,Element:h,NodeFilter:g,NamedNodeMap:v=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:C,trustedTypes:F}=r,N=h.prototype,_=va(N,"cloneNode"),b=va(N,"remove"),U=va(N,"nextSibling"),R=va(N,"childNodes"),M=va(N,"parentNode");if(typeof m=="function"){const de=l.createElement("template");de.content&&de.content.ownerDocument&&(l=de.content.ownerDocument)}let P,W="";const{implementation:ae,createNodeIterator:z,createDocumentFragment:oe,getElementsByTagName:xe}=l,{importNode:Ne}=i;let te=jf();s.isSupported=typeof Ch=="function"&&typeof M=="function"&&ae&&ae.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ye,ERB_EXPR:me,TMPLIT_EXPR:ve,DATA_ATTR:Z,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:J}=vf;let{IS_ALLOWED_URI:q}=vf,S=null;const D=Ee({},[...pf,...ic,...oc,...cc,...xf]);let Y=null;const ue=Ee({},[...gf,...uc,...yf,...Kl]);let ne=Object.seal(Nc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),be=null,Te=null;const _e=Object.seal(Nc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ie=!0,it=!0,pr=!1,Es=!0,Qt=!1,Dn=!0,dn=!1,Hr=!1,xr=!1,jn=!1,Fn=!1,mn=!1,wn=!0,$r=!1;const Oa="user-content-";let Vr=!0,Un=!1,Nn={},Nt=null;const Bn=Ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Cs=null;const zn=Ee({},["audio","video","img","source","image","track"]);let bn=null;const Ia=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gr="http://www.w3.org/1998/Math/MathML",yr="http://www.w3.org/2000/svg",Jt="http://www.w3.org/1999/xhtml";let fn=Jt,vr=!1,jr=null;const _s=Ee({},[gr,yr,Jt],ac);let Hn=Ee({},["mi","mo","mn","ms","mtext"]),Xt=Ee({},["annotation-xml"]);const $n=Ee({},["title","style","font","a","script"]);let Vn=null;const Ma=["application/xhtml+xml","text/html"],Da="text/html";let We=null,Sn=null;const Ts=l.createElement("form"),Rs=function(E){return E instanceof RegExp||E instanceof Function},kn=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sn&&Sn===E)){if((!E||typeof E!="object")&&(E={}),E=vn(E),Vn=Ma.indexOf(E.PARSER_MEDIA_TYPE)===-1?Da:E.PARSER_MEDIA_TYPE,We=Vn==="application/xhtml+xml"?ac:Jl,S=cn(E,"ALLOWED_TAGS")?Ee({},E.ALLOWED_TAGS,We):D,Y=cn(E,"ALLOWED_ATTR")?Ee({},E.ALLOWED_ATTR,We):ue,jr=cn(E,"ALLOWED_NAMESPACES")?Ee({},E.ALLOWED_NAMESPACES,ac):_s,bn=cn(E,"ADD_URI_SAFE_ATTR")?Ee(vn(Ia),E.ADD_URI_SAFE_ATTR,We):Ia,Cs=cn(E,"ADD_DATA_URI_TAGS")?Ee(vn(zn),E.ADD_DATA_URI_TAGS,We):zn,Nt=cn(E,"FORBID_CONTENTS")?Ee({},E.FORBID_CONTENTS,We):Bn,be=cn(E,"FORBID_TAGS")?Ee({},E.FORBID_TAGS,We):vn({}),Te=cn(E,"FORBID_ATTR")?Ee({},E.FORBID_ATTR,We):vn({}),Nn=cn(E,"USE_PROFILES")?E.USE_PROFILES:!1,Ie=E.ALLOW_ARIA_ATTR!==!1,it=E.ALLOW_DATA_ATTR!==!1,pr=E.ALLOW_UNKNOWN_PROTOCOLS||!1,Es=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qt=E.SAFE_FOR_TEMPLATES||!1,Dn=E.SAFE_FOR_XML!==!1,dn=E.WHOLE_DOCUMENT||!1,jn=E.RETURN_DOM||!1,Fn=E.RETURN_DOM_FRAGMENT||!1,mn=E.RETURN_TRUSTED_TYPE||!1,xr=E.FORCE_BODY||!1,wn=E.SANITIZE_DOM!==!1,$r=E.SANITIZE_NAMED_PROPS||!1,Vr=E.KEEP_CONTENT!==!1,Un=E.IN_PLACE||!1,q=E.ALLOWED_URI_REGEXP||_h,fn=E.NAMESPACE||Jt,Hn=E.MATHML_TEXT_INTEGRATION_POINTS||Hn,Xt=E.HTML_INTEGRATION_POINTS||Xt,ne=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&Rs(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&Rs(E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ne.attributeNameCheck=E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),E.CUSTOM_ELEMENT_HANDLING&&typeof E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Qt&&(it=!1),Fn&&(jn=!0),Nn&&(S=Ee({},xf),Y=[],Nn.html===!0&&(Ee(S,pf),Ee(Y,gf)),Nn.svg===!0&&(Ee(S,ic),Ee(Y,uc),Ee(Y,Kl)),Nn.svgFilters===!0&&(Ee(S,oc),Ee(Y,uc),Ee(Y,Kl)),Nn.mathMl===!0&&(Ee(S,cc),Ee(Y,yf),Ee(Y,Kl))),E.ADD_TAGS&&(typeof E.ADD_TAGS=="function"?_e.tagCheck=E.ADD_TAGS:(S===D&&(S=vn(S)),Ee(S,E.ADD_TAGS,We))),E.ADD_ATTR&&(typeof E.ADD_ATTR=="function"?_e.attributeCheck=E.ADD_ATTR:(Y===ue&&(Y=vn(Y)),Ee(Y,E.ADD_ATTR,We))),E.ADD_URI_SAFE_ATTR&&Ee(bn,E.ADD_URI_SAFE_ATTR,We),E.FORBID_CONTENTS&&(Nt===Bn&&(Nt=vn(Nt)),Ee(Nt,E.FORBID_CONTENTS,We)),E.ADD_FORBID_CONTENTS&&(Nt===Bn&&(Nt=vn(Nt)),Ee(Nt,E.ADD_FORBID_CONTENTS,We)),Vr&&(S["#text"]=!0),dn&&Ee(S,["html","head","body"]),S.table&&(Ee(S,["tbody"]),delete be.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw ya('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ya('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');P=E.TRUSTED_TYPES_POLICY,W=P.createHTML("")}else P===void 0&&(P=D2(F,c)),P!==null&&typeof W=="string"&&(W=P.createHTML(""));jt&&jt(E),Sn=E}},Wr=Ee({},[...ic,...oc,...E2]),Wn=Ee({},[...cc,...C2]),pi=function(E){let G=M(E);(!G||!G.tagName)&&(G={namespaceURI:fn,tagName:"template"});const le=Jl(E.tagName),Me=Jl(G.tagName);return jr[E.namespaceURI]?E.namespaceURI===yr?G.namespaceURI===Jt?le==="svg":G.namespaceURI===gr?le==="svg"&&(Me==="annotation-xml"||Hn[Me]):!!Wr[le]:E.namespaceURI===gr?G.namespaceURI===Jt?le==="math":G.namespaceURI===yr?le==="math"&&Xt[Me]:!!Wn[le]:E.namespaceURI===Jt?G.namespaceURI===yr&&!Xt[Me]||G.namespaceURI===gr&&!Hn[Me]?!1:!Wn[le]&&($n[le]||!Wr[le]):!!(Vn==="application/xhtml+xml"&&jr[E.namespaceURI]):!1},ut=function(E){xa(s.removed,{element:E});try{M(E).removeChild(E)}catch{b(E)}},Bt=function(E,G){try{xa(s.removed,{attribute:G.getAttributeNode(E),from:G})}catch{xa(s.removed,{attribute:null,from:G})}if(G.removeAttribute(E),E==="is")if(jn||Fn)try{ut(G)}catch{}else try{G.setAttribute(E,"")}catch{}},wr=function(E){let G=null,le=null;if(xr)E="<remove></remove>"+E;else{const Ge=lc(E,/^[\r\n\t ]+/);le=Ge&&Ge[0]}Vn==="application/xhtml+xml"&&fn===Jt&&(E='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+E+"</body></html>");const Me=P?P.createHTML(E):E;if(fn===Jt)try{G=new C().parseFromString(Me,Vn)}catch{}if(!G||!G.documentElement){G=ae.createDocument(fn,"template",null);try{G.documentElement.innerHTML=vr?W:Me}catch{}}const Se=G.body||G.documentElement;return E&&le&&Se.insertBefore(l.createTextNode(le),Se.childNodes[0]||null),fn===Jt?xe.call(G,dn?"html":"body")[0]:dn?G.documentElement:Se},Gr=function(E){return z.call(E.ownerDocument||E,E,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},As=function(E){return E instanceof y&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof v)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},Fa=function(E){return typeof p=="function"&&E instanceof p};function Zt(de,E,G){Gl(de,le=>{le.call(s,E,G,Sn)})}const hn=function(E){let G=null;if(Zt(te.beforeSanitizeElements,E,null),As(E))return ut(E),!0;const le=We(E.nodeName);if(Zt(te.uponSanitizeElement,E,{tagName:le,allowedTags:S}),Dn&&E.hasChildNodes()&&!Fa(E.firstElementChild)&&vt(/<[/\w!]/g,E.innerHTML)&&vt(/<[/\w!]/g,E.textContent)||E.nodeType===ja.progressingInstruction||Dn&&E.nodeType===ja.comment&&vt(/<[/\w]/g,E.data))return ut(E),!0;if(!(_e.tagCheck instanceof Function&&_e.tagCheck(le))&&(!S[le]||be[le])){if(!be[le]&&Ls(le)&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,le)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(le)))return!1;if(Vr&&!Nt[le]){const Me=M(E)||E.parentNode,Se=R(E)||E.childNodes;if(Se&&Me){const Ge=Se.length;for(let tt=Ge-1;tt>=0;--tt){const zt=_(Se[tt],!0);zt.__removalCount=(E.__removalCount||0)+1,Me.insertBefore(zt,U(E))}}}return ut(E),!0}return E instanceof h&&!pi(E)||(le==="noscript"||le==="noembed"||le==="noframes")&&vt(/<\/no(script|embed|frames)/i,E.innerHTML)?(ut(E),!0):(Qt&&E.nodeType===ja.text&&(G=E.textContent,Gl([ye,me,ve],Me=>{G=ga(G,Me," ")}),E.textContent!==G&&(xa(s.removed,{element:E.cloneNode()}),E.textContent=G)),Zt(te.afterSanitizeElements,E,null),!1)},Ps=function(E,G,le){if(wn&&(G==="id"||G==="name")&&(le in l||le in Ts))return!1;if(!(it&&!Te[G]&&vt(Z,G))){if(!(Ie&&vt(Q,G))){if(!(_e.attributeCheck instanceof Function&&_e.attributeCheck(G,E))){if(!Y[G]||Te[G]){if(!(Ls(E)&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,E)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(E))&&(ne.attributeNameCheck instanceof RegExp&&vt(ne.attributeNameCheck,G)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(G,E))||G==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&vt(ne.tagNameCheck,le)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(le))))return!1}else if(!bn[G]){if(!vt(q,ga(le,B,""))){if(!((G==="src"||G==="xlink:href"||G==="href")&&E!=="script"&&N2(le,"data:")===0&&Cs[E])){if(!(pr&&!vt(X,ga(le,B,"")))){if(le)return!1}}}}}}}return!0},Ls=function(E){return E!=="annotation-xml"&&lc(E,J)},Ua=function(E){Zt(te.beforeSanitizeAttributes,E,null);const{attributes:G}=E;if(!G||As(E))return;const le={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Me=G.length;for(;Me--;){const Se=G[Me],{name:Ge,namespaceURI:tt,value:zt}=Se,en=We(Ge),Os=zt;let Je=Ge==="value"?Os:b2(Os);if(le.attrName=en,le.attrValue=Je,le.keepAttr=!0,le.forceKeepAttr=void 0,Zt(te.uponSanitizeAttribute,E,le),Je=le.attrValue,$r&&(en==="id"||en==="name")&&(Bt(Ge,E),Je=Oa+Je),Dn&&vt(/((--!?|])>)|<\/(style|title|textarea)/i,Je)){Bt(Ge,E);continue}if(en==="attributename"&&lc(Je,"href")){Bt(Ge,E);continue}if(le.forceKeepAttr)continue;if(!le.keepAttr){Bt(Ge,E);continue}if(!Es&&vt(/\/>/i,Je)){Bt(Ge,E);continue}Qt&&Gl([ye,me,ve],Pt=>{Je=ga(Je,Pt," ")});const Nr=We(E.nodeName);if(!Ps(Nr,en,Je)){Bt(Ge,E);continue}if(P&&typeof F=="object"&&typeof F.getAttributeType=="function"&&!tt)switch(F.getAttributeType(Nr,en)){case"TrustedHTML":{Je=P.createHTML(Je);break}case"TrustedScriptURL":{Je=P.createScriptURL(Je);break}}if(Je!==Os)try{tt?E.setAttributeNS(tt,Ge,Je):E.setAttribute(Ge,Je),As(E)?ut(E):hf(s.removed)}catch{Bt(Ge,E)}}Zt(te.afterSanitizeAttributes,E,null)},Ba=function de(E){let G=null;const le=Gr(E);for(Zt(te.beforeSanitizeShadowDOM,E,null);G=le.nextNode();)Zt(te.uponSanitizeShadowNode,G,null),hn(G),Ua(G),G.content instanceof d&&de(G.content);Zt(te.afterSanitizeShadowDOM,E,null)};return s.sanitize=function(de){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=null,le=null,Me=null,Se=null;if(vr=!de,vr&&(de="<!-->"),typeof de!="string"&&!Fa(de))if(typeof de.toString=="function"){if(de=de.toString(),typeof de!="string")throw ya("dirty is not a string, aborting")}else throw ya("toString is not a function");if(!s.isSupported)return de;if(Hr||kn(E),s.removed=[],typeof de=="string"&&(Un=!1),Un){if(de.nodeName){const zt=We(de.nodeName);if(!S[zt]||be[zt])throw ya("root node is forbidden and cannot be sanitized in-place")}}else if(de instanceof p)G=wr("<!---->"),le=G.ownerDocument.importNode(de,!0),le.nodeType===ja.element&&le.nodeName==="BODY"||le.nodeName==="HTML"?G=le:G.appendChild(le);else{if(!jn&&!Qt&&!dn&&de.indexOf("<")===-1)return P&&mn?P.createHTML(de):de;if(G=wr(de),!G)return jn?null:mn?W:""}G&&xr&&ut(G.firstChild);const Ge=Gr(Un?de:G);for(;Me=Ge.nextNode();)hn(Me),Ua(Me),Me.content instanceof d&&Ba(Me.content);if(Un)return de;if(jn){if(Fn)for(Se=oe.call(G.ownerDocument);G.firstChild;)Se.appendChild(G.firstChild);else Se=G;return(Y.shadowroot||Y.shadowrootmode)&&(Se=Ne.call(i,Se,!0)),Se}let tt=dn?G.outerHTML:G.innerHTML;return dn&&S["!doctype"]&&G.ownerDocument&&G.ownerDocument.doctype&&G.ownerDocument.doctype.name&&vt(Th,G.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+G.ownerDocument.doctype.name+`>
18
18
  `+tt),Qt&&Gl([ye,me,ve],zt=>{tt=ga(tt,zt," ")}),P&&mn?P.createHTML(tt):tt},s.setConfig=function(){let de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kn(de),Hr=!0},s.clearConfig=function(){Sn=null,Hr=!1},s.isValidAttribute=function(de,E,G){Sn||kn({});const le=We(de),Me=We(E);return Ps(le,Me,G)},s.addHook=function(de,E){typeof E=="function"&&xa(te[de],E)},s.removeHook=function(de,E){if(E!==void 0){const G=j2(te[de],E);return G===-1?void 0:w2(te[de],G,1)[0]}return hf(te[de])},s.removeHooks=function(de){te[de]=[]},s.removeAllHooks=function(){te=jf()},s}var F2=Rh();function U2(r){const s=/\u001b\[([0-9;]*m|K)|(\u001b\(B|\u001b\[m)/g;let l="",i={};const c=Array.from(r.matchAll(s)),d={30:"#000000",31:"#e06c75",32:"#98c379",33:"#e5c07b",34:"#61afef",35:"#c678dd",36:"#56b6c2",37:"#abb2bf"},m={90:"#5c6370",91:"#ff7b86",92:"#98c379",93:"#e5c07b",94:"#61afef",95:"#c678dd",96:"#56b6c2",97:"#ffffff"};let p=0,h="";for(const v of c){const y=r.substring(p,v.index);h+=wf(y);const C=v[1];if(p=v.index+v[0].length,C==="m"||C==="0m")h&&(l+=dc(h,i),h=""),i={};else if(C==="1m")i.fontWeight="bold";else if(C==="2m")i.opacity="0.5";else if(C==="3m")i.fontStyle="italic";else if(C==="4m")i.textDecoration="underline";else if(C.includes(";")){const F=C.split(";").filter(N=>N);for(const N of F){const _=parseInt(N);if(_===0)h&&(l+=dc(h,i),h=""),i={};else if(_===1)i.fontWeight="bold";else if(_===2)i.opacity="0.5";else if(_===3)i.fontStyle="italic";else if(_===4)i.textDecoration="underline";else if(d[_])i.color=d[_];else if(m[_])i.color=m[_];else if(_>=40&&_<=47){const b=d[_-10];b&&(i.backgroundColor=b)}else if(_>=100&&_<=107){const b=m[_-60];b&&(i.backgroundColor=b)}}}else{const F=parseInt(C);d[F]?i.color=d[F]:m[F]&&(i.color=m[F])}}const g=r.substring(p);return h+=wf(g),h&&(l+=dc(h,i)),l}function wf(r){const s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return r.replace(/[&<>"']/g,l=>s[l])}function dc(r,s){return!r||Object.keys(s).length===0?r:`<span style="${Object.entries(s).map(([i,c])=>`${i.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${c}`).join("; ")}">${r}</span>`}function B2(r,s){if(r==="completed"){if(s==="success")return t.jsx(At,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(Ca,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(Dt,{className:"h-6 w-6 text-gray-600"})}return t.jsx(He,{className:"h-6 w-6 text-blue-600"})}function Ah({step:r,onToggle:s,expandedSteps:l,stepIndex:i}){const c=w.useRef(null),[d,m]=w.useState(!1),p=l.has(r.stepNumber),h=r.children&&r.children.length>0||r.logs.length>0,g=w.useMemo(()=>d?r.logs:r.logs.slice(0,1e3),[r.logs,d]);w.useEffect(()=>{if(r.status==="in_progress"&&p&&c.current){const C=c.current;C.scrollTop=C.scrollHeight}},[r.logs.length,p,r.status]);const v=w.useMemo(()=>!r.startedAt||!r.completedAt?0:Math.round((new Date(r.completedAt).getTime()-new Date(r.startedAt).getTime())/100)/10,[r.startedAt,r.completedAt]),y={marginLeft:`${r.level*20}px`};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"border-b border-gray-200 bg-white",style:y,children:[t.jsxs("button",{onClick:()=>s(r.stepNumber),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-50 transition-colors group",children:[t.jsx("span",{className:"text-gray-400 group-hover:text-gray-600 flex-shrink-0",children:h?p?t.jsx(Gx,{className:"h-5 w-5"}):t.jsx(Kx,{className:"h-5 w-5"}):t.jsx("span",{className:"h-5 w-5"})}),t.jsx("span",{className:"text-xs font-bold text-gray-500 bg-gray-100 rounded px-2 py-1 min-w-fit",children:i+1}),t.jsx("span",{className:"flex-1 text-left",children:t.jsx("span",{className:"text-sm font-semibold text-gray-900",children:r.stepName})}),t.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[r.status==="in_progress"&&t.jsx("span",{className:"flex h-2 w-2 rounded-full bg-blue-500 animate-pulse"}),t.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:[v,"s"]})]})]}),p&&r.logs.length>0&&t.jsx("div",{className:"border-t border-gray-200 bg-[#0d1117]",children:t.jsxs("div",{ref:c,className:"text-gray-300 font-mono text-xs max-h-[600px] overflow-y-auto",children:[g.length===0?t.jsx("div",{className:"px-10 py-6 italic text-gray-500 text-center",children:"No logs available yet"}):t.jsx("div",{className:"py-2 px-0",children:g.map((C,F)=>t.jsxs("div",{className:"flex hover:bg-gray-800/40 transition-colors leading-6 group",children:[t.jsx("span",{className:"w-12 text-right pr-4 text-gray-600 select-none border-r border-gray-800 flex-shrink-0 group-hover:bg-gray-800/20",children:C.lineNumber}),t.jsx("span",{className:"pl-4 pr-3 text-gray-500 select-none opacity-50 text-xs flex-shrink-0",children:C.timestamp.split("T")[1]?.slice(0,8)}),t.jsx("span",{className:"flex-1 whitespace-pre break-all pr-4 text-gray-300",dangerouslySetInnerHTML:{__html:F2.sanitize(U2(C.ansiContent))}})]},`${r.stepNumber}-${C.lineNumber}`))}),!d&&r.logs.length>1e3&&t.jsx("div",{className:"px-4 py-2 border-t border-gray-800 text-center",children:t.jsxs("button",{onClick:()=>m(!0),className:"text-blue-400 hover:text-blue-300 text-xs font-medium transition-colors",children:["Show all ",r.logs.length," lines"]})})]})})]}),p&&r.children&&r.children.length>0&&t.jsx(t.Fragment,{children:r.children.map((C,F)=>t.jsx(Ah,{step:C,onToggle:s,expandedSteps:l,stepIndex:F},C.stepNumber))})]})}function z2({steps:r,jobName:s,jobStatus:l,jobConclusion:i,gitHubLogsUrl:c}){const[d,m]=w.useState(new Set([r[0]?.stepNumber])),p=g=>{m(v=>{const y=new Set(v);return y.has(g)?y.delete(g):y.add(g),y})},h=g=>g.reduce((v,y)=>{let C=1;return y.children&&y.children.length>0&&(C+=h(y.children)),v+C},0);return t.jsxs("div",{className:"flex flex-col h-full bg-white border border-gray-200 rounded-lg overflow-hidden",children:[t.jsxs("div",{className:"px-4 py-3 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-lg font-semibold ",children:B2(l,i)}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:s}),t.jsxs("p",{className:"text-xs text-gray-500",children:[h(r)," step",h(r)!==1?"s":""]})]})]}),t.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-xs px-3 py-2 bg-blue-50 text-blue-600 hover:bg-blue-100 rounded border border-blue-200 transition-colors",children:"View on GitHub"})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:r.length===0?t.jsx("div",{className:"p-4 text-center text-gray-500",children:"No steps available"}):r.map((g,v)=>t.jsx(Ah,{step:g,onToggle:p,expandedSteps:d,stepIndex:v},g.stepNumber))})]})}const H2=r=>{if(!r)return!1;const s=r.limit*.1;return r.remaining>0&&r.remaining<=s},$2=r=>{const s=new Date(r*1e3),l=new Date,i=s.getTime()-l.getTime();if(i<0)return"now";const c=Math.floor(i/1e3),d=Math.floor(c/60),m=Math.floor(d/60);return m>0?`${m}h ${d%60}m`:d>0?`${d}m ${c%60}s`:`${c}s`},Na=r=>{if(!r||r.remaining>0)return"";const s=$2(r.reset);return Bf.QUOTA_RESET(s)},V2=r=>!r||!H2(r)?"":Bf.APPROACHING_LIMIT(r.remaining,r.limit);function W2(r,s){if(r==="completed"){if(s==="success")return t.jsx(At,{className:"h-5 w-5 text-green-600"});if(s==="failure")return t.jsx(Ca,{className:"h-5 w-5 text-red-600"})}return t.jsx(He,{className:"h-5 w-5 text-yellow-600"})}function G2(r,s){if(r==="completed"){if(s==="success")return"bg-green-100 text-green-800";if(s==="failure")return"bg-red-100 text-red-800"}return"bg-yellow-100 text-yellow-800"}function K2(r){const s=new Date(r),i=Math.floor((new Date().getTime()-s.getTime())/1e3);if(i<60)return"just now";const c=Math.floor(i/60);if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const m=Math.floor(d/24);return m<7?`${m}d ago`:s.toLocaleDateString()}function q2({owner:r,repo:s,packageName:l,onSelectRun:i,runId:c,limit:d=10}){const[m,p]=w.useState([]),[h,g]=w.useState(!0),[v,y]=w.useState(null),[C,F]=w.useState(null),{isAuthenticated:N,hasPermission:_}=zr();w.useEffect(()=>{const R=async()=>{try{g(!0),y(null);let P=Ae.WORKFLOWS.LIST(r,s)+`?per_page=${d}`;l&&(P=Ae.WORKFLOWS.BY_PACKAGE(r,s,l));const W=await we.get(P);if(!W.success){const oe=Na(W.rateLimit);if(oe){y(oe);return}throw new Error(Ce.FAILED_TO_FETCH_WORKFLOWS)}const ae=W.data;let z=[];if(l)if(Array.isArray(ae))z=ae.flatMap(oe=>oe.runs||[]).slice(0,d);else{const oe=ae;z=(Array.isArray(oe.runs)?oe.runs:[]).slice(0,d)}else z=Array.isArray(ae.runs)?ae.runs:[];p(z)}catch(P){y(P instanceof Error?P.message:Ce.UNKNOWN_ERROR)}finally{g(!1)}},M=setInterval(R,5e3);return R(),()=>clearInterval(M)},[r,s,l,d]);const b=async(R,M)=>{R.stopPropagation(),F(M.id);try{const P=await we.post(Ae.WORKFLOWS.CANCEL(r,s,M.id));if(P.success)p(m.map(W=>W.id===M.id?{...W,status:"completed",conclusion:"cancelled"}:W));else{const W=Na(P.rateLimit);if(W){y(W);return}throw new Error(Ce.FAILED_TO_CANCEL_RUN)}}catch(P){console.error("Failed to cancel run:",P),y(P instanceof Error?P.message:Ce.FAILED_TO_CANCEL_RUN)}finally{F(null)}},U=async(R,M)=>{R.stopPropagation(),F(M.id);try{const P=await we.post(Ae.WORKFLOWS.RERUN(r,s,M.id),{failedOnly:!1});if(P.success)p(m.map(W=>W.id===M.id?{...W,status:"in_progress",conclusion:null}:W));else{const W=Na(P.rateLimit);if(W){y(W);return}throw new Error(Ce.FAILED_TO_RERUN_WORKFLOW)}}catch(P){console.error("Failed to rerun workflow:",P),y(P instanceof Error?P.message:Ce.FAILED_TO_RERUN_WORKFLOW)}finally{F(null)}};return h&&m.length===0?t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx("div",{className:"animate-spin",children:t.jsx(He,{className:"h-8 w-8 text-blue-600"})})}):v?t.jsx("div",{className:"rounded-lg bg-red-50 p-4 border border-red-200",children:t.jsxs("p",{className:"text-sm text-red-800",children:["Error: ",v]})}):t.jsx("div",{className:"space-y-2",children:!m||m.length===0?t.jsx("p",{className:"text-sm text-gray-500 py-4",children:"No workflow runs found"}):m.map(R=>t.jsxs("div",{className:`text-left p-3 rounded-lg border transition-colors ${c===R.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:bg-gray-50"}`,children:[t.jsx("button",{onClick:()=>i?.(R.id),className:"w-full text-left",children:t.jsxs("div",{className:"flex items-start gap-2",children:[W2(R.status,R.conclusion),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium text-sm text-gray-900",children:R.name}),t.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[t.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${G2(R.status,R.conclusion)}`,children:R.conclusion??R.status}),t.jsx("span",{children:" • "}),t.jsxs("span",{children:["Branch: ",R.head_branch]}),t.jsx("span",{children:" • "}),t.jsxs("span",{children:["by ",R.actor.login]}),t.jsx("span",{children:" • "}),t.jsx("span",{children:K2(R.created_at)})]})]})]})}),_("maintain")&&t.jsxs("div",{className:"flex gap-2 mt-3",children:[R.status==="in_progress"&&t.jsx("button",{onClick:M=>b(M,R),disabled:C===R.id,className:"flex-1 px-3 py-2 text-sm font-medium text-red-700 bg-red-50 border border-red-200 rounded hover:bg-red-100 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Cancel this workflow run",children:C===R.id?"Cancelling...":"Cancel Run"}),(R.conclusion==="cancelled"||R.conclusion==="failure")&&t.jsx("button",{onClick:M=>U(M,R),disabled:C===R.id,className:"flex-1 px-3 py-2 text-sm font-medium text-blue-700 bg-blue-50 border border-blue-200 rounded hover:bg-blue-100 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Rerun this workflow",children:C===R.id?"Rerunning...":"Rerun"})]})]},R.id))})}function Y2({owner:r,repo:s,defaultBranch:l="main",onSuccess:i,onError:c}){const[d,m]=w.useState(!1),[p,h]=w.useState(l),[g,v]=w.useState({}),[y,C]=w.useState(!1),[F,N]=w.useState(null),[_,b]=w.useState([]),[U,R]=w.useState(),[M,P]=w.useState(!1);w.useEffect(()=>{d&&_.length===0&&W()},[d]);const W=async()=>{try{P(!0);const z=await we.get(Ae.WORKFLOWS.AVAILABLE(r,s));z.success&&(b(z.data.workflows||[]),z.data.workflows?.length>0&&!U&&R(z.data.workflows[0].path))}catch(z){console.error("Failed to fetch workflows:",z)}finally{P(!1)}},ae=async()=>{try{C(!0),N(null);const z=await we.post(Ae.WORKFLOWS.TRIGGER(r,s),{workflow:U,ref:p,inputs:g,workflowId:_.find(xe=>xe.path==U)?.id??""});if(!z.success){const xe=Na(z.rateLimit);if(xe){N(xe),c?.(xe);return}throw new Error(Ce.FAILED_TO_TRIGGER_WORKFLOW)}const oe=z.data;if(oe.success)i?.(oe.runUrl||`https://github.com/${r}/${s}/actions`),m(!1),h(l),v({});else throw new Error(oe.message||Ce.FAILED_TO_TRIGGER_WORKFLOW)}catch(z){const oe=z instanceof Error?z.message:Ce.UNKNOWN_ERROR;N(oe),c?.(oe)}finally{C(!1)}};return t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>m(!d),disabled:y,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[t.jsx(li,{className:"h-4 w-4"}),"Trigger Workflow"]}),d&&t.jsxs("div",{className:"absolute right-0 mt-2 w-96 bg-white border border-gray-200 rounded-lg shadow-lg z-10 p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Trigger Workflow"}),F&&t.jsxs("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg flex items-start gap-3",children:[t.jsx(Ca,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),t.jsx("p",{className:"text-sm text-red-700",children:F})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Workflow"}),M?t.jsx("div",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg bg-gray-50 text-gray-500",children:"Loading workflows..."}):_.length>0?t.jsx("select",{value:U,onChange:z=>R(z.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:_.map(z=>t.jsxs("option",{value:z.path,children:[z.name," (",z.path,")"]},z.id))}):t.jsx("div",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg bg-yellow-50 text-yellow-700 text-sm",children:"No workflows available"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Branch"}),t.jsx("input",{type:"text",value:p,onChange:z=>h(z.target.value),placeholder:"main",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),t.jsxs("div",{className:"flex gap-2 pt-4",children:[t.jsx("button",{onClick:ae,disabled:y||!p,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:y?"Triggering...":"Trigger"}),t.jsx("button",{onClick:()=>m(!1),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium",children:"Cancel"})]})]})]})]})}function Q2(r,s,l=!1){if(l)return t.jsx(He,{className:"h-6 w-6 text-yellow-500 animate-spin"});if(r==="completed"){if(s==="success")return t.jsx(At,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(Ca,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(Dt,{className:"h-6 w-6 text-gray-600"});if(s==="skipped")return t.jsx(He,{className:"h-6 w-6 text-gray-600"})}return r==="in_progress"||r==="queued"?t.jsx(He,{className:"h-6 w-6 text-blue-600"}):t.jsx(He,{className:"h-6 w-6 text-gray-600"})}function J2({jobs:r,selectedJob:s,onSelectJob:l}){return t.jsx(t.Fragment,{children:r.map(i=>{const c=i.startedAt&&i.completedAt?Math.round((new Date(i.completedAt).getTime()-new Date(i.startedAt).getTime())/1e3):0;return t.jsx("div",{className:`rounded-lg border transition-colors ${s?.id===i.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:bg-gray-50"}`,children:t.jsx("button",{onClick:()=>l(i),className:"w-full text-left p-3",children:t.jsxs("div",{className:"flex items-start gap-2",children:[Q2(i.status,i.conclusion),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium text-sm text-gray-900 truncate",children:i.name}),t.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[i.status," • ",c,"s"]})]})]})})},i.id)})})}const X2=()=>{try{const r=at.get("monodog_session_data");return r?JSON.parse(r).permission:null}catch(r){return console.error("Failed to parse session data",r),null}};function Z2(r){const s=r.split(`
19
19
  `),l=[];let i=null;const c=[];for(let d=0;d<s.length;d++){const m=s[d],p=m.trim(),h=m.match(/^(\s*)/)?.[1].length||0,g=Math.floor(h/2);if(m.includes("##[group]")){const v=m.match(/##\[group\](.*?)(?:##\[endgroup\]|$)/),C={name:v?v[1].trim():`Step ${l.length+1}`,logs:[],level:g,children:[],startIndex:d};for(;c.length>0&&c[c.length-1].level>=C.level;)c.pop();if(c.length>0){const F=c[c.length-1];F.children||(F.children=[]),F.children.push(C)}else l.push(C);c.push(C),i=C}else{if(m.includes("##[endgroup]"))continue;p&&i&&i.logs.push(m)}}return l}function ew(r,s,l=!1){if(l)return t.jsx(He,{className:"h-6 w-6 text-yellow-500 animate-spin"});if(r==="completed"){if(s==="success")return t.jsx(At,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(Ca,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(Dt,{className:"h-6 w-6 text-gray-600"});if(s==="skipped")return t.jsx(He,{className:"h-6 w-6 text-gray-600"})}return r==="in_progress"||r==="queued"?t.jsx(He,{className:"h-6 w-6 text-blue-600"}):t.jsx(He,{className:"h-6 w-6 text-gray-600"})}function tw({packageName:r,onNavigate:s}){const[l,i]=w.useState([]),[c,d]=w.useState(null),[m,p]=w.useState([]),[h,g]=w.useState(null),[v,y]=w.useState(null),[C,F]=w.useState(!0),[N,_]=w.useState(null),[b,U]=w.useState(new Set),{hasPermission:R}=zr(),[M,P]=w.useState(0),[W,ae]=w.useState(!1),z=10,oe=20,{owner:xe,repo:Ne}=w.useMemo(()=>X2()||{},[]);w.useEffect(()=>{const Z=async()=>{try{const X=Ae.PIPELINES.LIST,B=await we.get(X);if(!B.success){if(B.error?.status===401||B.error?.status===403){window.location.href="/login";return}if(B.error?.status===404){console.warn("Pipelines endpoint not available"),i([]),F(!1);return}throw new Error(`Failed to fetch pipelines: ${B.error?.message}`)}const J=Array.isArray(B.data)?B.data:[];i(J),F(!1)}catch(X){_(X instanceof Error?X.message:"Unknown error"),F(!1)}};Z();const Q=setInterval(Z,5e3);return()=>clearInterval(Q)},[xe,Ne,r]),w.useEffect(()=>{const Z=async()=>{try{l.forEach(async X=>{if(X.workflowId&&X.currentStatus!=="completed"&&!b.has(X.workflowId)){const B=Ae.WORKFLOWS.LIST(xe,Ne)+`?workflow_id=${X.workflowId}&per_page=${oe}&page=1`,J=await we.get(B);if(J.success){const q=J.data,S=q.workflow_runs?.[0]||q.runs?.[0];if(S){const D=S.status!==X.currentStatus,Y=S.conclusion!==X.currentConclusion;if(D||Y){U(ue=>new Set(ue).add(X.workflowId));try{const ue=await we.put(Ae.PIPELINES.STATUS(X.id),{currentStatus:S.status,currentConclusion:S.conclusion||null,lastRunId:S.id}),ne={...X,currentStatus:S.status,currentConclusion:S.conclusion||null,lastRunId:S.id};if(console.log(ne),ne.currentStatus=="completed"){const be=await Ft.refreshPackages()}i(be=>be.map(Te=>Te.id===X.id?ne:Te))}catch(ue){console.warn("Failed to update pipeline status:",ue)}finally{U(ue=>{const ne=new Set(ue);return ne.delete(X.workflowId),ne})}}}}}})}catch(X){console.warn("Failed to poll pipeline status:",X)}};Z();const Q=setInterval(Z,1e4);return()=>clearInterval(Q)},[l,xe,Ne]),w.useEffect(()=>{if(!c)return;const Z=async()=>{try{const X=await we.get(Ae.WORKFLOWS.RUNS(xe,Ne,c));if(!X.success){if(X.error?.status===401||X.error?.status===403){window.location.href="/login";return}throw new Error(`Failed to fetch jobs: ${X.error?.message}`)}p(X.data.jobs||[])}catch(X){_(X instanceof Error?X.message:"Unknown error")}},Q=setInterval(Z,5e3);return Z(),()=>clearInterval(Q)},[c,xe,Ne]),w.useEffect(()=>{if(!h)return;const Z=async()=>{try{const Q=await we.get(Ae.WORKFLOWS.LOGS(xe,Ne,h.gitHubJobId));if(!Q.success){const B=Na(Q.rateLimit);if(B){_(B);return}if(Q.error?.status===403)_(Ce.PERMISSION_ERROR);else if(Q.error?.status===401)_(xc.SESSION_EXPIRED),window.location.href="/login";else{console.log(Q);const J=Q.error?.details||"Unknown error";_(`${Ce.FAILED_TO_FETCH_LOGS}: ${J}`)}return}const X=Q.data;if(X.meta&&X.meta.isEmpty)y(""),_(Ce.FAILED_TO_FETCH_LOGS);else{y(X.logs||X);const B=V2(Q.rateLimit);B&&console.warn(B),_(null)}}catch(Q){const X=Q instanceof Error?Q.message:Ce.FAILED_TO_FETCH_LOGS;_(`${Ce.FAILED_TO_FETCH_LOGS}: ${X}`)}};if(Z(),h.status!=="completed"){const Q=setInterval(Z,5e3);return()=>clearInterval(Q)}},[h,xe,Ne]);const te=Z=>{g(Z),y(null)},ye=Z=>{const Q=Z.currentTarget;Q.scrollHeight-Q.scrollTop-Q.clientHeight<100&&!W&&l.length>=z&&me()},me=async()=>{if(!W){ae(!0);try{const Z=Ae.PIPELINES.LIST+`?offset=${M+z}&limit=${z}`,Q=await we.get(Z);if(!Q.success)throw new Error("Failed to fetch more pipelines");const X=Q.data;i(B=>[...B,...X]),P(B=>B+z)}catch(Z){console.error("Error loading more pipelines:",Z)}finally{ae(!1)}}},ve=Z=>{d(Z),g(null),p([])};return C&&l.length===0?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"animate-spin",children:t.jsx(He,{className:"h-8 w-8 text-blue-600"})})}):t.jsxs("div",{children:[t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 h-[50vh] overflow-hidden",children:[t.jsx("div",{className:"lg:col-span-1 overflow-y-auto border-r border-gray-200",onScroll:ye,children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Pipelines"}),R("maintain")&&t.jsx(Y2,{owner:xe,repo:Ne})]}),N&&t.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:t.jsx("p",{className:"text-xs text-red-700",children:N})}),t.jsx("div",{className:"space-y-2",children:l.length===0?t.jsx("p",{className:"text-sm text-gray-500",children:"No pipelines found"}):t.jsxs(t.Fragment,{children:[l.map(Z=>t.jsx("div",{className:"w-full text-left p-3 rounded-lg border transition-colors border-gray-200 hover:bg-gray-50",children:t.jsxs("div",{className:"flex items-start gap-2",children:[ew(Z.currentStatus,Z.currentConclusion||null,b.has(Z.id)),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium text-sm text-gray-900 truncate",children:Z.packageName}),t.jsxs("p",{className:"text-xs text-gray-500",children:["v",Z.releaseVersion]}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:Z.workflowName})]})]})},Z.id)),W&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx("div",{className:"animate-spin",children:t.jsx(He,{className:"h-5 w-5 text-blue-600"})})})]})})]})}),t.jsx("div",{className:"lg:col-span-1 overflow-y-auto border-r border-gray-200",children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Runs"}),t.jsx(q2,{owner:xe,repo:Ne,packageName:r,onSelectRun:ve,runId:c,limit:oe})]})}),t.jsx("div",{className:"lg:col-span-1 overflow-y-auto border-r border-gray-200",children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Jobs"}),t.jsx("div",{className:"space-y-2",children:m.length?t.jsx(J2,{jobs:m,selectedJob:h,onSelectJob:te}):c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"animate-spin",children:t.jsx(He,{className:"h-8 w-8 text-blue-600"})})}):t.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:t.jsx("p",{className:"text-sm",children:"Select a run to view jobs"})})})]})})]}),t.jsx("div",{className:"lg:col-span-1 overflow-hidden border-t pt-2 h-[50vh]",children:t.jsxs("div",{className:"p-4 h-full overflow-hidden flex flex-col",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Logs"}),h&&v?t.jsx(z2,{steps:(()=>{const Z=Z2(v);let Q=0;const X=B=>B.map(J=>{Q++;const q=J.logs.at(0)?.split(" ")[0],S=J.logs.at(-1)?.split(" ")[0];return{stepNumber:Q,stepName:J.name,level:J.level,status:"",conclusion:"",startedAt:q,completedAt:S,logs:J.logs.map((D,Y)=>({lineNumber:Y+1,timestamp:new Date().toISOString(),content:D,ansiContent:D})),children:J.children?X(J.children):void 0}});return X(Z)})(),jobName:h.name,jobStatus:h.status,jobConclusion:h.conclusion,gitHubLogsUrl:h.htmlUrl}):h?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"animate-spin",children:t.jsx(He,{className:"h-8 w-8 text-blue-600"})})}):t.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:t.jsx("p",{className:"text-sm",children:"Select a job to view logs"})})]})})]})}function nw(){const{session:r}=zr();return r?t.jsx("div",{className:"h-screen overflow-hidden",children:t.jsx(tw,{})}):t.jsx("div",{className:"flex items-center justify-center h-screen",children:t.jsx("p",{className:"text-gray-600",children:"Please sign in to view pipelines"})})}const rw="_container_qu28c_5",sw="_header_qu28c_13",aw="_subtitle_qu28c_26",lw="_error_qu28c_33",iw="_healthSection_qu28c_43",ow="_statusBadge_qu28c_51",cw="_statusDot_qu28c_59",uw="_stats_qu28c_85",dw="_stat_qu28c_51",mw="_statLabel_qu28c_99",fw="_statValue_qu28c_106",hw="_timestamp_qu28c_113",pw="_pipelinesSection_qu28c_120",xw="_pipelinesList_qu28c_135",gw="_pipelineItem_qu28c_143",yw="_pipelineHeader_qu28c_151",vw="_pipelineId_qu28c_158",jw="_pipelineStatus_qu28c_168",ww="_pipelineProgress_qu28c_193",Nw="_progressBar_qu28c_200",bw="_progressFill_qu28c_208",Sw="_progressText_qu28c_215",kw="_pipelinePackages_qu28c_222",Ew="_featuresSection_qu28c_230",Oe={container:rw,header:sw,subtitle:aw,error:lw,healthSection:iw,statusBadge:ow,statusDot:cw,stats:uw,stat:dw,statLabel:mw,statValue:fw,timestamp:hw,pipelinesSection:pw,pipelinesList:xw,pipelineItem:gw,pipelineHeader:yw,pipelineId:vw,pipelineStatus:jw,pipelineProgress:ww,progressBar:Nw,progressFill:bw,progressText:Sw,pipelinePackages:kw,featuresSection:Ew};function Cw(){const[r,s]=w.useState(null),[l,i]=w.useState([]),[c,d]=w.useState(!0),[m,p]=w.useState(null);return w.useEffect(()=>{const h=async()=>{try{d(!0);const v=await Fr.getHealth();v.success&&s(v.data);const y=await Fr.getPipelines(void 0,5);y.success&&i(y.data.pipelines||[]),p(null)}catch(v){p(v instanceof Error?v.message:"Failed to fetch release status")}finally{d(!1)}};h();const g=setInterval(h,1e4);return()=>clearInterval(g)},[]),c&&!r?t.jsx("div",{className:Oe.container,children:t.jsx("p",{children:"Loading release system status..."})}):t.jsxs("div",{className:Oe.container,children:[t.jsxs("div",{className:Oe.header,children:[t.jsx("h3",{children:"🚀 Independent Release Engine"}),t.jsx("p",{className:Oe.subtitle,children:"New release system (independent of Changesets)"})]}),m&&t.jsxs("div",{className:Oe.error,children:["Error: ",m]}),r&&t.jsxs("div",{className:Oe.healthSection,children:[t.jsxs("div",{className:Oe.statusBadge,children:[t.jsx("span",{className:Oe.statusDot,"data-status":r.status}),t.jsxs("span",{children:["System Status: ",t.jsx("strong",{children:r.status})]})]}),t.jsxs("div",{className:Oe.stats,children:[t.jsxs("div",{className:Oe.stat,children:[t.jsx("span",{className:Oe.statLabel,children:"Active Pipelines"}),t.jsx("span",{className:Oe.statValue,children:r.activePipelines})]}),t.jsxs("div",{className:Oe.stat,children:[t.jsx("span",{className:Oe.statLabel,children:"Total Pipelines"}),t.jsx("span",{className:Oe.statValue,children:r.totalPipelines})]})]}),r.timestamp&&t.jsxs("p",{className:Oe.timestamp,children:["Last updated: ",new Date(r.timestamp).toLocaleTimeString()]})]}),l.length>0&&t.jsxs("div",{className:Oe.pipelinesSection,children:[t.jsx("h4",{children:"Recent Pipelines"}),t.jsx("div",{className:Oe.pipelinesList,children:l.map(h=>t.jsxs("div",{className:Oe.pipelineItem,children:[t.jsxs("div",{className:Oe.pipelineHeader,children:[t.jsx("span",{className:Oe.pipelineId,children:h.pipelineId}),t.jsx("span",{className:Oe.pipelineStatus,"data-status":h.status,children:h.status})]}),t.jsxs("div",{className:Oe.pipelineProgress,children:[t.jsx("div",{className:Oe.progressBar,children:t.jsx("div",{className:Oe.progressFill,style:{width:`${h.progress}%`}})}),t.jsxs("span",{className:Oe.progressText,children:[h.progress,"%"]})]}),t.jsxs("p",{className:Oe.pipelinePackages,children:["Packages: ",h.packagesToPublish?.join(", ")||"None"]})]},h.pipelineId))})]}),t.jsxs("div",{className:Oe.featuresSection,children:[t.jsx("h4",{children:"Key Features"}),t.jsxs("ul",{children:[t.jsx("li",{children:"✅ Independent of @changesets/cli"}),t.jsx("li",{children:"✅ Git-based change detection (Conventional Commits)"}),t.jsx("li",{children:"✅ Internal semantic versioning (SemVer)"}),t.jsx("li",{children:"✅ Direct npm publishing (no CLI dependency)"}),t.jsx("li",{children:"✅ Hybrid execution (Node.js + GitHub Actions)"}),t.jsx("li",{children:"✅ Encrypted token handling"}),t.jsx("li",{children:"✅ Full audit logging"})]})]})]})}const _w="_container_9usjn_5",Tw="_header_9usjn_11",Rw="_error_9usjn_30",Aw="_warning_9usjn_40",Pw="_content_9usjn_50",Lw="_section_9usjn_55",Ow="_packageList_9usjn_70",Iw="_packageItem_9usjn_76",Mw="_packageName_9usjn_104",Dw="_packageVersion_9usjn_110",Fw="_button_9usjn_116",Uw="_publishButton_9usjn_140",Bw="_options_9usjn_150",zw="_option_9usjn_150",Hw="_readinessResults_9usjn_171",$w="_readinessItem_9usjn_177",Vw="_ready_9usjn_184",Ww="_notReady_9usjn_189",Gw="_readinessHeader_9usjn_194",Kw="_readinessStatus_9usjn_202",qw="_readinessName_9usjn_206",Yw="_readinessBlockers_9usjn_210",Qw="_readinessWarnings_9usjn_243",Fe={container:_w,header:Tw,error:Rw,warning:Aw,content:Pw,section:Lw,packageList:Ow,packageItem:Iw,packageName:Mw,packageVersion:Dw,button:Fw,publishButton:Uw,options:Bw,option:zw,readinessResults:Hw,readinessItem:$w,ready:Vw,notReady:Ww,readinessHeader:Gw,readinessStatus:Kw,readinessName:qw,readinessBlockers:Yw,readinessWarnings:Qw};function Jw(){const[r,s]=w.useState([]),[l,i]=w.useState([]),[c,d]=w.useState(null),[m,p]=w.useState(!0),[h,g]=w.useState(!1),[v,y]=w.useState(null),[C,F]=w.useState(!0);w.useEffect(()=>{N()},[]);const N=async()=>{try{p(!0);const P=await Fr.getPackages();P.success&&(s(P.data.packages||[]),y(null))}catch(P){y(P instanceof Error?P.message:"Failed to fetch packages")}finally{p(!1)}},_=P=>{i(W=>W.includes(P)?W.filter(ae=>ae!==P):[...W,P])},b=async()=>{if(l.length===0){y("Please select at least one package");return}try{p(!0);const P=l.reduce((ae,z)=>{const oe=r.find(xe=>xe.name===z);return oe&&(ae[z]=oe.path),ae},{}),W=await Fr.checkReadiness(l,P);W.success?(d(W.data.checks||[]),y(null)):y(W.error?.message||"Failed to check readiness")}catch(P){y(P instanceof Error?P.message:"Failed to check readiness")}finally{p(!1)}},U=async()=>{if(l.length===0){y("Please select at least one package");return}try{g(!0);const P=l.reduce((ae,z)=>{const oe=r.find(xe=>xe.name===z);return oe&&(ae[z]=oe.path),ae},{}),W=await Fr.startPublish(l,P,{method:"node",dryRun:C,autoTag:!0,createReleases:!1});W.success?(y(null),i([]),d(null),alert(C?`✅ Dry-run successful for ${l.length} package(s)`:`✅ Publishing started for ${l.length} package(s)
20
20
  Pipeline ID: ${W.data.pipelineId}`)):y(W.error?.message||"Failed to start publish")}catch(P){y(P instanceof Error?P.message:"Failed to start publish")}finally{g(!1)}},R=c?.filter(P=>l.includes(P.packageName)),M=R?.every(P=>P.isReady)??!1;return t.jsxs("div",{className:Fe.container,children:[t.jsxs("div",{className:Fe.header,children:[t.jsx("h1",{children:"🚀 Independent Release Manager"}),t.jsx("p",{children:"New release system independent of Changesets"})]}),t.jsx(Cw,{}),v&&t.jsx("div",{className:Fe.error,children:v}),t.jsxs("div",{className:Fe.content,children:[t.jsxs("div",{className:Fe.section,children:[t.jsx("h2",{children:"Step 1: Select Packages"}),m&&!r.length?t.jsx("p",{children:"Loading packages..."}):r.length===0?t.jsx("p",{children:"No packages found"}):t.jsx("div",{className:Fe.packageList,children:r.map(P=>t.jsxs("label",{className:Fe.packageItem,children:[t.jsx("input",{type:"checkbox",checked:l.includes(P.name),onChange:()=>_(P.name)}),t.jsx("span",{className:Fe.packageName,children:P.name}),t.jsxs("span",{className:Fe.packageVersion,children:["v",P.version]})]},P.name))})]}),t.jsxs("div",{className:Fe.section,children:[t.jsx("h2",{children:"Step 2: Check Readiness"}),t.jsx("button",{onClick:b,disabled:l.length===0||m,className:Fe.button,children:"Check Readiness"}),R&&R.length>0&&t.jsx("div",{className:Fe.readinessResults,children:R.map(P=>t.jsxs("div",{className:`${Fe.readinessItem} ${P.isReady?Fe.ready:Fe.notReady}`,children:[t.jsxs("div",{className:Fe.readinessHeader,children:[t.jsx("span",{className:Fe.readinessStatus,children:P.isReady?"✅":"❌"}),t.jsx("span",{className:Fe.readinessName,children:P.packageName})]}),P.blockers.length>0&&t.jsxs("div",{className:Fe.readinessBlockers,children:[t.jsx("strong",{children:"Blockers:"}),t.jsx("ul",{children:P.blockers.map((W,ae)=>t.jsx("li",{children:W},ae))})]}),P.warnings.length>0&&t.jsxs("div",{className:Fe.readinessWarnings,children:[t.jsx("strong",{children:"Warnings:"}),t.jsx("ul",{children:P.warnings.map((W,ae)=>t.jsx("li",{children:W},ae))})]})]},P.packageName))})]}),t.jsxs("div",{className:Fe.section,children:[t.jsx("h2",{children:"Step 3: Publish Packages"}),t.jsx("div",{className:Fe.options,children:t.jsxs("label",{className:Fe.option,children:[t.jsx("input",{type:"checkbox",checked:C,onChange:P=>F(P.target.checked)}),t.jsx("span",{children:"Dry-run (test without publishing)"})]})}),t.jsx("button",{onClick:U,disabled:l.length===0||h||!M,className:`${Fe.button} ${Fe.publishButton}`,children:h?"Publishing...":C?"Test Publish (Dry-run)":"Publish to npm"}),l.length>0&&!M&&!C&&t.jsx("div",{className:Fe.warning,children:"⚠️ Some packages are not ready. Run dry-run first or fix blockers."})]})]})]})}const Xw={Dashboard:Rv,PackagesOverview:Av,PackageDetail:Pv,DependencyGraph:Zv,HealthStatus:e1,PublishControl:m1,CIIntegration:T1,ConfigInspector:i2,ReleaseManager:x2,Pipeline:nw,IndependentReleaseManagerPage:Jw},Zw=({componentName:r})=>{const s=Xw[r];return s?t.jsx(s,{}):t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Page Not Found"}),t.jsx("p",{className:"text-gray-600",children:"The requested page could not be found."})]})})};function eN(){return t.jsxs(Of,{children:[If.map(r=>t.jsx(ys,{path:r.path,element:t.jsx(Zw,{componentName:r.component})},r.path)),t.jsx(ys,{path:"*",element:t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔍"}),t.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"404 - Page Not Found"}),t.jsx("p",{className:"text-gray-600 mb-4",children:"The page you're looking for doesn't exist or has been moved."}),t.jsx("a",{href:"/",className:"text-blue-600 hover:text-blue-500 font-medium",children:"Go back to Dashboard"})]})})})]})}const tN=w.createContext(void 0);function nN({children:r}){const[s,l]=w.useState(new Map),[i,c]=w.useState(!1),[d,m]=w.useState(null),p=(F,N)=>`${F}/${N}`,h=w.useCallback(async(F,N,_)=>{try{c(!0),m(null);const b=p(N,_);if(s.has(b))return s.get(b)||null;const U=await we.get(`/permissions/${N}/${_}`);if(!U.success)throw U.error.status===401?new Error(Ce.AUTHENTICATION_ERROR):new Error(Ce.FAILED_TO_CHECK_PERMISSION);const R=U.data,M={permission:R.permission,role:R.role,canAdmin:R.canAdmin,canMaintain:R.canMaintain,canWrite:R.canWrite,canRead:R.canRead,denied:R.denied};return l(P=>{const W=new Map(P);return W.set(b,M),W}),M}catch(b){const U=b instanceof Error?b.message:"Permission check failed";return m(U),null}finally{c(!1)}},[s]),g=w.useCallback(async(F,N,_,b)=>{try{c(!0),m(null);const U=await we.post(`/permissions/${N}/${_}/can-action`,{action:b});if(!U.success)throw new Error(Ce.FAILED_TO_CHECK_ACTION_PERMISSION);return U.data.can===!0}catch(U){return console.error("Action permission check error:",U),!1}finally{c(!1)}},[]),v=w.useCallback((F,N)=>{const _=p(F,N);l(b=>{const U=new Map(b);return U.delete(_),U})},[]),y=w.useCallback(()=>{l(new Map)},[]),C={permissions:s,isLoading:i,error:d,checkPermission:h,canPerformAction:g,invalidatePermission:v,invalidateAll:y};return t.jsx(tN.Provider,{value:C,children:r})}function rN(){const{login:r,isLoading:s,error:l}=zr(),[i,c]=w.useState(!1),d=async()=>{c(!0),await r()};return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br p-5",children:t.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:[t.jsxs("div",{className:"bg-gradient-to-br from-primary-500 to-primary-700 text-white p-8 text-center",children:[t.jsx("h1",{className:"text-4xl font-bold m-0",children:"MonoDog"}),t.jsx("p",{className:"text-sm opacity-90 font-medium mt-2 m-0",children:"Monorepo Analytics & Management"})]}),t.jsxs("div",{className:"p-10",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 text-center mb-8",children:"Sign in to your account"}),l&&t.jsx("div",{className:"bg-red-100 text-red-700 px-4 py-3 rounded-lg mb-5 text-sm border-l-4 border-red-700",children:l}),t.jsxs("button",{onClick:d,disabled:s||i,className:"w-full flex items-center justify-center gap-3 px-5 py-3 bg-primary-600 text-white rounded-lg font-semibold text-base cursor-pointer transition-all duration-300 disabled:opacity-60 disabled:cursor-not-allowed hover:enabled:bg-primary-700 hover:enabled:-translate-y-0.5 hover:enabled:shadow-lg mb-8",children:[t.jsx(Yx,{}),"Continue with GitHub"]}),t.jsxs("div",{className:"flex items-center gap-3 my-8 text-gray-400 text-xs font-semibold uppercase tracking-widest",children:[t.jsx("div",{className:"flex-1 h-px bg-gray-200"}),t.jsx("span",{children:"GitHub OAuth Authentication"}),t.jsx("div",{className:"flex-1 h-px bg-gray-200"})]}),t.jsxs("div",{className:"bg-primary-50 rounded-lg p-5 border-l-4 border-primary-500",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-900 mb-3 uppercase tracking-wide",children:"Requested Permissions"}),t.jsxs("ul",{className:"m-0 p-0 list-none space-y-2",children:[t.jsxs("li",{className:"text-sm text-gray-700",children:[t.jsx("code",{className:"bg-white text-primary-500 px-1.5 py-0.5 rounded text-xs font-semibold",children:"read:user"})," - Read your profile information"]}),t.jsxs("li",{className:"text-sm text-gray-700",children:[t.jsx("code",{className:"bg-white text-primary-500 px-1.5 py-0.5 rounded text-xs font-semibold",children:"user:email"})," - Access your email address"]}),t.jsxs("li",{className:"text-sm text-gray-700",children:[t.jsx("code",{className:"bg-white text-primary-500 px-1.5 py-0.5 rounded text-xs font-semibold",children:"repo"})," - Access your repositories (required for private repos)"]})]})]})]}),t.jsx("div",{className:"bg-gray-50 px-10 py-5 border-t border-gray-200 text-center",children:t.jsx("p",{className:"text-xs text-gray-500 leading-relaxed m-0",children:"By signing in, you agree to our Terms of Service and Privacy Policy"})})]})})}function sN(){const r=Ac(),[s,l]=w.useState(!0),[i,c]=w.useState(null);return w.useEffect(()=>{(async()=>{try{const m=new URLSearchParams(window.location.search),p=m.get("code"),h=m.get("state"),g=m.get("error"),v=m.get("error_description");if(g){c(`${g}: ${v}`),l(!1);return}if(!p||!h){c("Missing authorization code or state"),l(!1);return}const y=await we.get(Ae.AUTH.CALLBACK+`?code=${p}&state=${h}`);if(!y.success){c(y.error?.message||"Authentication failed"),l(!1);return}const C=y.data;if(!C.success||!C.sessionToken){c(Ce.AUTHENTICATION_ERROR),l(!1);return}const F=window.__authContext;if(F&&F.handleOAuthCallback)if(await F.handleOAuthCallback(C.sessionToken,C.permission)){const _=C.redirectUrl||"/";r(_)}else c(Ce.AUTHENTICATION_ERROR);else c(Ce.AUTHENTICATION_ERROR)}catch(m){const p=m instanceof Error?m.message:Ce.UNKNOWN_ERROR;c(p)}finally{l(!1)}})()},[r]),t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary-500 to-primary-700 p-5",children:t.jsx("div",{className:"bg-white rounded-xl shadow-2xl max-w-sm text-center p-10",children:s?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-10 h-10 border-4 border-gray-200 border-t-indigo-500 rounded-full animate-spin mx-auto my-5"}),t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mt-5 mb-2",children:"Completing Authentication..."}),t.jsx("p",{className:"text-gray-700 text-sm leading-relaxed",children:"Please wait while we verify your GitHub account."})]}):i?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-5xl mb-5",children:"Warning!"}),t.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-3",children:"Authentication Failed"}),t.jsx("p",{className:"text-gray-700 text-sm leading-relaxed mb-5",children:i}),t.jsx("button",{onClick:()=>r("/login"),className:"inline-block px-6 py-3 bg-primary-500 text-white rounded-lg font-semibold text-sm cursor-pointer transition-all duration-300 hover:bg-primary-600 hover:-translate-y-0.5 hover:shadow-lg",children:"Return to Login"})]}):null})})}function aN({message:r="Loading..."}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin mb-4"}),t.jsx("p",{className:"text-gray-600",children:r})]})}function lN({children:r}){const{isAuthenticated:s,isLoading:l}=zr();return l?t.jsx(aN,{}):s?t.jsx(t.Fragment,{children:r}):t.jsx(vx,{to:"/login",replace:!0})}function iN(){return t.jsx(Cx,{children:t.jsx(Ly,{children:t.jsx(nN,{children:t.jsxs(Of,{children:[t.jsx(ys,{path:"/login",element:t.jsx(rN,{})}),t.jsx(ys,{path:"/auth/callback",element:t.jsx(sN,{})}),t.jsx(ys,{path:"/*",element:t.jsx(lN,{children:t.jsx(Oy,{children:t.jsx(eN,{})})})})]})})})})}const Nf=document.getElementById("root");Nf&&E0.createRoot(Nf).render(t.jsx(iN,{}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>MonoDog Dashboard</title>
7
- <script type="module" crossorigin src="/assets/index-DhnTuHQO.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CfZ1i92y.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-BaDCAFTq.css">
9
9
  </head>
10
10
  <body class="bg-gray-100 text-gray-900">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manojkmfsi/monodog",
3
- "version": "1.1.48",
3
+ "version": "1.2.0",
4
4
  "description": "App for monodog monorepo",
5
5
  "license": "MIT",
6
6
  "author": "Mindfiredigital",
@@ -28,23 +28,6 @@
28
28
  "bin": {
29
29
  "monodog": "dist/setup.js"
30
30
  },
31
- "scripts": {
32
- "dev": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') tsx watch src/serve.ts --dev --debug",
33
- "serve": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') tsx dist/serve.js",
34
- "prepublishOnly": "pnpm build",
35
- "build": "rm -rf dist && tsc",
36
- "test:coverage": "jest --coverage --silent",
37
- "prestart": "npm run build",
38
- "clean": "rm -rf dist node_modules/.cache",
39
- "lint": "eslint .",
40
- "lint:fix": "eslint . --fix",
41
- "db:url": "node dist/get-db-url.js",
42
- "schema:format": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma format",
43
- "schema:validate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma validate",
44
- "generate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma generate",
45
- "migrate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma migrate deploy",
46
- "migrate:reset": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma migrate reset --force"
47
- },
48
31
  "keywords": [
49
32
  "monodog",
50
33
  "monorepo",
@@ -108,5 +91,21 @@
108
91
  },
109
92
  "prisma": {
110
93
  "schema": "./prisma/schema"
94
+ },
95
+ "scripts": {
96
+ "dev": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') tsx watch src/serve.ts --dev --debug",
97
+ "serve": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') tsx dist/serve.js",
98
+ "build": "rm -rf dist && tsc",
99
+ "test:coverage": "jest --coverage --silent",
100
+ "prestart": "npm run build",
101
+ "clean": "rm -rf dist node_modules/.cache",
102
+ "lint": "eslint .",
103
+ "lint:fix": "eslint . --fix",
104
+ "db:url": "node dist/get-db-url.js",
105
+ "schema:format": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma format",
106
+ "schema:validate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma validate",
107
+ "generate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma generate",
108
+ "migrate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma migrate deploy",
109
+ "migrate:reset": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma migrate reset --force"
111
110
  }
112
- }
111
+ }
Binary file