garm/webapp/assets/_app/immutable/nodes/4.BwxA42a9.js
Gabriel Adrian Samfira 54c6571ccd Update test workflow
Add steps to test the Web UI and to run go generate.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2025-08-21 21:00:27 +00:00

3 lines
23 KiB
JavaScript

import"../chunks/DsnmJJEf.js";import{i as bt}from"../chunks/zNh6Oe5P.js";import{p as gt,g as e,o as ft,l as Z,a as _t,f as j,e as b,h as mt,b as Ce,c as I,d as yt,m as p,i as vt,$ as xt,j as o,q as Ee,k as a,t as ye,u as C,s,r as i,n as ie,v as se,w as Ie,z as V,y as g}from"../chunks/sWNKMed7.js";import{i as ne,s as ht,a as kt}from"../chunks/Ccl3fNd2.js";import{h as wt,r as U,c as je,s as Ge,g as ee}from"../chunks/D30EsFKH.js";import{b as E}from"../chunks/CLagxtgo.js";import{p as ze}from"../chunks/D4Caz1gY.js";import{P as Ct}from"../chunks/BAf75JIA.js";import{F as Et}from"../chunks/6R-adehd.js";import{D as Pt,A as qe,G as Pe,a as $t}from"../chunks/I29fo47B.js";import{e as At,a as He}from"../chunks/DWynKlcl.js";import{t as de}from"../chunks/BZUCTtPY.js";import{g as $e,c as Rt,a as Bt,p as Ut}from"../chunks/DyvUHRqW.js";import{e as Ae}from"../chunks/BZiHL9L3.js";import"../chunks/CWoVlqr_.js";import{E as Lt}from"../chunks/BLz-7_AQ.js";var Mt=j('<div class="flex items-center justify-between"><div class="flex-1 min-w-0"><div class="block"><p class="text-sm font-medium text-gray-900 dark:text-white truncate"> </p> <p class="text-sm text-gray-500 dark:text-gray-400 truncate mt-1"> </p> <div class="flex items-center mt-2"><!> <span class="ml-2 text-xs text-gray-500 dark:text-gray-400 capitalize"> </span></div></div></div> <div class="flex space-x-2 ml-4"><!> <!></div></div>'),Tt=j('<div><label for="api_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">API Base URL <span class="text-red-500">*</span></label> <input type="url" id="api_base_url" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white" placeholder="https://api.github.com or https://github.example.com/api/v3"/></div> <div><label for="upload_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Upload Base URL</label> <input type="url" id="upload_base_url" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white" placeholder="https://uploads.github.com"/></div>',1),Dt=j('<div><label for="api_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">API Base URL <span class="text-xs text-gray-500">(optional)</span></label> <input type="url" id="api_base_url" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white" placeholder="https://gitea.example.com/api/v1 (leave empty to use Base URL)"/> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">If empty, Base URL will be used as API Base URL</p></div>'),Ft=j('<div class="fixed inset-0 flex items-center justify-center z-50" role="dialog" aria-modal="true"><button class="fixed inset-0 w-full h-full bg-black/30 dark:bg-black/50 cursor-default" aria-label="Close modal"></button> <div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-screen overflow-y-auto relative z-10" role="document"><div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center"><div><h3 class="text-lg font-semibold text-gray-900 dark:text-white">Add Endpoint</h3> <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Connect to GitHub or Gitea for runner management</p></div> <button class="text-gray-400 hover:text-gray-600 dark:text-gray-300 dark:hover:text-gray-100 cursor-pointer" aria-label="Close modal"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div> <form class="p-6 space-y-4"><!> <div><label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Endpoint Name <span class="text-red-500">*</span></label> <input type="text" id="name" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div> <div><label for="description" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description <span class="text-red-500">*</span></label> <textarea id="description" rows="2" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white" placeholder="Brief description of this endpoint"></textarea></div> <div><label for="base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Base URL <span class="text-red-500">*</span></label> <input type="url" id="base_url" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div> <!> <div class="space-y-3 border-t border-gray-200 dark:border-gray-700 pt-4"><label for="ca_cert_file" class="block text-sm font-medium text-gray-700 dark:text-gray-300">CA Certificate Bundle (Optional)</label> <div class="border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-4 text-center hover:border-blue-400 dark:hover:border-blue-400 transition-colors"><input type="file" id="ca_cert_file" accept=".pem,.crt,.cer,.cert" class="hidden"/> <div class="space-y-2"><svg class="mx-auto h-8 w-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg> <p class="text-sm text-gray-600 dark:text-gray-400"><button type="button" class="text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 hover:underline cursor-pointer">Choose a file</button> or drag and drop</p> <p class="text-xs text-gray-500 dark:text-gray-400">PEM, CRT, CER, CERT files only</p></div></div></div> <div class="flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-700"><button type="button" class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 cursor-pointer">Cancel</button> <button type="submit">Create Endpoint</button></div></form></div></div>'),It=j('<div><label for="edit_api_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">API Base URL <span class="text-red-500">*</span></label> <input type="url" id="edit_api_base_url" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div> <div><label for="edit_upload_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Upload Base URL</label> <input type="url" id="edit_upload_base_url" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div>',1),jt=j('<div><label for="edit_api_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">API Base URL <span class="text-xs text-gray-500">(optional)</span></label> <input type="url" id="edit_api_base_url" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">If empty, Base URL will be used as API Base URL</p></div>'),Gt=j('<div class="fixed inset-0 flex items-center justify-center z-50" role="dialog" aria-modal="true"><button class="fixed inset-0 w-full h-full bg-black/30 dark:bg-black/50 cursor-default" aria-label="Close modal"></button> <div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-screen overflow-y-auto relative z-10" role="document"><div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center"><div><h3 class="text-lg font-semibold text-gray-900 dark:text-white"> </h3> <p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Update endpoint configuration</p></div> <button class="text-gray-400 hover:text-gray-600 dark:text-gray-300 dark:hover:text-gray-100 cursor-pointer" aria-label="Close modal"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div> <form class="p-6 space-y-4"><div><label for="edit_name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Endpoint Name <span class="text-red-500">*</span></label> <input type="text" id="edit_name" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div> <div><label for="edit_description" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Description <span class="text-red-500">*</span></label> <textarea id="edit_description" rows="2" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"></textarea></div> <div><label for="edit_base_url" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Base URL <span class="text-red-500">*</span></label> <input type="url" id="edit_base_url" required class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white"/></div> <!> <div class="space-y-3 border-t border-gray-200 dark:border-gray-700 pt-4"><label for="edit_ca_cert_file" class="block text-sm font-medium text-gray-700 dark:text-gray-300">CA Certificate Bundle (Optional)</label> <div class="border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-4 text-center hover:border-blue-400 dark:hover:border-blue-400 transition-colors"><input type="file" id="edit_ca_cert_file" accept=".pem,.crt,.cer,.cert" class="hidden"/> <div class="space-y-2"><svg class="mx-auto h-8 w-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg> <p class="text-sm text-gray-600 dark:text-gray-400"><button type="button" class="text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 hover:underline cursor-pointer">Choose a file</button> or drag and drop</p> <p class="text-xs text-gray-500 dark:text-gray-400">PEM, CRT, CER, CERT files only</p></div></div></div> <div class="flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-700"><button type="button" class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 cursor-pointer">Cancel</button> <button type="submit">Update Endpoint</button></div></form></div></div>'),zt=j('<div class="fixed inset-0 flex items-center justify-center z-50" role="dialog" aria-modal="true"><button class="fixed inset-0 w-full h-full bg-black/30 dark:bg-black/50 cursor-default" aria-label="Close modal"></button> <div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-xl w-full mx-4 relative z-10" role="document"><div class="px-6 py-4"><div class="flex items-center"><div class="flex-shrink-0"><svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg></div> <div class="ml-3"><h3 class="text-lg font-medium text-gray-900 dark:text-white">Delete Endpoint</h3> <p class="mt-2 text-sm text-gray-500 dark:text-gray-300"> </p></div></div></div> <div class="px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex justify-end space-x-3"><button type="button" class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 cursor-pointer">Cancel</button> <button type="button" class="px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 cursor-pointer">Delete</button></div></div></div>'),qt=j('<div class="space-y-6"><!> <!></div> <!> <!> <!>',1);function or(Ne,Se){gt(Se,!1);const[Ve,Oe]=ht(),q=()=>kt(At,"$eagerCache",Ve),ve=p(),H=p(),Re=p();let le=p(!0),O=p([]),ue=p(""),ce=p(""),L=p(1),K=p(25),J=p(1),pe=p(!1),be=p(!1),ge=p(!1),G=p("github"),m=p(null),A=p(null),r=p({name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:""}),k={...e(r)};ft(async()=>{try{s(le,!0);const t=await He.getEndpoints();t&&Array.isArray(t)&&s(O,t)}catch(t){console.error("Failed to load endpoints:",t),s(ue,t instanceof Error?t.message:"Failed to load endpoints")}finally{s(le,!1)}});async function Ke(){try{await He.retryResource("endpoints")}catch(t){console.error("Retry failed:",t)}}const Je=[{key:"name",title:"Name",cellComponent:Pe,cellProps:{field:"name"}},{key:"description",title:"Description",cellComponent:Pe,cellProps:{field:"description"}},{key:"api_url",title:"API URL",cellComponent:Pe,cellProps:{field:"api_base_url",fallbackField:"base_url"}},{key:"forge_type",title:"Forge Type",cellComponent:Lt},{key:"actions",title:"Actions",align:"right",cellComponent:$t}],Qe={entityType:"endpoint",primaryText:{field:"name",isClickable:!1},secondaryText:{field:"description"},customInfo:[{icon:t=>$e(t?.endpoint_type||"unknown"),text:t=>t?.api_base_url||"Unknown"}],actions:[{type:"edit",handler:t=>xe(t)},{type:"delete",handler:t=>he(t)}]};function We(t){s(ce,t.detail.term),s(L,1)}function Xe(t){s(L,t.detail.page)}function Ye(t){const n=Rt(t.detail.perPage);s(K,n.newPerPage),s(L,n.newCurrentPage)}function Ze(t){xe(t.detail.item)}function et(t){he(t.detail.item)}function tt(){s(G,"github"),Be(),s(pe,!0)}function rt(t){s(G,t.detail),g(r,e(r).endpoint_type=t.detail)}function xe(t){s(m,t),s(r,{name:t.name||"",description:t.description||"",endpoint_type:t.endpoint_type||"",base_url:t.base_url||"",api_base_url:t.api_base_url||"",upload_base_url:t.upload_base_url||"",ca_cert_bundle:typeof t.ca_cert_bundle=="string"?t.ca_cert_bundle:""}),k={...e(r)},s(be,!0)}function he(t){s(A,t),s(ge,!0)}function Be(){s(r,{name:"",description:"",endpoint_type:"",base_url:"",api_base_url:"",upload_base_url:"",ca_cert_bundle:""}),k={...e(r)}}function at(t){t.key==="Escape"&&(e(pe)||e(be)||e(ge))&&y()}function y(){s(pe,!1),s(be,!1),s(ge,!1),s(G,"github"),s(m,null),s(A,null),Be()}function ot(){const t={};if(e(r).description!==k.description&&(e(r).description.trim()!==""||k.description!=="")&&(t.description=e(r).description.trim()),e(r).base_url!==k.base_url&&e(r).base_url.trim()!==""&&(t.base_url=e(r).base_url.trim()),e(r).api_base_url!==k.api_base_url&&(e(r).api_base_url.trim()!==""||k.api_base_url!=="")&&(t.api_base_url=e(r).api_base_url.trim()),e(m)?.endpoint_type==="github"&&e(r).upload_base_url!==k.upload_base_url&&(e(r).upload_base_url.trim()!==""||k.upload_base_url!=="")&&(t.upload_base_url=e(r).upload_base_url.trim()),e(r).ca_cert_bundle!==k.ca_cert_bundle)if(e(r).ca_cert_bundle!=="")try{const n=atob(e(r).ca_cert_bundle);t.ca_cert_bundle=Array.from(n,c=>c.charCodeAt(0))}catch{k.ca_cert_bundle!==""&&(t.ca_cert_bundle=[])}else k.ca_cert_bundle!==""&&(t.ca_cert_bundle=[]);return t}async function it(){try{const t={name:e(r).name,description:e(r).description,endpoint_type:e(r).endpoint_type,base_url:e(r).base_url,api_base_url:e(r).api_base_url,upload_base_url:e(r).upload_base_url};if(e(r).ca_cert_bundle&&e(r).ca_cert_bundle.trim()!=="")try{const n=atob(e(r).ca_cert_bundle);t.ca_cert_bundle=Array.from(n,c=>c.charCodeAt(0))}catch{}e(r).endpoint_type==="github"?await ee.createGithubEndpoint(t):await ee.createGiteaEndpoint(t),de.success("Endpoint Created",`Endpoint ${e(r).name} has been created successfully.`),y()}catch(t){s(ue,Ae(t))}}async function st(){if(e(m))try{const t=ot();if(Object.keys(t).length===0){de.info("No Changes","No fields were modified."),y();return}e(m).endpoint_type==="github"?await ee.updateGithubEndpoint(e(m).name,t):await ee.updateGiteaEndpoint(e(m).name,t),de.success("Endpoint Updated",`Endpoint ${e(m).name} has been updated successfully.`),y()}catch(t){s(ue,Ae(t))}}async function nt(){if(e(A)){try{e(A).endpoint_type==="github"?await ee.deleteGithubEndpoint(e(A).name):await ee.deleteGiteaEndpoint(e(A).name),de.success("Endpoint Deleted",`Endpoint ${e(A).name} has been deleted successfully.`)}catch(t){const n=Ae(t);de.error("Delete Failed",n)}y()}}function Ue(t){const c=t.target.files?.[0];if(!c){g(r,e(r).ca_cert_bundle="");return}const v=new FileReader;v.onload=d=>{const f=d.target?.result;g(r,e(r).ca_cert_bundle=btoa(f))},v.readAsText(c)}function fe(){return!(!e(r).name||!e(r).description||!e(r).base_url||e(r).endpoint_type==="github"&&!e(r).api_base_url)}Z(()=>(e(O),q()),()=>{(!e(O).length||q().loaded.endpoints)&&s(O,q().endpoints)}),Z(()=>q(),()=>{s(le,q().loading.endpoints)}),Z(()=>q(),()=>{s(ve,q().errorMessages.endpoints)}),Z(()=>(e(O),e(ce)),()=>{s(H,Bt(e(O),e(ce)))}),Z(()=>(e(J),e(H),e(K),e(L)),()=>{s(J,Math.ceil(e(H).length/e(K))),e(L)>e(J)&&e(J)>0&&s(L,e(J))}),Z(()=>(e(H),e(L),e(K)),()=>{s(Re,Ut(e(H),e(L),e(K)))}),_t(),bt();var Le=qt();b("keydown",vt,at),mt(t=>{xt.title="Endpoints - GARM"});var ke=Ce(Le),Me=o(ke);Ct(Me,{title:"Endpoints",description:"Manage your GitHub and Gitea endpoints for runner management.",actionLabel:"Add Endpoint",$$events:{action:tt}});var dt=a(Me,2);{let t=Ee(()=>e(ve)||e(ue)),n=Ee(()=>!!e(ve));Pt(dt,{get columns(){return Je},get data(){return e(Re)},get loading(){return e(le)},get error(){return e(t)},get searchTerm(){return e(ce)},searchPlaceholder:"Search endpoints by name, description, or URL...",get currentPage(){return e(L)},get perPage(){return e(K)},get totalPages(){return e(J)},get totalItems(){return e(H),C(()=>e(H).length)},itemName:"endpoints",emptyIconType:"settings",get showRetry(){return e(n)},get mobileCardConfig(){return Qe},$$events:{search:We,pageChange:Xe,perPageChange:Ye,retry:Ke,edit:Ze,delete:et},$$slots:{"mobile-card":(c,v)=>{const d=Ee(()=>v.item);var f=Mt(),x=o(f),R=o(x),P=o(R),w=o(P,!0);i(P);var _=a(P,2),M=o(_,!0);i(_);var B=a(_,2),T=o(B);wt(T,()=>(ie($e),ie(e(d)),C(()=>$e(e(d).endpoint_type||"","w-5 h-5"))));var D=a(T,2),Q=o(D,!0);i(D),i(B),i(R),i(x);var N=a(x,2),z=o(N);qe(z,{action:"edit",size:"sm",title:"Edit endpoint",ariaLabel:"Edit endpoint",$$events:{click:()=>xe(e(d))}});var W=a(z,2);qe(W,{action:"delete",size:"sm",title:"Delete endpoint",ariaLabel:"Delete endpoint",$$events:{click:()=>he(e(d))}}),i(N),i(f),ye(()=>{se(w,(ie(e(d)),C(()=>e(d).name))),se(M,(ie(e(d)),C(()=>e(d).description))),se(Q,(ie(e(d)),C(()=>e(d).endpoint_type)))}),I(c,f)}}})}i(ke);var Te=a(ke,2);{var lt=t=>{var n=Ft(),c=o(n),v=a(c,2),d=o(v),f=a(o(d),2);i(d);var x=a(d,2),R=o(x);Et(R,{get selectedForgeType(){return e(G)},set selectedForgeType(u){s(G,u)},$$events:{select:rt},$$legacy:!0});var P=a(R,2),w=a(o(P),2);U(w),i(P);var _=a(P,2),M=a(o(_),2);Ie(M),i(_);var B=a(_,2),T=a(o(B),2);U(T),i(B);var D=a(B,2);{var Q=u=>{var $=Tt(),l=Ce($),h=a(o(l),2);U(h),i(l);var F=a(l,2),S=a(o(F),2);U(S),i(F),E(h,()=>e(r).api_base_url,Y=>g(r,e(r).api_base_url=Y)),E(S,()=>e(r).upload_base_url,Y=>g(r,e(r).upload_base_url=Y)),I(u,$)},N=u=>{var $=Dt(),l=a(o($),2);U(l),V(2),i($),E(l,()=>e(r).api_base_url,h=>g(r,e(r).api_base_url=h)),I(u,$)};ne(D,u=>{e(G)==="github"?u(Q):u(N,!1)})}var z=a(D,2),W=a(o(z),2),X=o(W),te=a(X,2),re=a(o(te),2),_e=o(re);V(),i(re),V(2),i(te),i(W),i(z);var ae=a(z,2),me=o(ae),oe=a(me,2);i(ae),i(x),i(v),i(n),ye((u,$)=>{je(w,"placeholder",e(G)==="github"?"e.g., github-enterprise or github-com":"e.g., gitea-main or my-gitea"),je(T,"placeholder",e(G)==="github"?"https://github.com or https://github.example.com":"https://gitea.example.com"),oe.disabled=u,Ge(oe,1,`px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors
${$??""}`)},[()=>C(()=>!fe()),()=>C(()=>fe()?"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 cursor-pointer":"bg-gray-400 cursor-not-allowed")]),b("click",c,y),b("click",f,y),E(w,()=>e(r).name,u=>g(r,e(r).name=u)),E(M,()=>e(r).description,u=>g(r,e(r).description=u)),E(T,()=>e(r).base_url,u=>g(r,e(r).base_url=u)),b("change",X,Ue),b("click",_e,()=>document.getElementById("ca_cert_file")?.click()),b("click",me,y),b("submit",x,ze(it)),I(t,n)};ne(Te,t=>{e(pe)&&t(lt)})}var De=a(Te,2);{var ut=t=>{var n=Gt(),c=o(n),v=a(c,2),d=o(v),f=o(d),x=o(f),R=o(x);i(x),V(2),i(f);var P=a(f,2);i(d);var w=a(d,2),_=o(w),M=a(o(_),2);U(M),i(_);var B=a(_,2),T=a(o(B),2);Ie(T),i(B);var D=a(B,2),Q=a(o(D),2);U(Q),i(D);var N=a(D,2);{var z=l=>{var h=It(),F=Ce(h),S=a(o(F),2);U(S),i(F);var Y=a(F,2),Fe=a(o(Y),2);U(Fe),i(Y),E(S,()=>e(r).api_base_url,we=>g(r,e(r).api_base_url=we)),E(Fe,()=>e(r).upload_base_url,we=>g(r,e(r).upload_base_url=we)),I(l,h)},W=l=>{var h=jt(),F=a(o(h),2);U(F),V(2),i(h),E(F,()=>e(r).api_base_url,S=>g(r,e(r).api_base_url=S)),I(l,h)};ne(N,l=>{e(m),C(()=>e(m).endpoint_type==="github")?l(z):l(W,!1)})}var X=a(N,2),te=a(o(X),2),re=o(te),_e=a(re,2),ae=a(o(_e),2),me=o(ae);V(),i(ae),V(2),i(_e),i(te),i(X);var oe=a(X,2),u=o(oe),$=a(u,2);i(oe),i(w),i(v),i(n),ye((l,h)=>{se(R,`Edit ${e(m),C(()=>e(m).endpoint_type==="github"?"GitHub":"Gitea")??""} Endpoint`),$.disabled=l,Ge($,1,`px-4 py-2 text-sm font-medium text-white rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors
${h??""}`)},[()=>C(()=>!fe()),()=>C(()=>fe()?"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 cursor-pointer":"bg-gray-400 cursor-not-allowed")]),b("click",c,y),b("click",P,y),E(M,()=>e(r).name,l=>g(r,e(r).name=l)),E(T,()=>e(r).description,l=>g(r,e(r).description=l)),E(Q,()=>e(r).base_url,l=>g(r,e(r).base_url=l)),b("change",re,Ue),b("click",me,()=>document.getElementById("edit_ca_cert_file")?.click()),b("click",u,y),b("submit",w,ze(st)),I(t,n)};ne(De,t=>{e(be)&&e(m)&&t(ut)})}var ct=a(De,2);{var pt=t=>{var n=zt(),c=o(n),v=a(c,2),d=o(v),f=o(d),x=a(o(f),2),R=a(o(x),2),P=o(R);i(R),i(x),i(f),i(d);var w=a(d,2),_=o(w),M=a(_,2);i(w),i(v),i(n),ye(()=>se(P,`Are you sure you want to delete the endpoint "${e(A),C(()=>e(A).name)??""}"? This action cannot be undone.`)),b("click",c,y),b("click",_,y),b("click",M,nt),I(t,n)};ne(ct,t=>{e(ge)&&e(A)&&t(pt)})}I(Ne,Le),yt(),Oe()}export{or as component};