@manojkmfsi/monodog 1.1.41 → 1.1.42
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/CHANGELOG.md
CHANGED
|
@@ -17,4 +17,3 @@ Error generating stack: `+f.message+`
|
|
|
17
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 $j=new Array(256),Vj=new Array(256);for(var hs=0;hs<256;hs++)$j[hs]=af(hs)?1:0,Vj[hs]=af(hs);const Wj=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"}},of=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"}},Gj=(r,s)=>r.filter(a=>{const i=s.section==="all"||a.id===s.section,c=s.type==="all"||a.type===s.type,d=s.status==="all"||s.status==="secrets"&&a.hasSecrets||s.status==="standard"&&!a.hasSecrets,m=!s.search||a.name.toLowerCase().includes(s.search.toLowerCase())||a.path.toLowerCase().includes(s.search.toLowerCase());return i&&c&&d&&m}),Kj=r=>[...new Set(r.map(s=>s.type))],Yj=r=>{if(r===0)return"0 Bytes";const s=1024,a=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(r)/Math.log(s));return parseFloat((r/Math.pow(s,i)).toFixed(2))+" "+a[i]},qj=r=>new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),wh=r=>{const s=r.split(".").pop()?.toLowerCase(),a={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":a[s||""]||"text"},Qj=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 a=r;return s.forEach(i=>{a=a.replace(i,(c,d,m)=>{const p="*".repeat(Math.min(m.length,8));return c.replace(m,p)})}),a},Jj=r=>{switch(wh(r)){case"json":return t.jsx(qa,{className:"w-6 h-6 text-primary-600"});case"yaml":return t.jsx(qa,{className:"w-6 h-6 text-primary-600"});case"javascript":case"typescript":return t.jsx(Mr,{className:"w-6 h-6 text-primary-600"});case"env":return"🔐";case"markdown":return"📝";default:return t.jsx(_c,{className:"w-6 h-6 text-primary-600"})}};function Xj({configs:r,selectedConfig:s,onConfigSelect:a,filters:i,onFiltersChange:c}){const d=Kj(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(Lc,{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(li,{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(_c,{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:()=>a(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:Jj(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 ${Wj(m.type)}`,children:m.type}),t.jsx("span",{className:"text-xs text-gray-400",children:Yj(m.size)})]}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:qj(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 Zj({isEditing:r,canEdit:s,hasSecrets:a,showSecrets:i,saving:c,onStartEdit:d,onSaveEdit:m,onCancelEdit:p,onToggleSecrets:h,onRefresh:g,content:v}){const[y,k]=w.useState(!1),M=async()=>{try{const N=v||"No content available";await navigator.clipboard.writeText(N),k(!0),setTimeout(()=>{k(!1)},4e3)}catch(N){console.error("Failed to copy to clipboard:",N),k(!0),setTimeout(()=>k(!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(dr,{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(dr,{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(ti,{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(ws,{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(Rx,{className:"w-4 h-4 mr-1"}),"Edit"]}),a&&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(Tx,{className:"w-4 h-4 mr-1"}),"Hide Secrets"]}):t.jsxs(t.Fragment,{children:[t.jsx(kx,{className:"w-4 h-4 mr-1"}),"Show Secrets"]})})]}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsx("button",{onClick:M,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(Lx,{className:"w-4 h-4 mr-1"}),"Copied!"]}):t.jsxs(t.Fragment,{children:[t.jsx(Ox,{className:"w-4 h-4 mr-1"}),"Copy"]})})})]})}function e2({config:r,isEditing:s,editValue:a,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(qa,{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=wh(r.name),v=p?r.content:Qj(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(qa,{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:a,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 t2({validation:r,configName:s}){const a=h=>{switch(h){case"valid":return t.jsx(Rt,{className:"w-5 h-5 text-green-500"});case"warning":return t.jsx(st,{className:"w-5 h-5 text-yellow-500"});case"error":return t.jsx(It,{className:"w-5 h-5 text-red-500"});default:return t.jsx(xs,{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(xs,{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:[a(c),t.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${of(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:[a(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 ${of(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 n2(){const[r,s]=w.useState(!0),[a,i]=w.useState(!1),[c,d]=w.useState(null),[m,p]=w.useState([]),[h,g]=w.useState(null),[v,y]=w.useState(!1),[k,M]=w.useState(""),[N,R]=w.useState(!1),[b,D]=w.useState({section:"all",type:"all",status:"all",search:""});w.useEffect(()=>{(async()=>{try{s(!0);const ce=(await Mt.getConfigurationFiles()).map(ge=>({id:ge.id||ge.name,name:ge.name,path:ge.path||ge.name,type:ge.type||"text",content:ge.content||"",size:ge.content?.length||0,lastModified:ge.lastModified||new Date().toISOString(),hasSecrets:ge.hasSecrets||!1,isEditable:ge.isEditable!==!1,validation:ge.validation||[]}));p(ce),d(null)}catch(ve){d(be.FAILED_TO_FETCH_PACKAGES),console.error("Error fetching config files:",ve)}finally{s(!1)}})()},[]);const _=Gj(m,b),I=h&&m.find(te=>te.id===h)||null,U=()=>{window.location.reload()},q=te=>{g(te),y(!1),M("")},he=()=>{I&&(y(!0),M(I.content))},$=async()=>{if(I&&!a)try{i(!0),d(null);const te=await Mt.saveConfigurationFile(I.id,k);p(ve=>ve.map(ce=>ce.id===h?{...te,isEditable:ce.isEditable}:ce)),h===I.id&&g(I.id),y(!1),M("")}catch(te){console.error("Error saving config file:",te),d(`${be.FAILED_TO_SAVE_CONFIG}: ${te.message}`)}finally{i(!1)}},pe=()=>{y(!1),M("")},we=()=>{R(!N)},je=()=>{window.location.reload()};return r?t.jsx(C1,{}):c?t.jsx(E1,{error:c,onRetry:je}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(k1,{onRefresh:U,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(Xj,{configs:_,selectedConfig:h,onConfigSelect:q,filters:b,onFiltersChange:D})}),t.jsxs("div",{className:"lg:col-span-2 flex flex-col",children:[I&&t.jsx("div",{className:"mb-4",children:t.jsx(Zj,{isEditing:v,canEdit:I.isEditable,hasSecrets:I.hasSecrets,showSecrets:N,saving:a,onStartEdit:he,onSaveEdit:$,onCancelEdit:pe,onToggleSecrets:we,onRefresh:U,content:v?k:I?.content})}),t.jsx("div",{className:"flex-1",children:t.jsx(e2,{config:I,isEditing:v,editValue:k,saving:a,onStartEdit:he,onSaveEdit:$,onCancelEdit:pe,onValueChange:M,showSecrets:N,onToggleSecrets:we})})]}),t.jsx("div",{className:"lg:col-span-1 space-y-6",children:t.jsx(t2,{validation:I?.validation||[],configName:I?.name||"No file selected"})})]}),_.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(_c,{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:()=>D({section:"all",type:"all",status:"all",search:""}),className:"text-blue-600 hover:text-blue-500",children:"Clear Filters"})]})]})}function r2({packages:r,onConfirm:s,loading:a}){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 k=new Set(i);k.has(y)?k.delete(y):k.add(y),c(k)},g=()=>{i.size===p.length?c(new Set):c(new Set(p.map(y=>y.name)))},v=()=>{const y=r.filter(k=>i.has(k.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||a,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 s2={major:"Breaking changes, incompatible API changes",minor:"New features, backward compatible",patch:"Bug fixes, patches, backward compatible"};function l2({packages:r,onConfirm:s,onBack:a}){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(s2).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:a,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 a2({packages:r,existingChangesets:s,onConfirm:a,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(Gx),h(y),y.length===0},v=()=>{g()&&a(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:Wx,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,k)=>t.jsx("p",{className:"text-sm text-red-600",children:y},k))})]}),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(yl,{})," ",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 i2({validation:r,packages:s,onConfirm:a,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(ti,{}):t.jsx(ws,{})}),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:a,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 o2({packages:r,summary:s,onReset:a}){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(yl,{})," 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:a,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(yl,{})]}),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(yl,{})]})]})]})}function c2({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 u2({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 d2(){const{isAuthenticated:r,hasPermission:s}=Fr(),[a,i]=w.useState("select"),[c,d]=w.useState([]),[m,p]=w.useState(""),[h,g]=w.useState(!1),[v,y]=w.useState(null),[k,M]=w.useState(null),[N,R]=w.useState([]),[b,D]=w.useState([]);w.useEffect(()=>{_()},[]);const _=async()=>{try{g(!0);const te=await Te.get(Re.PUBLISH.PACKAGES);if(te.success)R(te.data.packages||[]);else{console.warn("Failed to fetch packages:",te.error?.message);const ce=await Te.get(Re.PACKAGES.LIST);ce.success&&R(ce.data||[])}const ve=await Te.get(Re.PUBLISH.CHANGESETS);ve.success?D(ve.data.changesets||[]):(ve.error?.status===401||ve.error?.status===403)&&(window.location.href="/login"),y(null)}catch(te){const ve=te instanceof Error?te.message:be.FAILED_TO_FETCH_PACKAGES;y(ve),console.error("Error fetching workspace data:",te)}finally{g(!1)}},I=te=>{const ve=te.map(ce=>({name:ce.name,currentVersion:ce.version,newVersion:ce.version,bumpType:"patch",affectedDependencies:ce.dependents||[]}));d(ve),i("bump")},U=te=>{d(te),i("preview")},q=te=>{p(te),he(c,te)},he=async(te,ve)=>{try{g(!0);const ce=await Te.post(Re.PUBLISH.PREVIEW,{packages:te.map(Q=>Q.name),bumps:te.map(Q=>({package:Q.name,bumpType:Q.bumpType})),summary:ve});if(!ce.success)throw new Error(be.VALIDATION_FAILED);const ge=ce.data,oe={isValid:ge.isValid??!0,errors:ge.errors??[],warnings:ge.warnings??[],checks:ge.checks??{permissions:!0,workingTreeClean:!0,ciPassing:!0,versionAvailable:!0}};M(oe),i("validate"),y(null)}catch(ce){const ge=ce instanceof Error?ce.message:"Validation error";y(ge),console.error("Validation error:",ce)}finally{g(!1)}},$=async()=>{try{if(!s("maintain")){y(be.PERMISSION_ERROR);return}if(g(!0),!(await Te.post(Re.PUBLISH.CHANGESETS,{packages:c.map(ce=>ce.name),bumps:c.map(ce=>({package:ce.name,bumpType:ce.bumpType})),summary:m})).success)throw new Error(be.FAILED_TO_CREATE_CHANGESET);if(!(await Te.post(Re.PUBLISH.TRIGGER,{packages:c})).success)throw new Error(be.FAILED_TO_TRIGGER_PUBLISH);i("confirm"),y(null)}catch(te){const ve=te instanceof Error?te.message:"Publishing error";y(ve)}finally{g(!1)}},pe=()=>{i("select"),d([]),p(""),M(null),y(null),_()};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&&a==="select"&&N.length===0)return t.jsx(c2,{message:"Loading workspace packages..."});if(v&&a==="select")return t.jsx(u2,{error:v,onRetry:_});const we=s("write"),je=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 Changesets"})]}),t.jsxs("div",{className:"text-sm text-gray-500",children:["Step ",["select","bump","preview","validate","confirm"].indexOf(a)+1," of 5"]})]}),!we&&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&&a==="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," unpublished changeset(s) detected"]}),t.jsx("p",{className:"text-blue-600 text-sm mt-1",children:"Review existing changesets or pull the latest changes and refresh the dashboard before creating a new one."})]}),a==="select"&&!we&&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."})]}),a==="select"&&we&&t.jsx(r2,{packages:N,onConfirm:I,loading:h}),a==="bump"&&we&&t.jsx(l2,{packages:c,onConfirm:U,onBack:()=>i("select")}),a==="preview"&&we&&t.jsx(a2,{packages:c,existingChangesets:b,onConfirm:q,onBack:()=>i("bump"),loading:h}),a==="validate"&&!je&&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."})]}),a==="validate"&&je&&k&&t.jsx(i2,{validation:k,packages:c,onConfirm:$,onBack:()=>i("preview"),loading:h}),a==="confirm"&&t.jsx(o2,{packages:c,summary:m,onReset:pe}),t.jsx("div",{className:"flex gap-2 justify-center",children:["select","bump","preview","validate","confirm"].map((te,ve)=>t.jsx("div",{className:`h-2 flex-1 rounded-full transition-colors ${["select","bump","preview","validate","confirm"].indexOf(a)>=ve?"bg-primary-500":"bg-gray-300"}`},te))})]})}const{entries:Nh,setPrototypeOf:cf,isFrozen:m2,getPrototypeOf:f2,getOwnPropertyDescriptor:h2}=Object;let{freeze:yt,seal:Kt,create:yc}=Object,{apply:vc,construct:jc}=typeof Reflect<"u"&&Reflect;yt||(yt=function(s){return s});Kt||(Kt=function(s){return s});vc||(vc=function(s,a){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(a,c)});jc||(jc=function(s){for(var a=arguments.length,i=new Array(a>1?a-1:0),c=1;c<a;c++)i[c-1]=arguments[c];return new s(...i)});const Ha=vt(Array.prototype.forEach),p2=vt(Array.prototype.lastIndexOf),uf=vt(Array.prototype.pop),fl=vt(Array.prototype.push),x2=vt(Array.prototype.splice),Ka=vt(String.prototype.toLowerCase),tc=vt(String.prototype.toString),nc=vt(String.prototype.match),hl=vt(String.prototype.replace),g2=vt(String.prototype.indexOf),y2=vt(String.prototype.trim),an=vt(Object.prototype.hasOwnProperty),gt=vt(RegExp.prototype.test),pl=v2(TypeError);function vt(r){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var a=arguments.length,i=new Array(a>1?a-1:0),c=1;c<a;c++)i[c-1]=arguments[c];return vc(r,s,i)}}function v2(r){return function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return jc(r,a)}}function Ee(r,s){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ka;cf&&cf(r,null);let i=s.length;for(;i--;){let c=s[i];if(typeof c=="string"){const d=a(c);d!==c&&(m2(s)||(s[i]=d),c=d)}r[c]=!0}return r}function j2(r){for(let s=0;s<r.length;s++)an(r,s)||(r[s]=null);return r}function gn(r){const s=yc(null);for(const[a,i]of Nh(r))an(r,a)&&(Array.isArray(i)?s[a]=j2(i):i&&typeof i=="object"&&i.constructor===Object?s[a]=gn(i):s[a]=i);return s}function xl(r,s){for(;r!==null;){const i=h2(r,s);if(i){if(i.get)return vt(i.get);if(typeof i.value=="function")return vt(i.value)}r=f2(r)}function a(){return null}return a}const df=yt(["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"]),rc=yt(["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"]),sc=yt(["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"]),w2=yt(["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"]),lc=yt(["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"]),N2=yt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mf=yt(["#text"]),ff=yt(["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"]),ac=yt(["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"]),hf=yt(["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"]),$a=yt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),b2=Kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),S2=Kt(/<%[\w\W]*|[\w\W]*%>/gm),C2=Kt(/\$\{[\w\W]*/gm),E2=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),k2=Kt(/^aria-[\-\w]+$/),bh=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T2=Kt(/^(?:\w+script|data):/i),R2=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sh=Kt(/^html$/i),_2=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i);var pf=Object.freeze({__proto__:null,ARIA_ATTR:k2,ATTR_WHITESPACE:R2,CUSTOM_ELEMENT:_2,DATA_ATTR:E2,DOCTYPE_NAME:Sh,ERB_EXPR:S2,IS_ALLOWED_URI:bh,IS_SCRIPT_OR_DATA:T2,MUSTACHE_EXPR:b2,TMPLIT_EXPR:C2});const gl={element:1,text:3,progressingInstruction:7,comment:8,document:9},A2=function(){return typeof window>"u"?null:window},P2=function(s,a){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let i=null;const c="data-tt-policy-suffix";a&&a.hasAttribute(c)&&(i=a.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}},xf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ch(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:A2();const s=ie=>Ch(ie);if(s.version="3.3.1",s.removed=[],!r||!r.document||r.document.nodeType!==gl.document||!r.Element)return s.isSupported=!1,s;let{document:a}=r;const i=a,c=i.currentScript,{DocumentFragment:d,HTMLTemplateElement:m,Node:p,Element:h,NodeFilter:g,NamedNodeMap:v=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:k,trustedTypes:M}=r,N=h.prototype,R=xl(N,"cloneNode"),b=xl(N,"remove"),D=xl(N,"nextSibling"),_=xl(N,"childNodes"),I=xl(N,"parentNode");if(typeof m=="function"){const ie=a.createElement("template");ie.content&&ie.content.ownerDocument&&(a=ie.content.ownerDocument)}let U,q="";const{implementation:he,createNodeIterator:$,createDocumentFragment:pe,getElementsByTagName:we}=a,{importNode:je}=i;let te=xf();s.isSupported=typeof Nh=="function"&&typeof I=="function"&&he&&he.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ve,ERB_EXPR:ce,TMPLIT_EXPR:ge,DATA_ATTR:oe,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:J,ATTR_WHITESPACE:B,CUSTOM_ELEMENT:Y}=pf;let{IS_ALLOWED_URI:K}=pf,S=null;const F=Ee({},[...df,...rc,...sc,...lc,...mf]);let ee=null;const ue=Ee({},[...ff,...ac,...hf,...$a]);let ne=Object.seal(yc(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}})),Ne=null,_e=null;const ke=Object.seal(yc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Oe=!0,lt=!0,fr=!1,bs=!0,Yt=!1,In=!0,cn=!1,Ur=!1,hr=!1,yn=!1,Mn=!1,un=!1,vn=!0,Br=!1;const _l="user-content-";let zr=!0,Dn=!1,jn={},jt=null;const Fn=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 Ss=null;const Un=Ee({},["audio","video","img","source","image","track"]);let wn=null;const Al=Ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pr="http://www.w3.org/1998/Math/MathML",xr="http://www.w3.org/2000/svg",qt="http://www.w3.org/1999/xhtml";let dn=qt,gr=!1,yr=null;const Cs=Ee({},[pr,xr,qt],tc);let Bn=Ee({},["mi","mo","mn","ms","mtext"]),Qt=Ee({},["annotation-xml"]);const zn=Ee({},["title","style","font","a","script"]);let Hn=null;const Pl=["application/xhtml+xml","text/html"],Ll="text/html";let $e=null,Nn=null;const Es=a.createElement("form"),ks=function(E){return E instanceof RegExp||E instanceof Function},bn=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Nn&&Nn===E)){if((!E||typeof E!="object")&&(E={}),E=gn(E),Hn=Pl.indexOf(E.PARSER_MEDIA_TYPE)===-1?Ll:E.PARSER_MEDIA_TYPE,$e=Hn==="application/xhtml+xml"?tc:Ka,S=an(E,"ALLOWED_TAGS")?Ee({},E.ALLOWED_TAGS,$e):F,ee=an(E,"ALLOWED_ATTR")?Ee({},E.ALLOWED_ATTR,$e):ue,yr=an(E,"ALLOWED_NAMESPACES")?Ee({},E.ALLOWED_NAMESPACES,tc):Cs,wn=an(E,"ADD_URI_SAFE_ATTR")?Ee(gn(Al),E.ADD_URI_SAFE_ATTR,$e):Al,Ss=an(E,"ADD_DATA_URI_TAGS")?Ee(gn(Un),E.ADD_DATA_URI_TAGS,$e):Un,jt=an(E,"FORBID_CONTENTS")?Ee({},E.FORBID_CONTENTS,$e):Fn,Ne=an(E,"FORBID_TAGS")?Ee({},E.FORBID_TAGS,$e):gn({}),_e=an(E,"FORBID_ATTR")?Ee({},E.FORBID_ATTR,$e):gn({}),jn=an(E,"USE_PROFILES")?E.USE_PROFILES:!1,Oe=E.ALLOW_ARIA_ATTR!==!1,lt=E.ALLOW_DATA_ATTR!==!1,fr=E.ALLOW_UNKNOWN_PROTOCOLS||!1,bs=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Yt=E.SAFE_FOR_TEMPLATES||!1,In=E.SAFE_FOR_XML!==!1,cn=E.WHOLE_DOCUMENT||!1,yn=E.RETURN_DOM||!1,Mn=E.RETURN_DOM_FRAGMENT||!1,un=E.RETURN_TRUSTED_TYPE||!1,hr=E.FORCE_BODY||!1,vn=E.SANITIZE_DOM!==!1,Br=E.SANITIZE_NAMED_PROPS||!1,zr=E.KEEP_CONTENT!==!1,Dn=E.IN_PLACE||!1,K=E.ALLOWED_URI_REGEXP||bh,dn=E.NAMESPACE||qt,Bn=E.MATHML_TEXT_INTEGRATION_POINTS||Bn,Qt=E.HTML_INTEGRATION_POINTS||Qt,ne=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&ks(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&ks(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),Yt&&(lt=!1),Mn&&(yn=!0),jn&&(S=Ee({},mf),ee=[],jn.html===!0&&(Ee(S,df),Ee(ee,ff)),jn.svg===!0&&(Ee(S,rc),Ee(ee,ac),Ee(ee,$a)),jn.svgFilters===!0&&(Ee(S,sc),Ee(ee,ac),Ee(ee,$a)),jn.mathMl===!0&&(Ee(S,lc),Ee(ee,hf),Ee(ee,$a))),E.ADD_TAGS&&(typeof E.ADD_TAGS=="function"?ke.tagCheck=E.ADD_TAGS:(S===F&&(S=gn(S)),Ee(S,E.ADD_TAGS,$e))),E.ADD_ATTR&&(typeof E.ADD_ATTR=="function"?ke.attributeCheck=E.ADD_ATTR:(ee===ue&&(ee=gn(ee)),Ee(ee,E.ADD_ATTR,$e))),E.ADD_URI_SAFE_ATTR&&Ee(wn,E.ADD_URI_SAFE_ATTR,$e),E.FORBID_CONTENTS&&(jt===Fn&&(jt=gn(jt)),Ee(jt,E.FORBID_CONTENTS,$e)),E.ADD_FORBID_CONTENTS&&(jt===Fn&&(jt=gn(jt)),Ee(jt,E.ADD_FORBID_CONTENTS,$e)),zr&&(S["#text"]=!0),cn&&Ee(S,["html","head","body"]),S.table&&(Ee(S,["tbody"]),delete Ne.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw pl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');U=E.TRUSTED_TYPES_POLICY,q=U.createHTML("")}else U===void 0&&(U=P2(M,c)),U!==null&&typeof q=="string"&&(q=U.createHTML(""));yt&&yt(E),Nn=E}},Hr=Ee({},[...rc,...sc,...w2]),$n=Ee({},[...lc,...N2]),di=function(E){let W=I(E);(!W||!W.tagName)&&(W={namespaceURI:dn,tagName:"template"});const se=Ka(E.tagName),Ie=Ka(W.tagName);return yr[E.namespaceURI]?E.namespaceURI===xr?W.namespaceURI===qt?se==="svg":W.namespaceURI===pr?se==="svg"&&(Ie==="annotation-xml"||Bn[Ie]):!!Hr[se]:E.namespaceURI===pr?W.namespaceURI===qt?se==="math":W.namespaceURI===xr?se==="math"&&Qt[Ie]:!!$n[se]:E.namespaceURI===qt?W.namespaceURI===xr&&!Qt[Ie]||W.namespaceURI===pr&&!Bn[Ie]?!1:!$n[se]&&(zn[se]||!Hr[se]):!!(Hn==="application/xhtml+xml"&&yr[E.namespaceURI]):!1},ot=function(E){fl(s.removed,{element:E});try{I(E).removeChild(E)}catch{b(E)}},Ft=function(E,W){try{fl(s.removed,{attribute:W.getAttributeNode(E),from:W})}catch{fl(s.removed,{attribute:null,from:W})}if(W.removeAttribute(E),E==="is")if(yn||Mn)try{ot(W)}catch{}else try{W.setAttribute(E,"")}catch{}},vr=function(E){let W=null,se=null;if(hr)E="<remove></remove>"+E;else{const Ve=nc(E,/^[\r\n\t ]+/);se=Ve&&Ve[0]}Hn==="application/xhtml+xml"&&dn===qt&&(E='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+E+"</body></html>");const Ie=U?U.createHTML(E):E;if(dn===qt)try{W=new k().parseFromString(Ie,Hn)}catch{}if(!W||!W.documentElement){W=he.createDocument(dn,"template",null);try{W.documentElement.innerHTML=gr?q:Ie}catch{}}const Se=W.body||W.documentElement;return E&&se&&Se.insertBefore(a.createTextNode(se),Se.childNodes[0]||null),dn===qt?we.call(W,cn?"html":"body")[0]:cn?W.documentElement:Se},$r=function(E){return $.call(E.ownerDocument||E,E,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Ts=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")},Ol=function(E){return typeof p=="function"&&E instanceof p};function Jt(ie,E,W){Ha(ie,se=>{se.call(s,E,W,Nn)})}const mn=function(E){let W=null;if(Jt(te.beforeSanitizeElements,E,null),Ts(E))return ot(E),!0;const se=$e(E.nodeName);if(Jt(te.uponSanitizeElement,E,{tagName:se,allowedTags:S}),In&&E.hasChildNodes()&&!Ol(E.firstElementChild)&>(/<[/\w!]/g,E.innerHTML)&>(/<[/\w!]/g,E.textContent)||E.nodeType===gl.progressingInstruction||In&&E.nodeType===gl.comment&>(/<[/\w]/g,E.data))return ot(E),!0;if(!(ke.tagCheck instanceof Function&&ke.tagCheck(se))&&(!S[se]||Ne[se])){if(!Ne[se]&&_s(se)&&(ne.tagNameCheck instanceof RegExp&>(ne.tagNameCheck,se)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(se)))return!1;if(zr&&!jt[se]){const Ie=I(E)||E.parentNode,Se=_(E)||E.childNodes;if(Se&&Ie){const Ve=Se.length;for(let Ze=Ve-1;Ze>=0;--Ze){const Ut=R(Se[Ze],!0);Ut.__removalCount=(E.__removalCount||0)+1,Ie.insertBefore(Ut,D(E))}}}return ot(E),!0}return E instanceof h&&!di(E)||(se==="noscript"||se==="noembed"||se==="noframes")&>(/<\/no(script|embed|frames)/i,E.innerHTML)?(ot(E),!0):(Yt&&E.nodeType===gl.text&&(W=E.textContent,Ha([ve,ce,ge],Ie=>{W=hl(W,Ie," ")}),E.textContent!==W&&(fl(s.removed,{element:E.cloneNode()}),E.textContent=W)),Jt(te.afterSanitizeElements,E,null),!1)},Rs=function(E,W,se){if(vn&&(W==="id"||W==="name")&&(se in a||se in Es))return!1;if(!(lt&&!_e[W]&>(oe,W))){if(!(Oe&>(Q,W))){if(!(ke.attributeCheck instanceof Function&&ke.attributeCheck(W,E))){if(!ee[W]||_e[W]){if(!(_s(E)&&(ne.tagNameCheck instanceof RegExp&>(ne.tagNameCheck,E)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(E))&&(ne.attributeNameCheck instanceof RegExp&>(ne.attributeNameCheck,W)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(W,E))||W==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&>(ne.tagNameCheck,se)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(se))))return!1}else if(!wn[W]){if(!gt(K,hl(se,B,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&E!=="script"&&g2(se,"data:")===0&&Ss[E])){if(!(fr&&!gt(J,hl(se,B,"")))){if(se)return!1}}}}}}}return!0},_s=function(E){return E!=="annotation-xml"&&nc(E,Y)},Il=function(E){Jt(te.beforeSanitizeAttributes,E,null);const{attributes:W}=E;if(!W||Ts(E))return;const se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let Ie=W.length;for(;Ie--;){const Se=W[Ie],{name:Ve,namespaceURI:Ze,value:Ut}=Se,Xt=$e(Ve),As=Ut;let qe=Ve==="value"?As:y2(As);if(se.attrName=Xt,se.attrValue=qe,se.keepAttr=!0,se.forceKeepAttr=void 0,Jt(te.uponSanitizeAttribute,E,se),qe=se.attrValue,Br&&(Xt==="id"||Xt==="name")&&(Ft(Ve,E),qe=_l+qe),In&>(/((--!?|])>)|<\/(style|title|textarea)/i,qe)){Ft(Ve,E);continue}if(Xt==="attributename"&&nc(qe,"href")){Ft(Ve,E);continue}if(se.forceKeepAttr)continue;if(!se.keepAttr){Ft(Ve,E);continue}if(!bs&>(/\/>/i,qe)){Ft(Ve,E);continue}Yt&&Ha([ve,ce,ge],_t=>{qe=hl(qe,_t," ")});const jr=$e(E.nodeName);if(!Rs(jr,Xt,qe)){Ft(Ve,E);continue}if(U&&typeof M=="object"&&typeof M.getAttributeType=="function"&&!Ze)switch(M.getAttributeType(jr,Xt)){case"TrustedHTML":{qe=U.createHTML(qe);break}case"TrustedScriptURL":{qe=U.createScriptURL(qe);break}}if(qe!==As)try{Ze?E.setAttributeNS(Ze,Ve,qe):E.setAttribute(Ve,qe),Ts(E)?ot(E):uf(s.removed)}catch{Ft(Ve,E)}}Jt(te.afterSanitizeAttributes,E,null)},Ml=function ie(E){let W=null;const se=$r(E);for(Jt(te.beforeSanitizeShadowDOM,E,null);W=se.nextNode();)Jt(te.uponSanitizeShadowNode,W,null),mn(W),Il(W),W.content instanceof d&&ie(W.content);Jt(te.afterSanitizeShadowDOM,E,null)};return s.sanitize=function(ie){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,se=null,Ie=null,Se=null;if(gr=!ie,gr&&(ie="<!-->"),typeof ie!="string"&&!Ol(ie))if(typeof ie.toString=="function"){if(ie=ie.toString(),typeof ie!="string")throw pl("dirty is not a string, aborting")}else throw pl("toString is not a function");if(!s.isSupported)return ie;if(Ur||bn(E),s.removed=[],typeof ie=="string"&&(Dn=!1),Dn){if(ie.nodeName){const Ut=$e(ie.nodeName);if(!S[Ut]||Ne[Ut])throw pl("root node is forbidden and cannot be sanitized in-place")}}else if(ie instanceof p)W=vr("<!---->"),se=W.ownerDocument.importNode(ie,!0),se.nodeType===gl.element&&se.nodeName==="BODY"||se.nodeName==="HTML"?W=se:W.appendChild(se);else{if(!yn&&!Yt&&!cn&&ie.indexOf("<")===-1)return U&&un?U.createHTML(ie):ie;if(W=vr(ie),!W)return yn?null:un?q:""}W&&hr&&ot(W.firstChild);const Ve=$r(Dn?ie:W);for(;Ie=Ve.nextNode();)mn(Ie),Il(Ie),Ie.content instanceof d&&Ml(Ie.content);if(Dn)return ie;if(yn){if(Mn)for(Se=pe.call(W.ownerDocument);W.firstChild;)Se.appendChild(W.firstChild);else Se=W;return(ee.shadowroot||ee.shadowrootmode)&&(Se=je.call(i,Se,!0)),Se}let Ze=cn?W.outerHTML:W.innerHTML;return cn&&S["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&>(Sh,W.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
|
|
18
18
|
`+Ze),Yt&&Ha([ve,ce,ge],Ut=>{Ze=hl(Ze,Ut," ")}),U&&un?U.createHTML(Ze):Ze},s.setConfig=function(){let ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bn(ie),Ur=!0},s.clearConfig=function(){Nn=null,Ur=!1},s.isValidAttribute=function(ie,E,W){Nn||bn({});const se=$e(ie),Ie=$e(E);return Rs(se,Ie,W)},s.addHook=function(ie,E){typeof E=="function"&&fl(te[ie],E)},s.removeHook=function(ie,E){if(E!==void 0){const W=p2(te[ie],E);return W===-1?void 0:x2(te[ie],W,1)[0]}return uf(te[ie])},s.removeHooks=function(ie){te[ie]=[]},s.removeAllHooks=function(){te=xf()},s}var L2=Ch();function O2(r){const s=/\u001b\[([0-9;]*m|K)|(\u001b\(B|\u001b\[m)/g;let a="",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+=gf(y);const k=v[1];if(p=v.index+v[0].length,k==="m"||k==="0m")h&&(a+=ic(h,i),h=""),i={};else if(k==="1m")i.fontWeight="bold";else if(k==="2m")i.opacity="0.5";else if(k==="3m")i.fontStyle="italic";else if(k==="4m")i.textDecoration="underline";else if(k.includes(";")){const M=k.split(";").filter(N=>N);for(const N of M){const R=parseInt(N);if(R===0)h&&(a+=ic(h,i),h=""),i={};else if(R===1)i.fontWeight="bold";else if(R===2)i.opacity="0.5";else if(R===3)i.fontStyle="italic";else if(R===4)i.textDecoration="underline";else if(d[R])i.color=d[R];else if(m[R])i.color=m[R];else if(R>=40&&R<=47){const b=d[R-10];b&&(i.backgroundColor=b)}else if(R>=100&&R<=107){const b=m[R-60];b&&(i.backgroundColor=b)}}}else{const M=parseInt(k);d[M]?i.color=d[M]:m[M]&&(i.color=m[M])}}const g=r.substring(p);return h+=gf(g),h&&(a+=ic(h,i)),a}function gf(r){const s={"&":"&","<":"<",">":">",'"':""","'":"'"};return r.replace(/[&<>"']/g,a=>s[a])}function ic(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 I2(r,s){if(r==="completed"){if(s==="success")return t.jsx(Rt,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(bl,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(It,{className:"h-6 w-6 text-gray-600"})}return t.jsx(Be,{className:"h-6 w-6 text-blue-600"})}function Eh({step:r,onToggle:s,expandedSteps:a,stepIndex:i}){const c=w.useRef(null),[d,m]=w.useState(!1),p=a.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 k=c.current;k.scrollTop=k.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(zx,{className:"h-5 w-5"}):t.jsx(Hx,{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((k,M)=>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:k.lineNumber}),t.jsx("span",{className:"pl-4 pr-3 text-gray-500 select-none opacity-50 text-xs flex-shrink-0",children:k.timestamp.split("T")[1]?.slice(0,8)}),t.jsx("span",{className:"flex-1 whitespace-pre break-all pr-4 text-gray-300",dangerouslySetInnerHTML:{__html:L2.sanitize(O2(k.ansiContent))}})]},`${r.stepNumber}-${k.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((k,M)=>t.jsx(Eh,{step:k,onToggle:s,expandedSteps:a,stepIndex:M},k.stepNumber))})]})}function M2({steps:r,jobName:s,jobStatus:a,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 k=1;return y.children&&y.children.length>0&&(k+=h(y.children)),v+k},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:I2(a,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(Eh,{step:g,onToggle:p,expandedSteps:d,stepIndex:v},g.stepNumber))})]})}function D2(r,s){if(r==="completed"){if(s==="success")return t.jsx(Rt,{className:"h-5 w-5 text-green-600"});if(s==="failure")return t.jsx(bl,{className:"h-5 w-5 text-red-600"})}return t.jsx(Be,{className:"h-5 w-5 text-yellow-600"})}function F2(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 U2(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 B2({owner:r,repo:s,packageName:a,onSelectRun:i,runId:c,limit:d=10}){const[m,p]=w.useState([]),[h,g]=w.useState(!0),[v,y]=w.useState(null),[k,M]=w.useState(null),{isAuthenticated:N,hasPermission:R}=Fr();w.useEffect(()=>{const _=async()=>{try{g(!0),y(null);let U=Re.WORKFLOWS.LIST(r,s)+`?per_page=${d}`;a&&(U=Re.WORKFLOWS.BY_PACKAGE(r,s,a));const q=await Te.get(U);if(!q.success)throw new Error(be.FAILED_TO_FETCH_WORKFLOWS);const he=q.data;let $=[];if(a)if(Array.isArray(he))$=he.flatMap(pe=>pe.runs||[]).slice(0,d);else{const pe=he;$=(Array.isArray(pe.runs)?pe.runs:[]).slice(0,d)}else $=Array.isArray(he.runs)?he.runs:[];p($)}catch(U){y(U instanceof Error?U.message:be.UNKNOWN_ERROR)}finally{g(!1)}},I=setInterval(_,5e3);return _(),()=>clearInterval(I)},[r,s,a,d]);const b=async(_,I)=>{_.stopPropagation(),M(I.id);try{if((await Te.post(Re.WORKFLOWS.CANCEL(r,s,I.id))).success)p(m.map(q=>q.id===I.id?{...q,status:"completed",conclusion:"cancelled"}:q));else throw new Error(be.FAILED_TO_CANCEL_RUN)}catch(U){console.error("Failed to cancel run:",U),y(U instanceof Error?U.message:be.FAILED_TO_CANCEL_RUN)}finally{M(null)}},D=async(_,I)=>{_.stopPropagation(),M(I.id);try{if((await Te.post(Re.WORKFLOWS.RERUN(r,s,I.id),{failedOnly:!1})).success)p(m.map(q=>q.id===I.id?{...q,status:"in_progress",conclusion:null}:q));else throw new Error(be.FAILED_TO_RERUN_WORKFLOW)}catch(U){console.error("Failed to rerun workflow:",U),y(U instanceof Error?U.message:be.FAILED_TO_RERUN_WORKFLOW)}finally{M(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(Be,{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(_=>t.jsxs("div",{className:`text-left p-3 rounded-lg border transition-colors ${c===_.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:bg-gray-50"}`,children:[t.jsx("button",{onClick:()=>i?.(_.id),className:"w-full text-left",children:t.jsxs("div",{className:"flex items-start gap-2",children:[D2(_.status,_.conclusion),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium text-sm text-gray-900",children:_.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 ${F2(_.status,_.conclusion)}`,children:_.conclusion??_.status}),t.jsx("span",{children:" • "}),t.jsxs("span",{children:["Branch: ",_.head_branch]}),t.jsx("span",{children:" • "}),t.jsxs("span",{children:["by ",_.actor.login]}),t.jsx("span",{children:" • "}),t.jsx("span",{children:U2(_.created_at)})]})]})]})}),R("maintain")&&t.jsxs("div",{className:"flex gap-2 mt-3",children:[_.status==="in_progress"&&t.jsx("button",{onClick:I=>b(I,_),disabled:k===_.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:k===_.id?"Cancelling...":"Cancel Run"}),(_.conclusion==="cancelled"||_.conclusion==="failure")&&t.jsx("button",{onClick:I=>D(I,_),disabled:k===_.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:k===_.id?"Rerunning...":"Rerun"})]})]},_.id))})}function z2({owner:r,repo:s,defaultBranch:a="main",onSuccess:i,onError:c}){const[d,m]=w.useState(!1),[p,h]=w.useState(a),[g,v]=w.useState({}),[y,k]=w.useState(!1),[M,N]=w.useState(null),[R,b]=w.useState([]),[D,_]=w.useState(),[I,U]=w.useState(!1);w.useEffect(()=>{d&&R.length===0&&q()},[d]);const q=async()=>{try{U(!0);const $=await Te.get(Re.WORKFLOWS.AVAILABLE(r,s));$.success&&(b($.data.workflows||[]),$.data.workflows?.length>0&&!D&&_($.data.workflows[0].path))}catch($){console.error("Failed to fetch workflows:",$)}finally{U(!1)}},he=async()=>{try{k(!0),N(null);const $=await Te.post(Re.WORKFLOWS.TRIGGER(r,s),{workflow:D,ref:p,inputs:g,workflowId:R.find(we=>we.path==D)?.id??""});if(!$.success)throw new Error(be.FAILED_TO_TRIGGER_WORKFLOW);const pe=$.data;if(pe.success)i?.(pe.runUrl||`https://github.com/${r}/${s}/actions`),m(!1),h(a),v({});else throw new Error(pe.message||be.FAILED_TO_TRIGGER_WORKFLOW)}catch($){const pe=$ instanceof Error?$.message:be.UNKNOWN_ERROR;N(pe),c?.(pe)}finally{k(!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(ni,{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"}),M&&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(bl,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),t.jsx("p",{className:"text-sm text-red-700",children:M})]}),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"}),I?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..."}):R.length>0?t.jsx("select",{value:D,onChange:$=>_($.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:R.map($=>t.jsxs("option",{value:$.path,children:[$.name," (",$.path,")"]},$.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:$=>h($.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:he,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 H2(r,s,a=!1){if(a)return t.jsx(Be,{className:"h-6 w-6 text-yellow-500 animate-spin"});if(r==="completed"){if(s==="success")return t.jsx(Rt,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(bl,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(It,{className:"h-6 w-6 text-gray-600"});if(s==="skipped")return t.jsx(Be,{className:"h-6 w-6 text-gray-600"})}return r==="in_progress"||r==="queued"?t.jsx(Be,{className:"h-6 w-6 text-blue-600"}):t.jsx(Be,{className:"h-6 w-6 text-gray-600"})}function $2({jobs:r,selectedJob:s,onSelectJob:a}){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:()=>a(i),className:"w-full text-left p-3",children:t.jsxs("div",{className:"flex items-start gap-2",children:[H2(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 V2=()=>{try{const r=rt.get("monodog_session_data");return r?JSON.parse(r).permission:null}catch(r){return console.error("Failed to parse session data",r),null}};function W2(r){const s=r.split(`
|
|
19
19
|
`),a=[];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\]|$)/),k={name:v?v[1].trim():`Step ${a.length+1}`,logs:[],level:g,children:[],startIndex:d};for(;c.length>0&&c[c.length-1].level>=k.level;)c.pop();if(c.length>0){const M=c[c.length-1];M.children||(M.children=[]),M.children.push(k)}else a.push(k);c.push(k),i=k}else{if(m.includes("##[endgroup]"))continue;p&&i&&i.logs.push(m)}}return a}function G2(r,s,a=!1){if(a)return t.jsx(Be,{className:"h-6 w-6 text-yellow-500 animate-spin"});if(r==="completed"){if(s==="success")return t.jsx(Rt,{className:"h-6 w-6 text-green-600"});if(s==="failure")return t.jsx(bl,{className:"h-6 w-6 text-red-600"});if(s==="cancelled")return t.jsx(It,{className:"h-6 w-6 text-gray-600"});if(s==="skipped")return t.jsx(Be,{className:"h-6 w-6 text-gray-600"})}return r==="in_progress"||r==="queued"?t.jsx(Be,{className:"h-6 w-6 text-blue-600"}):t.jsx(Be,{className:"h-6 w-6 text-gray-600"})}function K2({packageName:r,onNavigate:s}){const[a,i]=w.useState([]),[c,d]=w.useState(null),[m,p]=w.useState([]),[h,g]=w.useState(null),[v,y]=w.useState(null),[k,M]=w.useState(!0),[N,R]=w.useState(null),[b,D]=w.useState(new Set),{hasPermission:_}=Fr(),[I,U]=w.useState(0),[q,he]=w.useState(!1),$=10,pe=20,{owner:we,repo:je}=w.useMemo(()=>V2()||{},[]);w.useEffect(()=>{const oe=async()=>{try{const J=Re.PIPELINES.LIST,B=await Te.get(J);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([]),M(!1);return}throw new Error(`Failed to fetch pipelines: ${B.error?.message}`)}const Y=Array.isArray(B.data)?B.data:[];i(Y),M(!1)}catch(J){R(J instanceof Error?J.message:"Unknown error"),M(!1)}};oe();const Q=setInterval(oe,5e3);return()=>clearInterval(Q)},[we,je,r]),w.useEffect(()=>{const oe=async()=>{try{a.forEach(async J=>{if(J.workflowId&&J.currentStatus!=="completed"&&!b.has(J.workflowId)){const B=Re.WORKFLOWS.LIST(we,je)+`?workflow_id=${J.workflowId}&per_page=${pe}&page=1`,Y=await Te.get(B);if(Y.success){const K=Y.data,S=K.workflow_runs?.[0]||K.runs?.[0];if(S){const F=S.status!==J.currentStatus,ee=S.conclusion!==J.currentConclusion;if(F||ee){D(ue=>new Set(ue).add(J.workflowId));try{const ue=await Te.put(Re.PIPELINES.STATUS(J.id),{currentStatus:S.status,currentConclusion:S.conclusion||null,lastRunId:S.id}),ne={...J,currentStatus:S.status,currentConclusion:S.conclusion||null,lastRunId:S.id};if(console.log(ne),ne.currentStatus=="completed"){const Ne=await Mt.refreshPackages()}i(Ne=>Ne.map(_e=>_e.id===J.id?ne:_e))}catch(ue){console.warn("Failed to update pipeline status:",ue)}finally{D(ue=>{const ne=new Set(ue);return ne.delete(J.workflowId),ne})}}}}}})}catch(J){console.warn("Failed to poll pipeline status:",J)}};oe();const Q=setInterval(oe,1e4);return()=>clearInterval(Q)},[a,we,je]),w.useEffect(()=>{if(!c)return;const oe=async()=>{try{const J=await Te.get(Re.WORKFLOWS.RUNS(we,je,c));if(!J.success){if(J.error?.status===401||J.error?.status===403){window.location.href="/login";return}throw new Error(`Failed to fetch jobs: ${J.error?.message}`)}p(J.data.jobs||[])}catch(J){R(J instanceof Error?J.message:"Unknown error")}},Q=setInterval(oe,5e3);return oe(),()=>clearInterval(Q)},[c,we,je]),w.useEffect(()=>{if(!h)return;const oe=async()=>{try{const Q=await Te.get(Re.WORKFLOWS.LOGS(we,je,h.gitHubJobId));if(!Q.success){if(Q.error?.status===403)R(be.PERMISSION_ERROR);else if(Q.error?.status===401)R(mc.SESSION_EXPIRED),window.location.href="/login";else{console.log(Q);const B=Q.error?.details||"Unknown error";R(`${be.FAILED_TO_FETCH_LOGS}: ${B}`)}return}const J=Q.data;J.meta&&J.meta.isEmpty?(y(""),R(be.FAILED_TO_FETCH_LOGS)):(y(J.logs||J),R(null))}catch(Q){const J=Q instanceof Error?Q.message:be.FAILED_TO_FETCH_LOGS;R(`${be.FAILED_TO_FETCH_LOGS}: ${J}`)}};if(oe(),h.status!=="completed"){const Q=setInterval(oe,5e3);return()=>clearInterval(Q)}},[h,we,je]);const te=oe=>{g(oe),y(null)},ve=oe=>{const Q=oe.currentTarget;Q.scrollHeight-Q.scrollTop-Q.clientHeight<100&&!q&&a.length>=$&&ce()},ce=async()=>{if(!q){he(!0);try{const oe=Re.PIPELINES.LIST+`?offset=${I+$}&limit=${$}`,Q=await Te.get(oe);if(!Q.success)throw new Error("Failed to fetch more pipelines");const J=Q.data;i(B=>[...B,...J]),U(B=>B+$)}catch(oe){console.error("Error loading more pipelines:",oe)}finally{he(!1)}}},ge=oe=>{d(oe),g(null),p([])};return k&&a.length===0?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"animate-spin",children:t.jsx(Be,{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:ve,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"}),_("maintain")&&t.jsx(z2,{owner:we,repo:je})]}),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:a.length===0?t.jsx("p",{className:"text-sm text-gray-500",children:"No pipelines found"}):t.jsxs(t.Fragment,{children:[a.map(oe=>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:[G2(oe.currentStatus,oe.currentConclusion||null,b.has(oe.id)),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"font-medium text-sm text-gray-900 truncate",children:oe.packageName}),t.jsxs("p",{className:"text-xs text-gray-500",children:["v",oe.releaseVersion]}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:oe.workflowName})]})]})},oe.id)),q&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx("div",{className:"animate-spin",children:t.jsx(Be,{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(B2,{owner:we,repo:je,packageName:r,onSelectRun:ge,runId:c,limit:pe})]})}),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($2,{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(Be,{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(M2,{steps:(()=>{const oe=W2(v);let Q=0;const J=B=>B.map(Y=>{Q++;const K=Y.logs.at(0)?.split(" ")[0],S=Y.logs.at(-1)?.split(" ")[0];return{stepNumber:Q,stepName:Y.name,level:Y.level,status:"",conclusion:"",startedAt:K,completedAt:S,logs:Y.logs.map((F,ee)=>({lineNumber:ee+1,timestamp:new Date().toISOString(),content:F,ansiContent:F})),children:Y.children?J(Y.children):void 0}});return J(oe)})(),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(Be,{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 Y2(){const{session:r}=Fr();return r?t.jsx("div",{className:"h-screen overflow-hidden",children:t.jsx(K2,{})}):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 q2={Dashboard:Cv,PackagesOverview:Ev,PackageDetail:kv,DependencyGraph:Yv,HealthStatus:qv,PublishControl:i1,CIIntegration:S1,ConfigInspector:n2,ReleaseManager:d2,Pipeline:Y2},Q2=({componentName:r})=>{const s=q2[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 J2(){return t.jsxs(_f,{children:[Af.map(r=>t.jsx(ps,{path:r.path,element:t.jsx(Q2,{componentName:r.component})},r.path)),t.jsx(ps,{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 X2=w.createContext(void 0);function Z2({children:r}){const[s,a]=w.useState(new Map),[i,c]=w.useState(!1),[d,m]=w.useState(null),p=(M,N)=>`${M}/${N}`,h=w.useCallback(async(M,N,R)=>{try{c(!0),m(null);const b=p(N,R);if(s.has(b))return s.get(b)||null;const D=await Te.get(`/permissions/${N}/${R}`);if(!D.success)throw D.error.status===401?new Error(be.AUTHENTICATION_ERROR):new Error(be.FAILED_TO_CHECK_PERMISSION);const _=D.data,I={permission:_.permission,role:_.role,canAdmin:_.canAdmin,canMaintain:_.canMaintain,canWrite:_.canWrite,canRead:_.canRead,denied:_.denied};return a(U=>{const q=new Map(U);return q.set(b,I),q}),I}catch(b){const D=b instanceof Error?b.message:"Permission check failed";return m(D),null}finally{c(!1)}},[s]),g=w.useCallback(async(M,N,R,b)=>{try{c(!0),m(null);const D=await Te.post(`/permissions/${N}/${R}/can-action`,{action:b});if(!D.success)throw new Error(be.FAILED_TO_CHECK_ACTION_PERMISSION);return D.data.can===!0}catch(D){return console.error("Action permission check error:",D),!1}finally{c(!1)}},[]),v=w.useCallback((M,N)=>{const R=p(M,N);a(b=>{const D=new Map(b);return D.delete(R),D})},[]),y=w.useCallback(()=>{a(new Map)},[]),k={permissions:s,isLoading:i,error:d,checkPermission:h,canPerformAction:g,invalidatePermission:v,invalidateAll:y};return t.jsx(X2.Provider,{value:k,children:r})}function ew(){const{login:r,isLoading:s,error:a}=Fr(),[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"}),a&&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:a}),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(Vx,{}),"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 tw(){const r=kc(),[s,a]=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}`),a(!1);return}if(!p||!h){c("Missing authorization code or state"),a(!1);return}const y=await Te.get(Re.AUTH.CALLBACK+`?code=${p}&state=${h}`);if(!y.success){c(y.error?.message||"Authentication failed"),a(!1);return}const k=y.data;if(!k.success||!k.sessionToken){c(be.AUTHENTICATION_ERROR),a(!1);return}const M=window.__authContext;if(M&&M.handleOAuthCallback)if(await M.handleOAuthCallback(k.sessionToken,k.permission)){const R=k.redirectUrl||"/";r(R)}else c(be.AUTHENTICATION_ERROR);else c(be.AUTHENTICATION_ERROR)}catch(m){const p=m instanceof Error?m.message:be.UNKNOWN_ERROR;c(p)}finally{a(!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 nw({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 rw({children:r}){const{isAuthenticated:s,isLoading:a}=Fr();return a?t.jsx(nw,{}):s?t.jsx(t.Fragment,{children:r}):t.jsx(hx,{to:"/login",replace:!0})}function sw(){return t.jsx(Nx,{children:t.jsx(Ty,{children:t.jsx(Z2,{children:t.jsxs(_f,{children:[t.jsx(ps,{path:"/login",element:t.jsx(ew,{})}),t.jsx(ps,{path:"/auth/callback",element:t.jsx(tw,{})}),t.jsx(ps,{path:"/*",element:t.jsx(rw,{children:t.jsx(Ry,{children:t.jsx(J2,{})})})})]})})})})}const yf=document.getElementById("root");yf&&wp.createRoot(yf).render(t.jsx(sw,{}));
|
|
20
|
-
//# sourceMappingURL=index-C08ciT3A.js.map
|